# config

Deploys AWS Config with an organization aggregator, delivery channel, managed rules, and conformance packs.

Creates a Config recorder and delivery channel backed by a central S3 bucket, configures an organization-wide aggregator, and provisions a default set of managed rules covering root MFA, password policy, CloudTrail, S3 public access, EBS encryption, and GuardDuty. Additional managed rules and conformance packs are configurable via variables. Requires the `storage/s3-bucket` module for the delivery bucket and the `governance/organization` module to have trusted-access for `config.amazonaws.com` enabled.

## Usage

```hcl
module "config" {
  source  = "hcassc.jfrog.io/iac-terraform-modules-virtual/governance/config/aws"
  version = "0.1.0"

  s3_bucket_name = module.config_bucket.id
}
```

<!-- BEGIN_TF_DOCS — DO NOT EDIT BELOW THIS LINE -->
## Requirements

| Name | Version |
| ---- | ------- |
| <a name="requirement_terraform"></a> [terraform](#requirement_terraform) | ~> 1.5 |
| <a name="requirement_aws"></a> [aws](#requirement_aws) | ~> 6.50 |

## Providers

| Name | Version |
| ---- | ------- |
| <a name="provider_aws"></a> [aws](#provider_aws) | 6.50.0 |

## Resources

| Name | Type |
| ---- | ---- |
| [aws_config_config_rule.managed](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/config_config_rule) | resource |
| [aws_config_configuration_aggregator.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/config_configuration_aggregator) | resource |
| [aws_config_configuration_recorder.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/config_configuration_recorder) | resource |
| [aws_config_configuration_recorder_status.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/config_configuration_recorder_status) | resource |
| [aws_config_conformance_pack.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/config_conformance_pack) | resource |
| [aws_config_delivery_channel.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/config_delivery_channel) | resource |
| [aws_iam_role.config](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
| [aws_iam_role_policy_attachment.config_managed](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |

## Inputs

| Name | Description | Type | Default | Required |
| ---- | ----------- | ---- | ------- | :------: |
| <a name="input_s3_bucket_name"></a> [s3_bucket_name](#input_s3_bucket_name) | S3 bucket name for AWS Config delivery | `string` | n/a | yes |
| <a name="input_aggregator_name"></a> [aggregator_name](#input_aggregator_name) | Name for the organization Config aggregator | `string` | `"org-aggregator"` | no |
| <a name="input_all_supported"></a> [all_supported](#input_all_supported) | Record all supported resource types | `bool` | `true` | no |
| <a name="input_conformance_packs"></a> [conformance_packs](#input_conformance_packs) | Map of conformance pack names to S3 template URI or inline template body | <pre>map(object({<br/>    template_body    = optional(string, null)<br/>    template_s3_uri  = optional(string, null)<br/>    input_parameters = optional(map(string), {})<br/>  }))</pre> | `{}` | no |
| <a name="input_delivery_frequency"></a> [delivery_frequency](#input_delivery_frequency) | Frequency for Config configuration snapshots | `string` | `"TwentyFour_Hours"` | no |
| <a name="input_include_global_resource_types"></a> [include_global_resource_types](#input_include_global_resource_types) | Include global resource types (IAM) in recording | `bool` | `true` | no |
| <a name="input_managed_rules"></a> [managed_rules](#input_managed_rules) | Map of managed Config rules to deploy | <pre>map(object({<br/>    source_identifier           = string<br/>    description                 = string<br/>    input_parameters            = optional(map(string), {})<br/>    maximum_execution_frequency = optional(string, null)<br/>  }))</pre> | <pre>{<br/>  "cloudtrail_enabled": {<br/>    "description": "Ensure CloudTrail is enabled",<br/>    "source_identifier": "CLOUD_TRAIL_ENABLED"<br/>  },<br/>  "ebs_encryption": {<br/>    "description": "Ensure EBS encryption by default is enabled",<br/>    "source_identifier": "EC2_EBS_ENCRYPTION_BY_DEFAULT"<br/>  },<br/>  "guardduty_enabled": {<br/>    "description": "Ensure GuardDuty is enabled",<br/>    "source_identifier": "GUARDDUTY_ENABLED_CENTRALIZED"<br/>  },<br/>  "iam_password_policy": {<br/>    "description": "Ensure IAM password policy meets minimum requirements",<br/>    "input_parameters": {<br/>      "MaxPasswordAge": "90",<br/>      "MinimumPasswordLength": "14",<br/>      "PasswordReusePrevention": "24",<br/>      "RequireLowercaseCharacters": "true",<br/>      "RequireNumbers": "true",<br/>      "RequireSymbols": "true",<br/>      "RequireUppercaseCharacters": "true"<br/>    },<br/>    "source_identifier": "IAM_PASSWORD_POLICY"<br/>  },<br/>  "root_mfa_enabled": {<br/>    "description": "Ensure MFA is enabled for the root account",<br/>    "source_identifier": "ROOT_ACCOUNT_MFA_ENABLED"<br/>  },<br/>  "s3_bucket_public_access": {<br/>    "description": "Ensure S3 account-level public access blocks are enabled",<br/>    "source_identifier": "S3_ACCOUNT_LEVEL_PUBLIC_ACCESS_BLOCKS"<br/>  }<br/>}</pre> | no |
| <a name="input_recorder_name"></a> [recorder_name](#input_recorder_name) | Name for the AWS Config recorder | `string` | `"org-recorder"` | no |
| <a name="input_s3_key_prefix"></a> [s3_key_prefix](#input_s3_key_prefix) | S3 key prefix for Config snapshots and history | `string` | `"config"` | no |
| <a name="input_sns_topic_arn"></a> [sns_topic_arn](#input_sns_topic_arn) | SNS topic ARN for Config change notifications (optional) | `string` | `null` | no |
| <a name="input_tags"></a> [tags](#input_tags) | Resource tags to apply to all resources | `map(string)` | `{}` | no |

## Outputs

| Name | Description |
| ---- | ----------- |
| <a name="output_aggregator_arn"></a> [aggregator_arn](#output_aggregator_arn) | Config aggregator ARN |
| <a name="output_aggregator_id"></a> [aggregator_id](#output_aggregator_id) | Config aggregator name |
| <a name="output_managed_rule_arns"></a> [managed_rule_arns](#output_managed_rule_arns) | Map of managed rule logical key to rule ARN |
| <a name="output_recorder_id"></a> [recorder_id](#output_recorder_id) | AWS Config recorder name |
| <a name="output_role_arn"></a> [role_arn](#output_role_arn) | IAM role ARN used by Config |
<!-- END_TF_DOCS — DO NOT EDIT ABOVE THIS LINE -->
