Browse the Repo

file-type-icon.circleci
file-type-icon.github
file-type-icon.patcher
file-type-icon_ci
file-type-icon_docs
file-type-iconcodegen
file-type-iconexamples
file-type-iconmodules
file-type-icon_deprecated
file-type-iconauto-update
file-type-iconaws-auth
file-type-iconaws-config-bucket
file-type-iconaws-config-multi-region
file-type-iconaws-config-rules
file-type-iconREADME.adoc
file-type-iconcore-concepts.md
file-type-iconmain.tf
file-type-iconoutputs.tf
file-type-iconvariables.tf
file-type-iconaws-config
file-type-iconaws-organizations
file-type-iconcloudtrail-bucket
file-type-iconcloudtrail
file-type-iconcross-account-iam-roles
file-type-iconcustom-iam-entity
file-type-iconebs-encryption-multi-region
file-type-iconebs-encryption
file-type-iconfail2ban
file-type-icongithub-actions-iam-role
file-type-iconguardduty-multi-region
file-type-iconguardduty
file-type-iconiam-access-analyzer-multi-region
file-type-iconiam-groups
file-type-iconiam-policies
file-type-iconiam-user-password-policy
file-type-iconiam-users
file-type-iconip-lockdown
file-type-iconkms-cmk-replica
file-type-iconkms-grant-multi-region
file-type-iconkms-master-key-multi-region
file-type-iconkms-master-key
file-type-iconntp
file-type-iconos-hardening
file-type-iconprivate-s3-bucket
file-type-iconsaml-iam-roles
file-type-iconsecrets-manager-resource-policies
file-type-iconssh-grunt-selinux-policy
file-type-iconssh-grunt
file-type-iconssh-iam
file-type-iconssm-healthchecks-iam-permissions
file-type-icontls-cert-private
file-type-icontest
file-type-icon.editorconfig
file-type-icon.gitignore
file-type-icon.pre-commit-config.yaml
file-type-iconCODEOWNERS
file-type-iconLICENSE.txt
file-type-iconREADME.adoc
file-type-iconterraform-cloud-enterprise-private-module-...

Browse the Repo

file-type-icon.circleci
file-type-icon.github
file-type-icon.patcher
file-type-icon_ci
file-type-icon_docs
file-type-iconcodegen
file-type-iconexamples
file-type-iconmodules
file-type-icon_deprecated
file-type-iconauto-update
file-type-iconaws-auth
file-type-iconaws-config-bucket
file-type-iconaws-config-multi-region
file-type-iconaws-config-rules
file-type-iconREADME.adoc
file-type-iconcore-concepts.md
file-type-iconmain.tf
file-type-iconoutputs.tf
file-type-iconvariables.tf
file-type-iconaws-config
file-type-iconaws-organizations
file-type-iconcloudtrail-bucket
file-type-iconcloudtrail
file-type-iconcross-account-iam-roles
file-type-iconcustom-iam-entity
file-type-iconebs-encryption-multi-region
file-type-iconebs-encryption
file-type-iconfail2ban
file-type-icongithub-actions-iam-role
file-type-iconguardduty-multi-region
file-type-iconguardduty
file-type-iconiam-access-analyzer-multi-region
file-type-iconiam-groups
file-type-iconiam-policies
file-type-iconiam-user-password-policy
file-type-iconiam-users
file-type-iconip-lockdown
file-type-iconkms-cmk-replica
file-type-iconkms-grant-multi-region
file-type-iconkms-master-key-multi-region
file-type-iconkms-master-key
file-type-iconntp
file-type-iconos-hardening
file-type-iconprivate-s3-bucket
file-type-iconsaml-iam-roles
file-type-iconsecrets-manager-resource-policies
file-type-iconssh-grunt-selinux-policy
file-type-iconssh-grunt
file-type-iconssh-iam
file-type-iconssm-healthchecks-iam-permissions
file-type-icontls-cert-private
file-type-icontest
file-type-icon.editorconfig
file-type-icon.gitignore
file-type-icon.pre-commit-config.yaml
file-type-iconCODEOWNERS
file-type-iconLICENSE.txt
file-type-iconREADME.adoc
file-type-iconterraform-cloud-enterprise-private-module-...
AWS Config

