Skip to content

cloudposse-terraform-components/aws-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

65 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Project Banner

Latest ReleaseSlack CommunityGet Support

This component provisions AWS Config across all accounts in an AWS Organization. AWS Config is a service that enables you to assess, audit, and evaluate the configurations of your AWS resources. It continuously monitors and records configuration changes to your AWS resources and provides a detailed view of the relationships between those resources.

Component Features

This component is responsible for:

  • Configuration Recording: Deploys Configuration Recorders in each account and region to track resource configurations
  • Centralized Aggregation: Configures a designated account (typically security) as the central aggregation point for all AWS Config data
  • Compliance Monitoring: Deploys conformance packs to monitor resources for compliance with best practices and industry standards (e.g., CMMC, CIS, HIPAA)
  • Configuration Storage: Delivers configuration snapshots and history to a centralized S3 bucket (typically in the audit account)
  • Organization-wide Conformance Packs: Deploys organization conformance packs from the management account that automatically apply to all member accounts
  • SNS Topic Encryption: Creates encrypted SNS topics for AWS Config notifications (required for CMMC compliance)

New Features

This version includes several enhancements:

  • Local Conformance Pack Support: Load conformance packs from local files in addition to remote URLs. This enables custom packs, air-gapped deployments, and version-controlled compliance rules.
  • Organization Conformance Packs: Deploy conformance packs organization-wide from the management account using the scope: organization setting.
  • SNS Topic Encryption: Built-in support for KMS encryption of AWS Config SNS topics (sns_encryption_key_id variable) for CMMC compliance.
  • Flexible Component Naming: The global_collector_component_name_pattern variable allows customization of how the component looks up the global collector region's remote state.
  • GovCloud Support: Full support for AWS GovCloud regions and partitions.

Key AWS Config Capabilities

  • Configuration History: Maintains a detailed history of changes to AWS resources, showing when changes were made, who made them, and what the changes were
  • Configuration Snapshots: Takes periodic snapshots of resource configurations for point-in-time views
  • Compliance Monitoring: Provides pre-built rules and checks for compliance with best practices and industry standards
  • Relationship Mapping: Maps relationships between AWS resources to understand change impacts
  • Notifications and Alerts: Sends notifications when configuration changes impact compliance or security posture

Architecture

The component deploys a multi-account, multi-region architecture:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                           AWS Organization                                   β”‚
β”‚                                                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚ Management Account (Organization Conformance Packs)                    β”‚ β”‚
β”‚  β”‚  - Deploys organization-wide conformance packs                         β”‚ β”‚
β”‚  β”‚  - Packs automatically apply to all member accounts                    β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚                                                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚ Security Account (Central Aggregator)                                  β”‚ β”‚
β”‚  β”‚  - AWS Config Aggregator (collects from ALL accounts)                  β”‚ β”‚
β”‚  β”‚  - Centralized compliance dashboard                                    β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚                              β–² β–² β–²                                          β”‚
β”‚                              β”‚ β”‚ β”‚ Aggregate Authorizations                 β”‚
β”‚                              β”‚ β”‚ β”‚                                          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚ Audit Account                                                          β”‚ β”‚
β”‚  β”‚  - S3 Bucket (aws-config-bucket)                                       β”‚ β”‚
β”‚  β”‚  - Stores ALL Config data from all accounts ◄───────────────┐          β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”‚β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚                                                                  β”‚           β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚           β”‚
β”‚  β”‚ Each Member Account                                        β”‚ β”‚           β”‚
β”‚  β”‚                                                            β”‚ β”‚           β”‚
β”‚  β”‚  Global Collector Region (e.g., us-east-1):               β”‚ β”‚           β”‚
β”‚  β”‚    βœ“ Configuration Recorder                               β”‚ β”‚           β”‚
β”‚  β”‚    βœ“ IAM Role (created once per account)                  β”‚ β”‚           β”‚
β”‚  β”‚    βœ“ Tracks global resources (IAM, Route53, etc.)         β”‚ β”‚           β”‚
β”‚  β”‚    βœ“ Aggregate Authorization β†’ Security Account           β”‚β”€β”˜           β”‚
β”‚  β”‚    βœ“ Delivery Channel β†’ S3 Bucket (audit) β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚  β”‚                                                            β”‚              β”‚
β”‚  β”‚  Additional Regions (e.g., us-west-2):                    β”‚              β”‚
β”‚  β”‚    βœ“ Configuration Recorder                               β”‚              β”‚
β”‚  β”‚    βœ“ References IAM Role from global collector region     β”‚              β”‚
β”‚  β”‚    βœ“ Tracks regional resources (EC2, VPC, RDS, etc.)      β”‚              β”‚
β”‚  β”‚    βœ“ Delivery Channel β†’ S3 Bucket (audit) β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β”‚
β”‚                                                                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Architecture Benefits

  • Centralized Compliance: Security team can view all resource configurations from one account
  • Cost Efficiency: Single S3 bucket for all AWS Config data (in audit account)
  • Security Best Practices: Aggregation in security account aligns with AWS Well-Architected Framework
  • Scalability: Easy to add new accounts and regions without changing the aggregation setup
  • GovCloud Compatible: Supports AWS GovCloud regions and partitions

