Resource: aws_config_configuration_aggregator

Manages an AWS Config Configuration Aggregator

Example Usage

Account Based Aggregation

resource "aws_config_configuration_aggregator" "account" {
  name = "example"

  account_aggregation_source {
    account_ids = ["123456789012"]
    regions     = ["us-west-2"]
  }
}

Organization Based Aggregation

resource "aws_config_configuration_aggregator" "organization" {
  depends_on = [aws_iam_role_policy_attachment.organization]

  name = "example" # Required

  organization_aggregation_source {
    all_regions = true
    role_arn    = aws_iam_role.organization.arn
  }
}

data "aws_iam_policy_document" "assume_role" {
  statement {
    effect = "Allow"

    principals {
      type        = "Service"
      identifiers = ["config.amazonaws.com"]
    }

    actions = ["sts:AssumeRole"]
  }
}
resource "aws_iam_role" "organization" {
  name               = "example"
  assume_role_policy = data.aws_iam_policy_document.assume_role.json
}

resource "aws_iam_role_policy_attachment" "organization" {
  role       = aws_iam_role.organization.name
  policy_arn = "arn:aws:iam::aws:policy/service-role/AWSConfigRoleForOrganizations"
}

Argument Reference

This resource supports the following arguments:

Either account_aggregation_source or organization_aggregation_source must be specified.

account_aggregation_source

Either regions or all_regions (as true) must be specified.

organization_aggregation_source

Either regions or all_regions (as true) must be specified.

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Import

In Terraform v1.5.0 and later, use an import block to import Configuration Aggregators using the name. For example:

import {
  to = aws_config_configuration_aggregator.example
  id = "foo"
}

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

% terraform import aws_config_configuration_aggregator.example foo