ReportGroup class

Provides a CodeBuild Report Groups Resource.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const current = aws.getCallerIdentity({});
const example = current.then(current => aws.iam.getPolicyDocument({
    statements: [{
        principals: [{
            type: "AWS",
            identifiers: [`arn:aws:iam::${current.accountId}:root`],
        }],
        sid: "Enable IAM User Permissions",
        effect: "Allow",
        actions: ["kms:*"],
        resources: ["*"],
    }],
}));
const exampleKey = new aws.kms.Key("example", {
    description: "my test kms key",
    deletionWindowInDays: 7,
    policy: example.then(example => example.json),
});
const exampleBucket = new aws.s3.Bucket("example", {bucket: "my-test"});
const exampleReportGroup = new aws.codebuild.ReportGroup("example", {
    exportConfig: {
        s3Destination: {
            bucket: exampleBucket.id,
            encryptionDisabled: false,
            encryptionKey: exampleKey.arn,
            packaging: "NONE",
            path: "/some",
        },
        type: "S3",
    },
    name: "my test report group",
    type: "TEST",
});
import pulumi
import pulumi_aws as aws

current = aws.get_caller_identity()
example = aws.iam.get_policy_document(statements=[{
    "principals": [{
        "type": "AWS",
        "identifiers": [f"arn:aws:iam::{current.account_id}:root"],
    }],
    "sid": "Enable IAM User Permissions",
    "effect": "Allow",
    "actions": ["kms:*"],
    "resources": ["*"],
}])
example_key = aws.kms.Key("example",
    description="my test kms key",
    deletion_window_in_days=7,
    policy=example.json)