Warning

AWS Config Limitations

Be aware of these AWS Config limitations:

  • Maximum 1000 AWS Config rules per account can be evaluated
    • Mitigate by removing duplicate rules across packs
    • Remove rules that don't apply to any resources
    • Consider scheduling pack deployment with Lambda for more than 1000 rules
    • See the Audit Manager docs for converting conformance packs to custom Audit Manager assessments
  • Maximum 50 conformance packs per account

Tip

πŸ‘½ Use Atmos with Terraform

Cloud Posse uses atmos to easily orchestrate multiple environments using Terraform.
Works with Github Actions, Atlantis, or Spacelift.

Watch demo of using Atmos with Terraform
Example of running atmos to manage infrastructure from our Quick Start tutorial.

Usage

Prerequisites

Before deploying this AWS Config component:

  1. AWS Config Bucket: The aws-config-bucket component must be provisioned first in the audit account:

    atmos terraform apply aws-config-bucket -s core-ue1-audit
  2. Support IAM Role (CIS AWS Foundations 1.20): A designated support IAM role should be deployed to every account:

    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Sid": "AllowSupport",
          "Effect": "Allow",
          "Action": ["support:*"],
          "Resource": "*"
        },
        {
          "Sid": "AllowTrustedAdvisor",
          "Effect": "Allow",
          "Action": "trustedadvisor:Describe*",
          "Resource": "*"
        }
      ]
    }
  3. Service Access Principals (for organization-level conformance packs): Enable trusted access for AWS Config in your organization:

    How to Verify:

    aws organizations list-aws-service-access-for-organization | grep config

    Enable if Disabled:

    aws organizations enable-aws-service-access --service-principal config.amazonaws.com
    aws organizations enable-aws-service-access --service-principal config-multiaccountsetup.amazonaws.com

    Or if using our account component, add these principals to aws_service_access_principals.

Usage

Stack Level: Regional

AWS Config is a regional service. The component must be deployed to each region where you want to track resources.

Scope Configuration

The default_scope variable controls how conformance packs are deployed:

Scope Description Use Case
account Conformance packs deployed per-account Member accounts
organization Conformance packs deployed organization-wide Management account only

Tip

Using Account Scope (Member Accounts)

For member accounts, use default_scope: account. The component will:

  • Create a Configuration Recorder in each region
  • Create an IAM role only in the global collector region
  • Authorize the central aggregator account to collect data
  • Deploy account-level conformance packs

Tip

Using Organization Scope (Management Account)

For the management account, use default_scope: organization. The component will:

  • Deploy organization-wide conformance packs that apply to ALL member accounts
  • Require the config-multiaccountsetup.amazonaws.com service access principal

Key Configuration Variables