AWS Config

Run AWS Config to assess, audit, and evaluate the configurations of your AWS resources, ensuring they meet your compliance requirements.

Code Preview

Preview the Code

mobile file icon

core-concepts.md

down

AWS Organizations Config Rules Core Concepts

Background

What are Managed Config Rules?

AWS Config provides AWS managed rules, which are predefined, customizable rules that AWS Config uses to evaluate whether your AWS resources comply with common best practices.

How do Organization-Level Config Rules Compare to Account-Level Config Rules?

You can apply exactly the same Config Rules at either the organization-level or account-level. By default, this module applies rules at the organization level, but you can switch to account-level rules by setting create_account_rules to true.

Here is how organization-level and account-level rules compare:

Organization-Level Rules Account-Level Rules
Accounts Applied solely in the root account. Must be applied separately in every single account. Note that if you're already applying security baselines to every account (e.g., using if you're managing everything as code the account-baseline-root, [account-baseline-security] (/modules/account-baseline-security), and account-baseline-app modules) there isn't much extra overhead to this.
Governance Users in child accounts can add additional Config Rules but no one in a child account can remove or modify organization-level rules applied in the root account. Users with sufficient permissions can add, modify, or remove account-level rules in their own account.
Chicken-and-egg problem The way organization-level Config Rules are managed in Terraform creates a chicken-and-egg problem: the rules will cause an error unless every single child account has a Config Recorder set up, but if you're creating a brand new child account, it can't possibly already have a Config Recorder. This means that creating child accounts becomes a multi-step process where you have to explicitly exclude the new child account from Config Rules when first creating it, then create a Config Recorder in the child account, and then go back to root to re-enable the Config Rules for that account. Account-level rules do not have the chicken-and-egg problem.

The chicken-and-egg problem leads to a brittle and error-prone deployment process that makes creating new child accounts much harder, which is why the account-baseline-root module uses account-level rules instead.

What resources does this module create?

This module creates the following AWS Config Managed Rules:

Day-to-day operations

How do I configure the rules?

By default, the module will enable all rules defined in What resources does this module create section, but you can choose to disable one or more rules using the enable_* input variables and configure the attributes for certain rules.

Some of the rules have additional attributes. The module has default values for those, but you can adjust the values with the input parameters defined in variables.tf. The following snippet is an example of adjusting attributes for password policy and disabling one of the default rules:

module "organizations_config_rules" {
  source = "../../modules/aws-config-rules"

  # Custom password policy configuration   
  iam_password_policy_minimum_password_length = 20
  iam_password_policy_require_symbols         = false

  # Turn off insecure security group rule   
  enable_insecure_sg_rules = false
}

How do I add additional rules?

In addition to the predefined set of rules, you can add additional rules. The following snippet is an example of configuring ACM Certificate expriration check with a custom input parameter:

module "organizations_config_rules" {
  source = "../../modules/aws-config-rules"

  # Configure additional managed rules   
  additional_rules = {
    acm-certificate-expiration-check = {
      description      = "Checks whether ACM Certificates in your account are marked for expiration within the specified number of days.",
      identifier       = "ACM_CERTIFICATE_EXPIRATION_CHECK",
      trigger_type     = "PERIODIC"
      input_parameters = { "daysToExpiration": "14"},
    }
  }
}

For a full list of available managed rules and their configuration, see https://docs.aws.amazon.com/config/latest/developerguide/managed-rules-by-aws-config.html

How do I exclude specific accounts?

By default, organization-level config rules trickle down to all Organization accounts. You can, however, optionally exclude specific accounts using the excluded_accounts input variable (this variable is not used with account-level config rules). Note that you cannot exclude all accounts in your Organization. If you do that, the AWS API will error with: AllAccountsExcluded: For this OrganizationConfigResource, all member accounts in this organization are part of an exclusion list. Modify your exclusion list and try again..

Questions? Ask away.

We're here to talk about our services, answer any questions, give advice, or just to chat.

Ready to hand off the Gruntwork?