ConfigurationAggregator class

Manages an AWS Config Configuration Aggregator

Example Usage

Account Based Aggregation

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

const account = new aws.cfg.ConfigurationAggregator("account", {
    accountAggregationSource: {
        accountIds: ["123456789012"],
        regions: ["us-west-2"],
    },
    name: "example",
});
import pulumi
import pulumi_aws as aws

account = aws.cfg.ConfigurationAggregator("account",
    account_aggregation_source={
        "account_ids": ["123456789012"],
        "regions": ["us-west-2"],
    },
    name="example")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var account = new Aws.Cfg.ConfigurationAggregator("account", new()
    {
        AccountAggregationSource = new Aws.Cfg.Inputs.ConfigurationAggregatorAccountAggregationSourceArgs
        {
            AccountIds = new[]
            {
                "123456789012",
            },
            Regions = new[]
            {
                "us-west-2",
            },
        },
        Name = "example",
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/cfg"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := cfg.NewConfigurationAggregator(ctx, "account", &cfg.ConfigurationAggregatorArgs{
			AccountAggregationSource: &cfg.ConfigurationAggregatorAccountAggregationSourceArgs{
				AccountIds: pulumi.StringArray{
					pulumi.String("123456789012"),
				},
				Regions: pulumi.StringArray{
					pulumi.String("us-west-2"),
				},
			},
			Name: pulumi.String("example"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_cfg_configurationaggregator" "account" {
  account_aggregation_source = {
    account_ids = ["123456789012"]
    regions     = ["us-west-2"]
  }
  name = "example"
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cfg.ConfigurationAggregator;
import com.pulumi.aws.cfg.ConfigurationAggregatorArgs;
import com.pulumi.aws.cfg.inputs.ConfigurationAggregatorAccountAggregationSourceArgs;
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) {
        var account = new ConfigurationAggregator("account", ConfigurationAggregatorArgs.builder()
            .accountAggregationSource(ConfigurationAggregatorAccountAggregationSourceArgs.builder()
                .accountIds("123456789012")
                .regions("us-west-2")
                .build())
            .name("example")
            .build());

    }
}
resources:
  account:
    type: aws:cfg:ConfigurationAggregator
    properties:
      accountAggregationSource:
        accountIds:
          - '123456789012'
        regions:
          - us-west-2
      name: example

Organization Based Aggregation

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

const assumeRole = aws.iam.getPolicyDocument({
    statements: [{
        principals: [{
            type: "Service",
            identifiers: ["config.amazonaws.com"],
        }],
        effect: "Allow",
        actions: ["sts:AssumeRole"],
    }],
});
const organizationRole = new aws.iam.Role("organization", {
    name: "example",
    assumeRolePolicy: assumeRole.then(assumeRole => assumeRole.json),
});
const organizationRolePolicyAttachment = new aws.iam.RolePolicyAttachment("organization", {
    role: organizationRole.name,
    policyArn: "arn:aws:iam::aws:policy/service-role/AWSConfigRoleForOrganizations",
});
const organization = new aws.cfg.ConfigurationAggregator("organization", {
    organizationAggregationSource: {
        allRegions: true,
        roleArn: organizationRole.arn,
    },
    name: "example",
}, {
    dependsOn: [organizationRolePolicyAttachment],
});
import pulumi
import pulumi_aws as aws

assume_role = aws.iam.get_policy_document(statements=[{
    "principals": [{
        "type": "Service",
        "identifiers": ["config.amazonaws.com"],
    }],
    "effect": "Allow",
    "actions": ["sts:AssumeRole"],
}])
organization_role = aws.iam.Role("organization",
    name="example",
    assume_role_policy=assume_role.json)
organization_role_policy_attachment = aws.iam.RolePolicyAttachment("organization",
    role=organization_role.name,
    policy_arn="arn:aws:iam::aws:policy/service-role/AWSConfigRoleForOrganizations")
organization = aws.cfg.ConfigurationAggregator("organization",
    organization_aggregation_source={
        "all_regions": True,
        "role_arn": organization_role.arn,
    },
    name="example",
    opts = pulumi.ResourceOptions(depends_on=[organization_role_policy_attachment]))
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var assumeRole = Aws.Iam.GetPolicyDocument.Invoke(new()
    {
        Statements = new[]
        {
            new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
            {
                Principals = new[]
                {
                    new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
                    {
                        Type = "Service",
                        Identifiers = new[]
                        {
                            "config.amazonaws.com",
                        },
                    },
                },
                Effect = "Allow",
                Actions = new[]
                {
                    "sts:AssumeRole",
                },
            },
        },
    });

    var organizationRole = new Aws.Iam.Role("organization", new()
    {
        Name = "example",
        AssumeRolePolicy = assumeRole.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
    });

    var organizationRolePolicyAttachment = new Aws.Iam.RolePolicyAttachment("organization", new()
    {
        Role = organizationRole.Name,
        PolicyArn = "arn:aws:iam::aws:policy/service-role/AWSConfigRoleForOrganizations",
    });

    var organization = new Aws.Cfg.ConfigurationAggregator("organization", new()
    {
        OrganizationAggregationSource = new Aws.Cfg.Inputs.ConfigurationAggregatorOrganizationAggregationSourceArgs
        {
            AllRegions = true,
            RoleArn = organizationRole.Arn,
        },
        Name = "example",
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            organizationRolePolicyAttachment,
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/cfg"
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/iam"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		assumeRole, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
			Statements: []iam.GetPolicyDocumentStatement{
				{
					Principals: []iam.GetPolicyDocumentStatementPrincipal{
						{
							Type: "Service",
							Identifiers: []string{
								"config.amazonaws.com",
							},
						},
					},
					Effect: pulumi.StringRef("Allow"),
					Actions: []string{
						"sts:AssumeRole",
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		organizationRole, err := iam.NewRole(ctx, "organization", &iam.RoleArgs{
			Name:             pulumi.String("example"),
			AssumeRolePolicy: pulumi.String(assumeRole.Json),
		})
		if err != nil {
			return err
		}
		organizationRolePolicyAttachment, err := iam.NewRolePolicyAttachment(ctx, "organization", &iam.RolePolicyAttachmentArgs{
			Role:      organizationRole.Name,
			PolicyArn: pulumi.String("arn:aws:iam::aws:policy/service-role/AWSConfigRoleForOrganizations"),
		})
		if err != nil {
			return err
		}
		_, err = cfg.NewConfigurationAggregator(ctx, "organization", &cfg.ConfigurationAggregatorArgs{
			OrganizationAggregationSource: &cfg.ConfigurationAggregatorOrganizationAggregationSourceArgs{
				AllRegions: pulumi.Bool(true),
				RoleArn:    organizationRole.Arn,
			},
			Name: pulumi.String("example"),
		}, pulumi.DependsOn([]pulumi.Resource{
			organizationRolePolicyAttachment,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

data "aws_iam_getpolicydocument" "assumeRole" {
  statements {
    principals {
      type        = "Service"
      identifiers = ["config.amazonaws.com"]
    }
    effect  = "Allow"
    actions = ["sts:AssumeRole"]
  }
}

resource "aws_cfg_configurationaggregator" "organization" {
  depends_on = [aws_iam_rolepolicyattachment.organization]
  organization_aggregation_source = {
    all_regions = true
    role_arn    = aws_iam_role.organization.arn
  }
  name = "example"
}
resource "aws_iam_role" "organization" {
  name               = "example"
  assume_role_policy = data.aws_iam_getpolicydocument.assumeRole.json
}
resource "aws_iam_rolepolicyattachment" "organization" {
  role       = aws_iam_role.organization.name
  policy_arn = "arn:aws:iam::aws:policy/service-role/AWSConfigRoleForOrganizations"
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
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.iam.Role;
import com.pulumi.aws.iam.RoleArgs;
import com.pulumi.aws.iam.RolePolicyAttachment;
import com.pulumi.aws.iam.RolePolicyAttachmentArgs;
import com.pulumi.aws.cfg.ConfigurationAggregator;
import com.pulumi.aws.cfg.ConfigurationAggregatorArgs;
import com.pulumi.aws.cfg.inputs.ConfigurationAggregatorOrganizationAggregationSourceArgs;
import com.pulumi.resources.CustomResourceOptions;
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 assumeRole = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
            .statements(GetPolicyDocumentStatementArgs.builder()
                .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
                    .type("Service")
                    .identifiers("config.amazonaws.com")
                    .build())
                .effect("Allow")
                .actions("sts:AssumeRole")
                .build())
            .build());

        var organizationRole = new Role("organizationRole", RoleArgs.builder()
            .name("example")
            .assumeRolePolicy(assumeRole.json())
            .build());

        var organizationRolePolicyAttachment = new RolePolicyAttachment("organizationRolePolicyAttachment", RolePolicyAttachmentArgs.builder()
            .role(organizationRole.name())
            .policyArn("arn:aws:iam::aws:policy/service-role/AWSConfigRoleForOrganizations")
            .build());

        var organization = new ConfigurationAggregator("organization", ConfigurationAggregatorArgs.builder()
            .organizationAggregationSource(ConfigurationAggregatorOrganizationAggregationSourceArgs.builder()
                .allRegions(true)
                .roleArn(organizationRole.arn())
                .build())
            .name("example")
            .build(), CustomResourceOptions.builder()
                .dependsOn(organizationRolePolicyAttachment)
                .build());

    }
}
resources:
  organization:
    type: aws:cfg:ConfigurationAggregator
    properties:
      organizationAggregationSource:
        allRegions: true
        roleArn: ${organizationRole.arn}
      name: example
    options:
      dependsOn:
        - ${organizationRolePolicyAttachment}
  organizationRole:
    type: aws:iam:Role
    name: organization
    properties:
      name: example
      assumeRolePolicy: ${assumeRole.json}
  organizationRolePolicyAttachment:
    type: aws:iam:RolePolicyAttachment
    name: organization
    properties:
      role: ${organizationRole.name}
      policyArn: arn:aws:iam::aws:policy/service-role/AWSConfigRoleForOrganizations
variables:
  assumeRole:
    fn::invoke:
      function: aws:iam:getPolicyDocument
      arguments:
        statements:
          - principals:
              - type: Service
                identifiers:
                  - config.amazonaws.com
            effect: Allow
            actions:
              - sts:AssumeRole

Import

Identity Schema

Required

  • name (String) Name of the configuration aggregator.

Optional

  • accountId (String) AWS Account where this resource is managed.
  • region (String) Region where this resource is managed.

Using pulumi import, import Configuration Aggregators using the name. For example:

$ pulumi import aws:cfg/configurationAggregator:ConfigurationAggregator example example

Constructors

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

Properties

accountAggregationSource ↔ Output<ConfigurationAggregatorAccountAggregationSource?>
The account(s) to aggregate config data from as documented below.
latefinal
arn ↔ Output<String>
The ARN of the aggregator
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
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 the configuration aggregator.
latefinal
organizationAggregationSource ↔ Output<ConfigurationAggregatorOrganizationAggregationSource?>
The organization to aggregate config data from as documented below.
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>?>
A map of tags to assign to the resource. .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
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, {ConfigurationAggregatorState? state, CustomResourceOptions? options}) → ConfigurationAggregator
Gets an existing ConfigurationAggregator resource's state with the given name and id.