Variable Description Example
global_resource_collector_region Region that tracks global resources (IAM, Route53) us-east-1
central_resource_collector_account Account that aggregates all Config data security
create_iam_role Set to true - component auto-detects global collector region true
config_bucket_* References the S3 bucket in audit account See example below
sns_encryption_key_id KMS key for SNS topic encryption (CMMC compliance) alias/aws/sns

Catalog Configuration

Default Configuration (stacks/catalog/aws-config/defaults.yaml)

components:
  terraform:
    aws-config/defaults:
      metadata:
        type: abstract
        component: "aws-config"
      vars:
        enabled: true
        default_scope: account
        create_iam_role: true
        az_abbreviation_type: fixed
        account_map_component_name: "account-map"
        account_map_tenant: core
        root_account_stage: root
        global_environment: gbl
        global_resource_collector_region: "us-east-1"
        central_resource_collector_account: security
        config_bucket_component_name: "aws-config-bucket"
        config_bucket_tenant: core
        config_bucket_env: ue1
        config_bucket_stage: audit
        sns_encryption_key_id: "alias/aws/sns"
        conformance_packs: []

Member Account Configuration (stacks/catalog/aws-config/member-account.yaml)

import:
  - catalog/aws-config/defaults

components:
  terraform:
    aws-config:
      metadata:
        component: "aws-config"
        inherits:
          - "aws-config/defaults"

Organization Account Configuration (stacks/catalog/aws-config/organization.yaml)

import:
  - catalog/aws-config/defaults

components:
  terraform:
    aws-config:
      metadata:
        component: "aws-config"
        inherits:
          - "aws-config/defaults"
      vars:
        default_scope: organization
        conformance_packs:
          - name: "Operational-Best-Practices-for-CIS-AWS-v1.4-Level2"
            conformance_pack: "https://raw.githubusercontent.com/awslabs/aws-config-rules/master/aws-config-conformance-packs/Operational-Best-Practices-for-CIS-AWS-v1.4-Level2.yaml"
            parameter_overrides: {}

Conformance Packs

Conformance packs define a collection of AWS Config rules for compliance monitoring. This component supports loading conformance packs from both remote URLs and local files.

Local File Support (New Feature)

The component now supports loading conformance packs from the local filesystem in addition to remote URLs. This enables:

  • Custom conformance packs: Create organization-specific compliance rules
  • Modified AWS packs: Customize AWS-provided packs for your requirements
  • Air-gapped environments: Deploy in environments without internet access
  • Version control: Track conformance pack changes alongside infrastructure code

