Skip to content

Commit 1dbe50f

Browse files
authored
Managed rules for AWS Config (#690)
1 parent f7a75ef commit 1dbe50f

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

modules/aws-config/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ components:
8080
parameter_overrides:
8181
...
8282
(etc)
83+
managed_rules:
84+
access-keys-rotated:
85+
identifier: ACCESS_KEYS_ROTATED
86+
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."
87+
input_parameters:
88+
maxAccessKeyAge: "30"
89+
enabled: true
90+
tags: {}
8391
```
8492
8593
## Deployment
@@ -171,6 +179,7 @@ atmos terraform plan aws-config-{each region} --stack {each region}-{each stage}
171179
| <a name="input_label_order"></a> [label\_order](#input\_label\_order) | The order in which the labels (ID elements) appear in the `id`.<br>Defaults to ["namespace", "environment", "stage", "name", "attributes"].<br>You can omit any of the 6 labels ("tenant" is the 6th), but at least one must be present. | `list(string)` | `null` | no |
172180
| <a name="input_label_value_case"></a> [label\_value\_case](#input\_label\_value\_case) | Controls the letter case of ID elements (labels) as included in `id`,<br>set as tag values, and output by this module individually.<br>Does not affect values of tags passed in via the `tags` input.<br>Possible values: `lower`, `title`, `upper` and `none` (no transformation).<br>Set this to `title` and set `delimiter` to `""` to yield Pascal Case IDs.<br>Default value: `lower`. | `string` | `null` | no |
173181
| <a name="input_labels_as_tags"></a> [labels\_as\_tags](#input\_labels\_as\_tags) | Set of labels (ID elements) to include as tags in the `tags` output.<br>Default is to include all labels.<br>Tags with empty values will not be included in the `tags` output.<br>Set to `[]` to suppress all generated tags.<br>**Notes:**<br> The value of the `name` tag, if included, will be the `id`, not the `name`.<br> Unlike other `null-label` inputs, the initial setting of `labels_as_tags` cannot be<br> changed in later chained modules. Attempts to change it will be silently ignored. | `set(string)` | <pre>[<br> "default"<br>]</pre> | no |
182+
| <a name="input_managed_rules"></a> [managed\_rules](#input\_managed\_rules) | A list of AWS Managed Rules that should be enabled on the account.<br><br>See the following for a list of possible rules to enable:<br>https://docs.aws.amazon.com/config/latest/developerguide/managed-rules-by-aws-config.html<br><br>Example:<pre>managed_rules = {<br> access-keys-rotated = {<br> identifier = "ACCESS_KEYS_ROTATED"<br> 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."<br> input_parameters = {<br> maxAccessKeyAge : "90"<br> }<br> enabled = true<br> tags = {}<br> }<br>}</pre> | <pre>map(object({<br> description = string<br> identifier = string<br> input_parameters = any<br> tags = map(string)<br> enabled = bool<br> }))</pre> | `{}` | no |
174183
| <a name="input_name"></a> [name](#input\_name) | ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.<br>This is the only ID element not also included as a `tag`.<br>The "name" tag is set to the full `id` string. There is no tag with the value of the `name` input. | `string` | `null` | no |
175184
| <a name="input_namespace"></a> [namespace](#input\_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 |
176185
| <a name="input_privileged"></a> [privileged](#input\_privileged) | True if the default provider already has access to the backend | `bool` | `false` | no |

modules/aws-config/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ module "aws_config" {
6565
s3_bucket_arn = local.s3_bucket.config_bucket_arn
6666
create_iam_role = local.create_iam_role
6767
iam_role_arn = local.config_iam_role_arn
68+
managed_rules = var.managed_rules
6869
create_sns_topic = true
6970

7071
global_resource_collector_region = var.global_resource_collector_region

modules/aws-config/variables.tf

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,35 @@ variable "iam_roles_environment_name" {
123123
description = "The name of the environment where the IAM roles are provisioned"
124124
default = "gbl"
125125
}
126+
127+
variable "managed_rules" {
128+
description = <<-DOC
129+
A list of AWS Managed Rules that should be enabled on the account.
130+
131+
See the following for a list of possible rules to enable:
132+
https://docs.aws.amazon.com/config/latest/developerguide/managed-rules-by-aws-config.html
133+
134+
Example:
135+
```
136+
managed_rules = {
137+
access-keys-rotated = {
138+
identifier = "ACCESS_KEYS_ROTATED"
139+
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."
140+
input_parameters = {
141+
maxAccessKeyAge : "90"
142+
}
143+
enabled = true
144+
tags = {}
145+
}
146+
}
147+
```
148+
DOC
149+
type = map(object({
150+
description = string
151+
identifier = string
152+
input_parameters = any
153+
tags = map(string)
154+
enabled = bool
155+
}))
156+
default = {}
157+
}

0 commit comments

Comments
 (0)