Resource: aws_config_configuration_recorder

Provides an AWS Config Configuration Recorder. Please note that this resource does not start the created recorder automatically.

Example Usage

Basic Usage

resource "aws_config_configuration_recorder" "foo" {
  name     = "example"
  role_arn = aws_iam_role.r.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" "r" {
  name               = "awsconfig-example"
  assume_role_policy = data.aws_iam_policy_document.assume_role.json
}

Exclude Resources Types Usage

resource "aws_config_configuration_recorder" "foo" {
  name     = "example"
  role_arn = aws_iam_role.r.arn

  recording_group {
    all_supported = false

    exclusion_by_resource_types {
      resource_types = ["AWS::EC2::Instance"]
    }

    recording_strategy {
      use_only = "EXCLUSION_BY_RESOURCE_TYPES"
    }
  }
}

Periodic Recording

resource "aws_config_configuration_recorder" "foo" {
  name     = "example"
  role_arn = aws_iam_role.r.arn

  recording_group {
    all_supported                 = false
    include_global_resource_types = false
    resource_types                = ["AWS::EC2::Instance", "AWS::EC2::NetworkInterface"]
  }

  recording_mode {
    recording_frequency = "CONTINUOUS"

    recording_mode_override {
      description         = "Only record EC2 network interfaces daily"
      resource_types      = ["AWS::EC2::NetworkInterface"]
      recording_frequency = "DAILY"
    }
  }
}

Argument Reference

This resource supports the following arguments:

recording_group Configuration Block

exclusion_by_resource_types Configuration Block

recording_strategy Configuration Block

recording_mode Configuration Block

recording_mode_override Configuration Block

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 Recorder using the name. For example:

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

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

% terraform import aws_config_configuration_recorder.foo example