The component automatically detects whether the conformance_pack value is a URL (starts with http:// or https://) or a local file path. Local paths are resolved relative to the component's root directory.

Conformance Pack Examples

conformance_packs:
  # Remote URL (AWS Labs managed packs)
  - name: "CIS-AWS-v1.4-Level2"
    conformance_pack: "https://raw.githubusercontent.com/awslabs/aws-config-rules/master/aws-config-conformance-packs/Operational-Best-Practices-for-CIS-AWS-v1.4-Level2.yaml"
    parameter_overrides:
      AccessKeysRotatedParamMaxAccessKeyAge: "45"

  # Local file (relative to component directory)
  - name: "Custom-CMMC-Pack"
    conformance_pack: "conformance-packs/custom-cmmc-pack.yaml"
    parameter_overrides: {}

  # Another local file example
  - name: "CMMC-Level2-Best-Practices"
    conformance_pack: "conformance-packs/cmmc-l2-v2-AWS-Best-Practices.yaml"
    parameter_overrides:
      IamPasswordPolicyParamMaxPasswordAge: "60"

  # Override scope for specific pack
  - name: "Org-Wide-Security-Pack"
    conformance_pack: "https://example.com/pack.yaml"
    scope: "organization"  # Override default_scope
    parameter_overrides: {}

Creating Custom Conformance Packs

To create a custom conformance pack:

  1. Create a conformance-packs/ directory in your component:

    components/terraform/aws-config/
    β”œβ”€β”€ conformance-packs/
    β”‚   β”œβ”€β”€ custom-security-rules.yaml
    β”‚   └── cmmc-l2-v2-customized.yaml
    β”œβ”€β”€ main.tf
    β”œβ”€β”€ variables.tf
    └── ...
    
  2. Define rules in CloudFormation format:

    # conformance-packs/custom-security-rules.yaml
    Parameters:
      MaxAccessKeyAge:
        Default: '90'
        Type: String
    Resources:
      AccessKeysRotated:
        Type: AWS::Config::ConfigRule
        Properties:
          ConfigRuleName: custom-access-keys-rotated
          InputParameters:
            maxAccessKeyAge:
              Ref: MaxAccessKeyAge
          Source:
            Owner: AWS
            SourceIdentifier: ACCESS_KEYS_ROTATED
  3. Reference the local file in your configuration:

    conformance_packs:
      - name: "Custom-Security-Rules"
        conformance_pack: "conformance-packs/custom-security-rules.yaml"
        parameter_overrides:
          MaxAccessKeyAge: "45"

SNS Topic Encryption

AWS Config creates an SNS topic for notifications. For CMMC compliance, this topic must be encrypted:

# Option 1: AWS Managed Key (Recommended)
sns_encryption_key_id: "alias/aws/sns"

# Option 2: Customer Managed KMS Key
sns_encryption_key_id: "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012"

Deployment

Provisioning Order

Important

Critical: Deploy Member Accounts BEFORE Organization Account

Organization conformance packs require all member accounts to have configuration recorders already set up. Always deploy member accounts first, then the organization/management account last.

Step 1: Deploy to Member Accounts (Global Collector Region First)

All member accounts can be deployed in parallel:

# Core tenant accounts
atmos terraform apply aws-config -s core-ue1-audit
atmos terraform apply aws-config -s core-ue1-security
atmos terraform apply aws-config -s core-ue1-network
atmos terraform apply aws-config -s core-ue1-identity
atmos terraform apply aws-config -s core-ue1-dns
atmos terraform apply aws-config -s core-ue1-automation

# Platform tenant accounts (if applicable)
atmos terraform apply aws-config -s plat-ue1-dev
atmos terraform apply aws-config -s plat-ue1-staging
atmos terraform apply aws-config -s plat-ue1-prod

Step 2: Deploy to Organization/Management Account (LAST)

atmos terraform apply aws-config -s core-ue1-root

Multi-Region Deployment

AWS Config is regional. For multi-region coverage, deploy to each region:

How Multi-Region Works

  • Global Collector Region (e.g., us-east-1): Creates the IAM role, tracks global resources
  • Additional Regions (e.g., us-west-2): References IAM role via remote state, tracks regional resources only

Prerequisites for Additional Regions

Add the aws-config import to regional baseline files:

# stacks/orgs/acme/core/security/us-west-2/baseline.yaml
import:
  - orgs/acme/core/security/_defaults
  - mixins/region/us-west-2
  - catalog/aws-config/member-account  # Add this

Deploy Additional Regions

Follow the same order: member accounts first, then organization account.

# Step 1: Member accounts in us-west-2
atmos terraform apply aws-config -s core-uw2-audit
atmos terraform apply aws-config -s core-uw2-security
# ... all other member accounts

# Step 2: Organization account in us-west-2 (LAST)
atmos terraform apply aws-config -s core-uw2-root

Known Issues and False Positives

IAM Inline Policy Check - Service-Linked Roles

The IAM_NO_INLINE_POLICY_CHECK rule flags AWS Service-Linked Roles (SLRs) as NON_COMPLIANT. This is a known false positive.

Why This Happens:

  • AWS Service-Linked Roles are automatically created and managed by AWS services
  • These roles must have inline policies by AWS design
  • The rule cannot distinguish between user-created roles and AWS-managed SLRs

Common SLRs That Trigger This Finding:

Service-Linked Role Service
AWSServiceRoleForAmazonGuardDuty GuardDuty
AWSServiceRoleForConfig AWS Config
AWSServiceRoleForSecurityHub Security Hub
AWSServiceRoleForAccessAnalyzer IAM Access Analyzer
AWSServiceRoleForAmazonMacie Macie
AWSServiceRoleForInspector2 Inspector

Recommended Action:

  • Document these as accepted false positives
  • Focus remediation on NON_COMPLIANT findings for user-created roles (not starting with AWSServiceRole)
  • Validate findings with: aws iam get-role --role-name <role> --query 'Role.Path'
    • Service-linked roles have path: /aws-service-role/<service>/

For CMMC/Compliance Auditors:

  • Service-linked roles are AWS-managed and out of customer control
  • CMMC framework recognizes AWS-managed resources as acceptable exceptions
  • Document the exception with proper justification

Verification Commands

# Verify SNS topic encryption
aws sns get-topic-attributes \
  --topic-arn arn:aws:sns:us-east-1:123456789012:config-topic \
  --query 'Attributes.KmsMasterKeyId'

# List service-linked roles
aws iam list-roles --query 'Roles[?starts_with(RoleName, `AWSServiceRole`)].RoleName'

# Check if role is service-linked
aws iam get-role --role-name AWSServiceRoleForAmazonGuardDuty --query 'Role.Path'

Important

In Cloud Posse's examples, we avoid pinning modules to specific versions to prevent discrepancies between the documentation and the latest released versions. However, for your own projects, we strongly advise pinning each module to the exact version you're using. This practice ensures the stability of your infrastructure. Additionally, we recommend implementing a systematic approach for updating versions to avoid unexpected changes.

Requirements

Name Version
terraform >= 1.0.0
aws >= 4.0, < 6.0.0
awsutils >= 0.16.0, < 6.0.0

Providers

Name Version
aws >= 4.0, < 6.0.0

Modules

Name Source Version
account_map cloudposse/stack-config/yaml//modules/remote-state 1.8.0
aws_config cloudposse/config/aws 1.5.3
aws_config_label cloudposse/label/null 0.25.0
config_bucket cloudposse/stack-config/yaml//modules/remote-state 1.8.0
conformance_pack cloudposse/config/aws//modules/conformance-pack 1.5.3
global_collector_region cloudposse/stack-config/yaml//modules/remote-state 1.8.0
iam_roles ../account-map/modules/iam-roles n/a
org_conformance_pack ./modules/org-conformance-pack n/a
this cloudposse/label/null 0.25.0
utils cloudposse/utils/aws 1.4.0

Resources

Name Type
aws_caller_identity.this data source
aws_partition.this data source
aws_region.this data source

Inputs

Name Description Type Default Required
account_map_component_name The name of the account-map component string "account-map" no
account_map_tenant (Optional) The tenant where the account_map component required by remote-state is deployed. string "" no
additional_tag_map Additional key-value pairs to add to each map in tags_as_list_of_maps. Not added to tags or id.
This is for some rare cases where resources want additional configuration of tags
and therefore take a list of maps with tag key, value, and additional configuration.
map(string) {} no
attributes ID element. Additional attributes (e.g. workers or cluster) to add to id,
in the order they appear in the list. New attributes are appended to the
end of the list. The elements of the list are joined by the delimiter
and treated as a single ID element.
list(string) [] no
az_abbreviation_type AZ abbreviation type, fixed or short string "fixed" no
central_resource_collector_account The name of the account that is the centralized aggregation account. string n/a yes
config_bucket_component_name The name of the config-bucket component string "config-bucket" no
config_bucket_env The environment of the AWS Config S3 Bucket string n/a yes
config_bucket_stage The stage of the AWS Config S3 Bucket string n/a yes
config_bucket_tenant (Optional) The tenant of the AWS Config S3 Bucket string "" no
config_component_name The name of the aws config component (i.e., this component) string "aws-config" no
conformance_packs List of conformance packs. Each conformance pack is a map with the following keys: name, conformance_pack, parameter_overrides.

For example:
conformance_packs = [
{
name = "Operational-Best-Practices-for-CIS-AWS-v1.4-Level1"
conformance_pack = "https://raw.githubusercontent.com/awslabs/aws-config-rules/master/aws-config-conformance-packs/Operational-Best-Practices-for-CIS-AWS-v1.4-Level1.yaml"
parameter_overrides = {
"AccessKeysRotatedParamMaxAccessKeyAge" = "45"
}
},
{
name = "Operational-Best-Practices-for-CIS-AWS-v1.4-Level2"
conformance_pack = "https://raw.githubusercontent.com/awslabs/aws-config-rules/master/aws-config-conformance-packs/Operational-Best-Practices-for-CIS-AWS-v1.4-Level2.yaml"
parameter_overrides = {
"IamPasswordPolicyParamMaxPasswordAge" = "45"
}
}
]

Complete list of AWS Conformance Packs managed by AWSLabs can be found here:
https://github.com/awslabs/aws-config-rules/tree/master/aws-config-conformance-packs
list(object({
name = string
conformance_pack = string
parameter_overrides = map(any)
scope = optional(string, null)
}))
[] no
context Single object for setting entire context at once.
See description of individual variables for details.
Leave string and numeric variables as null to use default value.
Individual variable settings (non-null) override settings in context object,
except for attributes, tags, and additional_tag_map, which are merged.
any
{
"additional_tag_map": {},
"attributes": [],
"delimiter": null,
"descriptor_formats": {},
"enabled": true,
"environment": null,
"id_length_limit": null,
"label_key_case": null,
"label_order": [],
"label_value_case": null,
"labels_as_tags": [
"unset"
],
"name": null,
"namespace": null,
"regex_replace_chars": null,
"stage": null,
"tags": {},
"tenant": null
}
no
create_iam_role Flag to indicate whether an IAM Role should be created to grant the proper permissions for AWS Config bool false no
default_scope The default scope of the conformance pack. Valid values are account and organization. string "account" no
delegated_accounts The account IDs of other accounts that will send their AWS Configuration or Security Hub data to this account set(string) null no
delimiter Delimiter to be used between ID elements.
Defaults to - (hyphen). Set to "" to use no delimiter at all.
string null no
descriptor_formats Describe additional descriptors to be output in the descriptors output map.
Map of maps. Keys are names of descriptors. Values are maps of the form
{<br/> format = string<br/> labels = list(string)<br/>}
(Type is any so the map values can later be enhanced to provide additional options.)
format is a Terraform format string to be passed to the format() function.
labels is a list of labels, in order, to pass to format() function.
Label values will be normalized before being passed to format() so they will be
identical to how they appear in id.
Default is {} (descriptors output will be empty).
any {} no
enabled Set to false to prevent the module from creating any resources bool null no
environment ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' string null no
global_collector_component_name_pattern A string formatting pattern used to construct or look up the name of the
global AWS Config collector region component.

This pattern should align with the regional naming convention of the
aws-config component. For example, if the pattern is "%s-%s" and you pass
("aws-config", "use1"), the resulting component name will be "aws-config-use1".

Adjust this pattern if your environment uses a different naming convention
for regional AWS Config components.
string "%s-%s" no
global_environment Global environment name string "gbl" no
global_resource_collector_region The region that collects AWS Config data for global resources such as IAM string n/a yes
iam_role_arn The ARN for an IAM Role AWS Config uses to make read or write requests to the delivery channel and to describe the
AWS resources associated with the account. This is only used if create_iam_role is false.

If you want to use an existing IAM Role, set the variable to the ARN of the existing role and set create_iam_role to false.

See the AWS Docs for further information:
http://docs.aws.amazon.com/config/latest/developerguide/iamrole-permissions.html
string null no
id_length_limit Limit id to this many characters (minimum 6).
Set to 0 for unlimited length.
Set to null for keep the existing setting, which defaults to 0.
Does not affect id_full.
number null no
label_key_case Controls the letter case of the tags keys (label names) for tags generated by this module.
Does not affect keys of tags passed in via the tags input.
Possible values: lower, title, upper.
Default value: title.
string null no
label_order The order in which the labels (ID elements) appear in the id.
Defaults to ["namespace", "environment", "stage", "name", "attributes"].
You can omit any of the 6 labels ("tenant" is the 6th), but at least one must be present.
list(string) null no
label_value_case Controls the letter case of ID elements (labels) as included in id,
set as tag values, and output by this module individually.
Does not affect values of tags passed in via the tags input.
Possible values: lower, title, upper and none (no transformation).
Set this to title and set delimiter to "" to yield Pascal Case IDs.
Default value: lower.
string null no
labels_as_tags Set of labels (ID elements) to include as tags in the tags output.
Default is to include all labels.
Tags with empty values will not be included in the tags output.
Set to [] to suppress all generated tags.
Notes:
The value of the name tag, if included, will be the id, not the name.
Unlike other null-label inputs, the initial setting of labels_as_tags cannot be
changed in later chained modules. Attempts to change it will be silently ignored.
set(string)
[
"default"
]
no
managed_rules A list of AWS Managed Rules that should be enabled on the account.

See the following for a list of possible rules to enable:
https://docs.aws.amazon.com/config/latest/developerguide/managed-rules-by-aws-config.html

Example:
managed_rules = {
access-keys-rotated = {
identifier = "ACCESS_KEYS_ROTATED"
description = "Checks whether the active access keys are rotated within the number of days specified in maxAccessKeyAge. The rule is NON_COMPLIANT if the access keys have not been rotated for more than maxAccessKeyAge number of days."
input_parameters = {
maxAccessKeyAge : "90"
}
enabled = true
tags = {}
}
}
map(object({
description = string
identifier = string
input_parameters = any
tags = map(string)
enabled = bool
}))
{} no
name ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.
This is the only ID element not also included as a tag.
The "name" tag is set to the full id string. There is no tag with the value of the name input.
string null no
namespace ID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp', to help ensure generated IDs are globally unique string null no
privileged True if the default provider already has access to the backend bool false no
regex_replace_chars Terraform regular expression (regex) string.
Characters matching the regex will be removed from the ID elements.
If not set, "/[^a-zA-Z0-9-]/" is used to remove all characters other than hyphens, letters and digits.
string null no
region AWS Region string n/a yes
root_account_stage The stage name for the Organization root (master) account string "root" no
sns_encryption_key_id The ID of an AWS-managed customer master key (CMK) for Amazon SNS or a custom CMK.

Use "alias/aws/sns" for AWS managed key (recommended for compliance).
Use a custom KMS key ARN or alias for organization-specific encryption requirements.

IMPORTANT: This is required for CMMC compliance (cmmc-2-v2-sns-encrypted-kms rule).
The SNS topic created by AWS Config must be encrypted with KMS.
string "alias/aws/sns" no
stage ID element. Usually used to indicate role, e.g. 'prod', 'staging', 'source', 'build', 'test', 'deploy', 'release' string null no
tags Additional tags (e.g. {'BusinessUnit': 'XYZ'}).
Neither the tag keys nor the tag values will be modified by this module.
map(string) {} no
tenant ID element _(Rarely used, not included by default)_. A customer identifier, indicating who this instance of a resource is for string null no

Outputs

Name Description
aws_config_configuration_recorder_id The ID of the AWS Config Recorder
aws_config_iam_role The ARN of the IAM Role used for AWS Config
storage_bucket_arn Storage Config bucket ARN
storage_bucket_id Storage Config bucket ID

Related Projects

Check out these related projects.

  • Cloud Posse Terraform Modules - Our collection of reusable Terraform modules used by our reference architectures.
  • Atmos - Atmos is like docker-compose but for your infrastructure

References

For additional context, refer to some of these links.

Tip

Use Terraform Reference Architectures for AWS

Use Cloud Posse's ready-to-go terraform architecture blueprints for AWS to get up and running quickly.

βœ… We build it together with your team.
βœ… Your team owns everything.
βœ… 100% Open Source and backed by fanatical support.

Request Quote

πŸ“š Learn More

Cloud Posse is the leading DevOps Accelerator for funded startups and enterprises.

Your team can operate like a pro today.

Ensure that your team succeeds by using Cloud Posse's proven process and turnkey blueprints. Plus, we stick around until you succeed.

Day-0: Your Foundation for Success

  • Reference Architecture. You'll get everything you need from the ground up built using 100% infrastructure as code.
  • Deployment Strategy. Adopt a proven deployment strategy with GitHub Actions, enabling automated, repeatable, and reliable software releases.
  • Site Reliability Engineering. Gain total visibility into your applications and services with Datadog, ensuring high availability and performance.
  • Security Baseline. Establish a secure environment from the start, with built-in governance, accountability, and comprehensive audit logs, safeguarding your operations.
  • GitOps. Empower your team to manage infrastructure changes confidently and efficiently through Pull Requests, leveraging the full power of GitHub Actions.

Request Quote

Day-2: Your Operational Mastery

  • Training. Equip your team with the knowledge and skills to confidently manage the infrastructure, ensuring long-term success and self-sufficiency.
  • Support. Benefit from a seamless communication over Slack with our experts, ensuring you have the support you need, whenever you need it.
  • Troubleshooting. Access expert assistance to quickly resolve any operational challenges, minimizing downtime and maintaining business continuity.
  • Code Reviews. Enhance your team’s code quality with our expert feedback, fostering continuous improvement and collaboration.
  • Bug Fixes. Rely on our team to troubleshoot and resolve any issues, ensuring your systems run smoothly.
  • Migration Assistance. Accelerate your migration process with our dedicated support, minimizing disruption and speeding up time-to-value.
  • Customer Workshops. Engage with our team in weekly workshops, gaining insights and strategies to continuously improve and innovate.

Request Quote

✨ Contributing

This project is under active development, and we encourage contributions from our community.

Many thanks to our outstanding contributors:

For πŸ› bug reports & feature requests, please use the issue tracker.

In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.

  1. Review our Code of Conduct and Contributor Guidelines.
  2. Fork the repo on GitHub
  3. Clone the project to your own machine
  4. Commit changes to your own branch
  5. Push your work back up to your fork
  6. Submit a Pull Request so that we can review your changes

NOTE: Be sure to merge the latest changes from "upstream" before making a pull request!

Running Terraform Tests

We use Atmos to streamline how Terraform tests are run. It centralizes configuration and wraps common test workflows with easy-to-use commands.

All tests are located in the test/ folder.

Under the hood, tests are powered by Terratest together with our internal Test Helpers library, providing robust infrastructure validation.

Setup dependencies:

To run tests:

  • Run all tests:
    atmos test run
  • Clean up test artifacts:
    atmos test clean
  • Explore additional test options:
    atmos test --help

The configuration for test commands is centrally managed. To review what's being imported, see the atmos.yaml file.

Learn more about our automated testing in our documentation or implementing custom commands with atmos.

🌎 Slack Community

Join our Open Source Community on Slack. It's FREE for everyone! Our "SweetOps" community is where you get to talk with others who share a similar vision for how to rollout and manage infrastructure. This is the best place to talk shop, ask questions, solicit feedback, and work together as a community to build totally sweet infrastructure.

πŸ“° Newsletter

Sign up for our newsletter and join 3,000+ DevOps engineers, CTOs, and founders who get insider access to the latest DevOps trends, so you can always stay in the know. Dropped straight into your Inbox every week β€” and usually a 5-minute read.

πŸ“† Office Hours

Join us every Wednesday via Zoom for your weekly dose of insider DevOps trends, AWS news and Terraform insights, all sourced from our SweetOps community, plus a live Q&A that you can’t find anywhere else. It's FREE for everyone!

License

License

Preamble to the Apache License, Version 2.0

Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

  https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.

Trademarks

All other trademarks referenced herein are the property of their respective owners.


Copyright Β© 2017-2026 Cloud Posse, LLC

README footer

Beacon

About

This component is responsible for configuring AWS Config

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

 
 
 

Contributors