example_bucket = aws.s3.Bucket("example", bucket="my-test")
example_report_group = aws.codebuild.ReportGroup("example",
    export_config={
        "s3_destination": {
            "bucket": example_bucket.id,
            "encryption_disabled": False,
            "encryption_key": example_key.arn,
            "packaging": "NONE",
            "path": "/some",
        },
        "type": "S3",
    },
    name="my test report group",
    type="TEST")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var current = Aws.GetCallerIdentity.Invoke();

    var example = Aws.Iam.GetPolicyDocument.Invoke(new()
    {
        Statements = new[]
        {
            new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
            {
                Principals = new[]
                {
                    new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
                    {
                        Type = "AWS",
                        Identifiers = new[]
                        {
                            $"arn:aws:iam::{current.Apply(getCallerIdentityResult => getCallerIdentityResult.AccountId)}:root",
                        },
                    },
                },
                Sid = "Enable IAM User Permissions",
                Effect = "Allow",
                Actions = new[]
                {
                    "kms:*",
                },
                Resources = new[]
                {
                    "*",
                },
            },
        },
    });

    var exampleKey = new Aws.Kms.Key("example", new()
    {
        Description = "my test kms key",
        DeletionWindowInDays = 7,
        Policy = example.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
    });

    var exampleBucket = new Aws.S3.Bucket("example", new()
    {
        BucketName = "my-test",
    });

    var exampleReportGroup = new Aws.CodeBuild.ReportGroup("example", new()
    {
        ExportConfig = new Aws.CodeBuild.Inputs.ReportGroupExportConfigArgs
        {
            S3Destination = new Aws.CodeBuild.Inputs.ReportGroupExportConfigS3DestinationArgs
            {
                Bucket = exampleBucket.Id,
                EncryptionDisabled = false,
                EncryptionKey = exampleKey.Arn,
                Packaging = "NONE",
                Path = "/some",
            },
            Type = "S3",
        },
        Name = "my test report group",
        Type = "TEST",
    });

});
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws"
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/codebuild"
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/iam"
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/kms"
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/s3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		current, err := aws.GetCallerIdentity(ctx, &aws.GetCallerIdentityArgs{}, nil)
		if err != nil {
			return err
		}
		example, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
			Statements: []iam.GetPolicyDocumentStatement{
				{
					Principals: []iam.GetPolicyDocumentStatementPrincipal{
						{
							Type: "AWS",
							Identifiers: []string{
								fmt.Sprintf("arn:aws:iam::%v:root", current.AccountId),
							},
						},
					},
					Sid:    pulumi.StringRef("Enable IAM User Permissions"),
					Effect: pulumi.StringRef("Allow"),
					Actions: []string{
						"kms:*",
					},
					Resources: []string{
						"*",
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		exampleKey, err := kms.NewKey(ctx, "example", &kms.KeyArgs{
			Description:          pulumi.String("my test kms key"),
			DeletionWindowInDays: pulumi.Int(7),
			Policy:               pulumi.String(example.Json),
		})
		if err != nil {
			return err
		}
		exampleBucket, err := s3.NewBucket(ctx, "example", &s3.BucketArgs{
			Bucket: pulumi.String("my-test"),
		})
		if err != nil {
			return err
		}
		_, err = codebuild.NewReportGroup(ctx, "example", &codebuild.ReportGroupArgs{
			ExportConfig: &codebuild.ReportGroupExportConfigArgs{
				S3Destination: &codebuild.ReportGroupExportConfigS3DestinationArgs{
					Bucket:             exampleBucket.ID().ToIDOutput().ToStringOutput(),
					EncryptionDisabled: pulumi.Bool(false),
					EncryptionKey:      exampleKey.Arn,
					Packaging:          pulumi.String("NONE"),
					Path:               pulumi.String("/some"),
				},
				Type: pulumi.String("S3"),
			},
			Name: pulumi.String("my test report group"),
			Type: pulumi.String("TEST"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

data "aws_getcalleridentity" "current" {
}
data "aws_iam_getpolicydocument" "example" {
  statements {
    principals {
      type        = "AWS"
      identifiers = ["arn:aws:iam::${data.aws_getcalleridentity.current.account_id}:root"]
    }
    sid       = "Enable IAM User Permissions"
    effect    = "Allow"
    actions   = ["kms:*"]
    resources = ["*"]
  }
}

resource "aws_kms_key" "example" {
  description             = "my test kms key"
  deletion_window_in_days = 7
  policy                  = data.aws_iam_getpolicydocument.example.json
}
resource "aws_s3_bucket" "example" {
  bucket = "my-test"
}
resource "aws_codebuild_reportgroup" "example" {
  export_config = {
    s3_destination = {
      bucket              = aws_s3_bucket.example.id
      encryption_disabled = false
      encryption_key      = aws_kms_key.example.arn
      packaging           = "NONE"
      path                = "/some"
    }
    type = "S3"
  }
  name = "my test report group"
  type = "TEST"
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.AwsFunctions;
import com.pulumi.aws.inputs.GetCallerIdentityArgs;
import com.pulumi.aws.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentStatementArgs;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentStatementPrincipalArgs;
import com.pulumi.aws.kms.Key;
import com.pulumi.aws.kms.KeyArgs;
import com.pulumi.aws.s3.Bucket;
import com.pulumi.aws.s3.BucketArgs;
import com.pulumi.aws.codebuild.ReportGroup;
import com.pulumi.aws.codebuild.ReportGroupArgs;
import com.pulumi.aws.codebuild.inputs.ReportGroupExportConfigArgs;
import com.pulumi.aws.codebuild.inputs.ReportGroupExportConfigS3DestinationArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var current = AwsFunctions.getCallerIdentity(GetCallerIdentityArgs.builder()
            .build());

        final var example = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
            .statements(GetPolicyDocumentStatementArgs.builder()
                .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
                    .type("AWS")
                    .identifiers(String.format("arn:aws:iam::%s:root", current.accountId()))
                    .build())
                .sid("Enable IAM User Permissions")
                .effect("Allow")
                .actions("kms:*")
                .resources("*")
                .build())
            .build());

        var exampleKey = new Key("exampleKey", KeyArgs.builder()
            .description("my test kms key")
            .deletionWindowInDays(7)
            .policy(example.json())
            .build());

        var exampleBucket = new Bucket("exampleBucket", BucketArgs.builder()
            .bucket("my-test")
            .build());

        var exampleReportGroup = new ReportGroup("exampleReportGroup", ReportGroupArgs.builder()
            .exportConfig(ReportGroupExportConfigArgs.builder()
                .s3Destination(ReportGroupExportConfigS3DestinationArgs.builder()
                    .bucket(exampleBucket.id())
                    .encryptionDisabled(false)
                    .encryptionKey(exampleKey.arn())
                    .packaging("NONE")
                    .path("/some")
                    .build())
                .type("S3")
                .build())
            .name("my test report group")
            .type("TEST")
            .build());

    }
}
resources:
  exampleKey:
    type: aws:kms:Key
    name: example
    properties:
      description: my test kms key
      deletionWindowInDays: 7
      policy: ${example.json}
  exampleBucket:
    type: aws:s3:Bucket
    name: example
    properties:
      bucket: my-test
  exampleReportGroup:
    type: aws:codebuild:ReportGroup
    name: example
    properties:
      exportConfig:
        s3Destination:
          bucket: ${exampleBucket.id}
          encryptionDisabled: false
          encryptionKey: ${exampleKey.arn}
          packaging: NONE
          path: /some
        type: S3
      name: my test report group
      type: TEST
variables:
  current:
    fn::invoke:
      function: aws:getCallerIdentity
      arguments: {}
  example:
    fn::invoke:
      function: aws:iam:getPolicyDocument
      arguments:
        statements:
          - principals:
              - type: AWS
                identifiers:
                  - arn:aws:iam::${current.accountId}:root
            sid: Enable IAM User Permissions
            effect: Allow
            actions:
              - kms:*
            resources:
              - '*'

Import

Identity Schema

Required

  • arn (String) ARN of the CodeBuild report group.

Using pulumi import, import CodeBuild Report Group using the CodeBuild Report Group arn. For example:

$ pulumi import aws:codebuild/reportGroup:ReportGroup example arn:aws:codebuild:us-west-2:123456789:report-group/report-group-name

Constructors

ReportGroup(String name, {ReportGroupArgs? args, CustomResourceOptions? options})
Creates a new ReportGroup. name The Pulumi resource name. args Arguments used to configure this ReportGroup. The set of arguments for ReportGroup. options Resource options controlling this resource's behavior.
ReportGroup.reference(String urn)
Creates a typed reference to an existing ReportGroup resource.

Properties

arn ↔ Output<String>
The ARN of Report Group.
latefinal
childResources Set<Resource>
finalinherited
completionSources Map<String, IOutputCompletionSource>
latefinalinherited
created ↔ Output<String>
The date and time this Report Group was created.
latefinal
deleteReports ↔ Output<bool?>
If true, deletes any reports that belong to a report group before deleting the report group. If false, you must delete any reports in the report group before deleting it. Default value is false.
latefinal
exportConfig ↔ Output<ReportGroupExportConfig>
Information about the destination where the raw data of this Report Group is exported. see Export Config documented below.
latefinal
hashCode int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
isCustom bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference bool
Whether this instance represents a resource value returned over RPC.
finalinherited
name ↔ Output<String>
The name of a Report Group.
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceTransforms List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tags ↔ Output<Map<String, String>?>
Key-value mapping of resource tags. .If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
latefinal
tagsAll ↔ Output<Map<String, String>>
A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
latefinal
transformations List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
type ↔ Output<String>
The type of the Report Group. Valid value are TEST and CODE_COVERAGE.
latefinal
urn ↔ Output<String>
latefinalinherited

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() String
Returns this resource's logical name.
inherited
getResourceType() String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {ReportGroupState? state, CustomResourceOptions? options}) ReportGroup
Gets an existing ReportGroup resource's state with the given name and id.