From 4b15e0193d33cfb013c1d60575a41ec90ca88e31 Mon Sep 17 00:00:00 2001 From: Erik Parawell Date: Thu, 24 Oct 2024 16:07:59 -0700 Subject: [PATCH 1/4] Added new resources per datadog docs --- iam_policy_all.tf | 113 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 87 insertions(+), 26 deletions(-) diff --git a/iam_policy_all.tf b/iam_policy_all.tf index aa5e473..0807f52 100644 --- a/iam_policy_all.tf +++ b/iam_policy_all.tf @@ -1,5 +1,6 @@ # https://docs.datadoghq.com/integrations/amazon_web_services/?tab=roledelegation#datadog-aws-iam-policy +# AWS Integration IAM Policy data "aws_iam_policy_document" "all" { count = local.enabled ? 1 : 0 @@ -20,11 +21,11 @@ data "aws_iam_policy_document" "all" { "cloudwatch:Describe*", "cloudwatch:Get*", "cloudwatch:List*", - "codedeploy:List*", "codedeploy:BatchGet*", + "codedeploy:List*", "directconnect:Describe*", - "dynamodb:List*", "dynamodb:Describe*", + "dynamodb:List*", "ec2:Describe*", "ec2:GetTransitGatewayPrefixListReferences", "ec2:SearchTransitGatewayRoutes", @@ -32,27 +33,23 @@ data "aws_iam_policy_document" "all" { "ecs:List*", "elasticache:Describe*", "elasticache:List*", + "elasticfilesystem:DescribeAccessPoints", "elasticfilesystem:DescribeFileSystems", "elasticfilesystem:DescribeTags", - "elasticfilesystem:DescribeAccessPoints", "elasticloadbalancing:Describe*", - "elasticmapreduce:List*", "elasticmapreduce:Describe*", - "es:ListTags", - "es:ListDomainNames", + "elasticmapreduce:List*", "es:DescribeElasticsearchDomains", + "es:ListDomainNames", + "es:ListTags", "events:CreateEventBus", "fsx:DescribeFileSystems", "fsx:ListTagsForResource", - "health:DescribeEvents", - "health:DescribeEventDetails", "health:DescribeAffectedEntities", - "iam:GetAccountPasswordPolicy", - "iam:GetLoginProfile", - "iam:ListAttachedRolePolicies", - "kinesis:List*", + "health:DescribeEventDetails", + "health:DescribeEvents", "kinesis:Describe*", - "kms:GetKeyRotationStatus", + "kinesis:List*", "lambda:GetPolicy", "lambda:List*", "logs:DeleteSubscriptionFilter", @@ -62,6 +59,8 @@ data "aws_iam_policy_document" "all" { "logs:FilterLogEvents", "logs:PutSubscriptionFilter", "logs:TestMetricFilter", + "oam:ListAttachedLinks", + "oam:ListSinks", "organizations:Describe*", "organizations:List*", "rds:Describe*", @@ -69,30 +68,26 @@ data "aws_iam_policy_document" "all" { "redshift:DescribeClusters", "redshift:DescribeLoggingStatus", "route53:List*", - "s3:GetAccountPublicAccessBlock", - "s3:GetBucketAcl", - "s3:GetBucketEncryption", - "s3:GetBucketLogging", "s3:GetBucketLocation", + "s3:GetBucketLogging", "s3:GetBucketNotification", - "s3:GetBucketPolicyStatus", "s3:GetBucketTagging", - "s3:GetBucketWebsite", - "s3:GetBucketVersioning", "s3:ListAllMyBuckets", "s3:PutBucketNotification", "ses:Get*", - "sns:GetTopicAttributes", + "sns:GetSubscriptionAttributes", "sns:List*", "sns:Publish", "sqs:ListQueues", - "states:ListStateMachines", "states:DescribeStateMachine", + "states:ListStateMachines", "support:DescribeTrustedAdvisor*", "support:RefreshTrustedAdvisorCheck", "tag:GetResources", "tag:GetTagKeys", "tag:GetTagValues", + "wafv2:GetLoggingConfiguration", + "wafv2:ListLoggingConfigurations", "xray:BatchGetTraces", "xray:GetTraceSummaries" ] @@ -111,18 +106,84 @@ module "all_label" { } locals { - all_count = local.enabled && contains(split(",", lower(join(",", var.integrations))), "all") ? 1 : 0 + enabled = var.enabled + integrations = split(",", lower(join(",", var.integrations))) + all_count = local.enabled && contains(local.integrations, "all") ? 1 : 0 + resource_collection_count = local.enabled && contains(local.integrations, "resource_collection") ? 1 : 0 } resource "aws_iam_policy" "all" { count = local.all_count name = module.all_label.id - policy = join("", data.aws_iam_policy_document.all.*.json) + policy = data.aws_iam_policy_document.all[0].json tags = module.all_label.tags } resource "aws_iam_role_policy_attachment" "all" { count = local.all_count - role = join("", aws_iam_role.default.*.name) - policy_arn = join("", aws_iam_policy.all.*.arn) + role = aws_iam_role.default[0].name + policy_arn = aws_iam_policy.all[0].arn +} + +# AWS Resource Collection IAM Policy +data "aws_iam_policy_document" "resource_collection" { + count = local.enabled ? 1 : 0 + + statement { + sid = "DatadogResourceCollection" + effect = "Allow" + + actions = [ + "backup:ListRecoveryPointsByBackupVault", + "bcm-data-exports:GetExport", + "bcm-data-exports:ListExports", + "cassandra:Select", + "cur:DescribeReportDefinitions", + "ec2:GetSnapshotBlockPublicAccessState", + "glacier:GetVaultNotifications", + "glue:ListRegistries", + "lightsail:GetInstancePortStates", + "savingsplans:DescribeSavingsPlanRates", + "savingsplans:DescribeSavingsPlans", + "timestream:DescribeEndpoints", + "waf-regional:ListRuleGroups", + "waf-regional:ListRules", + "waf:ListRuleGroups", + "waf:ListRules", + "wafv2:GetIPSet", + "wafv2:GetRegexPatternSet", + "wafv2:GetRuleGroup" + ] + + resources = ["*"] + } +} + +module "resource_collection_label" { + source = "cloudposse/label/null" + version = "0.25.0" + + attributes = compact(concat(module.this.attributes, ["resource_collection"])) + + context = module.this.context +} + +resource "aws_iam_policy" "resource_collection" { + count = local.resource_collection_count + name = module.resource_collection_label.id + policy = data.aws_iam_policy_document.resource_collection[0].json + tags = module.resource_collection_label.tags +} + +resource "aws_iam_role_policy_attachment" "resource_collection" { + count = local.resource_collection_count + role = aws_iam_role.default[0].name + policy_arn = aws_iam_policy.resource_collection[0].arn +} + +# Attach AWS Managed SecurityAudit Policy for Resource Collection +resource "aws_iam_role_policy_attachment" "security_audit" { + count = local.resource_collection_count + role = aws_iam_role.default[0].name + policy_arn = "arn:aws:iam::aws:policy/SecurityAudit" } From 2442253fdd6742098785b4b77dbddf62bcc5d1aa Mon Sep 17 00:00:00 2001 From: Erik Parawell Date: Thu, 24 Oct 2024 16:16:46 -0700 Subject: [PATCH 2/4] Update README --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 3fbb4b7..be6cc14 100644 --- a/README.md +++ b/README.md @@ -135,6 +135,7 @@ Available targets: |------|--------|---------| | [all\_label](#module\_all\_label) | cloudposse/label/null | 0.25.0 | | [core\_label](#module\_core\_label) | cloudposse/label/null | 0.25.0 | +| [resource\_collection\_label](#module\_resource\_collection\_label) | cloudposse/label/null | 0.25.0 | | [this](#module\_this) | cloudposse/label/null | 0.25.0 | ## Resources @@ -143,15 +144,18 @@ Available targets: |------|------| | [aws_iam_policy.all](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource | | [aws_iam_policy.core](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource | +| [aws_iam_policy.resource_collection](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource | | [aws_iam_role.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource | | [aws_iam_role_policy_attachment.all](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource | | [aws_iam_role_policy_attachment.core](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource | +| [aws_iam_role_policy_attachment.resource_collection](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource | | [aws_iam_role_policy_attachment.security_audit](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource | | [datadog_integration_aws.integration](https://registry.terraform.io/providers/datadog/datadog/latest/docs/resources/integration_aws) | resource | | [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | | [aws_iam_policy_document.all](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | | [aws_iam_policy_document.assume_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | | [aws_iam_policy_document.core](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | +| [aws_iam_policy_document.resource_collection](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | | [aws_partition.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/partition) | data source | ## Inputs From 3d9e1b1e37c0aebec7267decfd6df41fbed64211 Mon Sep 17 00:00:00 2001 From: Erik Parawell Date: Thu, 24 Oct 2024 16:41:46 -0700 Subject: [PATCH 3/4] Cleanup --- iam_policy_all.tf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/iam_policy_all.tf b/iam_policy_all.tf index 0807f52..428cbad 100644 --- a/iam_policy_all.tf +++ b/iam_policy_all.tf @@ -115,14 +115,14 @@ locals { resource "aws_iam_policy" "all" { count = local.all_count name = module.all_label.id - policy = data.aws_iam_policy_document.all[0].json + policy = join("", data.aws_iam_policy_document.all.*.json) tags = module.all_label.tags } resource "aws_iam_role_policy_attachment" "all" { count = local.all_count - role = aws_iam_role.default[0].name - policy_arn = aws_iam_policy.all[0].arn + role = join("", aws_iam_role.default.*.name) + policy_arn = join("", aws_iam_policy.all.*.arn) } # AWS Resource Collection IAM Policy From b3f359c4a35671c547c9b9b399a8bc2a3962702b Mon Sep 17 00:00:00 2001 From: Erik Parawell Date: Fri, 25 Oct 2024 14:28:00 -0700 Subject: [PATCH 4/4] cleanup --- docs/terraform.md | 30 +++++++++++++++++------------- iam_policy_all.tf | 8 -------- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/docs/terraform.md b/docs/terraform.md index 6c876bc..06e7836 100644 --- a/docs/terraform.md +++ b/docs/terraform.md @@ -20,6 +20,7 @@ |------|--------|---------| | [all\_label](#module\_all\_label) | cloudposse/label/null | 0.25.0 | | [core\_label](#module\_core\_label) | cloudposse/label/null | 0.25.0 | +| [resource\_collection\_label](#module\_resource\_collection\_label) | cloudposse/label/null | 0.25.0 | | [this](#module\_this) | cloudposse/label/null | 0.25.0 | ## Resources @@ -28,15 +29,18 @@ |------|------| | [aws_iam_policy.all](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource | | [aws_iam_policy.core](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource | +| [aws_iam_policy.resource_collection](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource | | [aws_iam_role.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource | | [aws_iam_role_policy_attachment.all](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource | | [aws_iam_role_policy_attachment.core](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource | +| [aws_iam_role_policy_attachment.resource_collection](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource | | [aws_iam_role_policy_attachment.security_audit](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource | | [datadog_integration_aws.integration](https://registry.terraform.io/providers/datadog/datadog/latest/docs/resources/integration_aws) | resource | | [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | | [aws_iam_policy_document.all](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | | [aws_iam_policy_document.assume_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | | [aws_iam_policy_document.core](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | +| [aws_iam_policy_document.resource_collection](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | | [aws_partition.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/partition) | data source | ## Inputs @@ -44,32 +48,32 @@ | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | [account\_specific\_namespace\_rules](#input\_account\_specific\_namespace\_rules) | An object, (in the form {"namespace1":true/false, "namespace2":true/false} ), that enables or disables metric collection for specific AWS namespaces for this AWS account only | `map(string)` | `null` | no | -| [additional\_tag\_map](#input\_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](#input\_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 | -| [context](#input\_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 | +| [additional\_tag\_map](#input\_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](#input\_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 | +| [context](#input\_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 | | [cspm\_resource\_collection\_enabled](#input\_cspm\_resource\_collection\_enabled) | Whether Datadog collects cloud security posture management resources from your AWS account. | `bool` | `null` | no | | [datadog\_aws\_account\_id](#input\_datadog\_aws\_account\_id) | The AWS account ID Datadog's integration servers use for all integrations | `string` | `"464622532012"` | no | -| [delimiter](#input\_delimiter) | Delimiter to be used between ID elements.
Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no | -| [descriptor\_formats](#input\_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
`{
format = string
labels = list(string)
}`
(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 | +| [delimiter](#input\_delimiter) | Delimiter to be used between ID elements.
Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no | +| [descriptor\_formats](#input\_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
`{
format = string
labels = list(string)
}`
(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](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no | | [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no | | [excluded\_regions](#input\_excluded\_regions) | An array of AWS regions to exclude from metrics collection | `list(string)` | `null` | no | | [filter\_tags](#input\_filter\_tags) | An array of EC2 tags (in the form `key:value`) that defines a filter that Datadog use when collecting metrics from EC2. Wildcards, such as ? (for single characters) and * (for multiple characters) can also be used | `list(string)` | `null` | no | | [host\_tags](#input\_host\_tags) | An array of tags (in the form `key:value`) to add to all hosts and metrics reporting through this integration | `list(string)` | `null` | no | -| [id\_length\_limit](#input\_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 | +| [id\_length\_limit](#input\_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 | | [integrations](#input\_integrations) | List of AWS permission names to apply for different integrations (e.g. 'all', 'core') | `list(string)` | n/a | yes | -| [label\_key\_case](#input\_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](#input\_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](#input\_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](#input\_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 | +| [label\_key\_case](#input\_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](#input\_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](#input\_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](#input\_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 | | [metrics\_collection\_enabled](#input\_metrics\_collection\_enabled) | Whether Datadog collects metrics for this AWS account. | `bool` | `null` | no | -| [name](#input\_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 | +| [name](#input\_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](#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 | -| [regex\_replace\_chars](#input\_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 | +| [regex\_replace\_chars](#input\_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 | | [resource\_collection\_enabled](#input\_resource\_collection\_enabled) | Whether Datadog collects a standard set of resources from your AWS account. | `bool` | `null` | no | | [security\_audit\_policy\_enabled](#input\_security\_audit\_policy\_enabled) | Enable/disable attaching the AWS managed `SecurityAudit` policy to the Datadog IAM role to collect information about how AWS resources are configured (used in Datadog Cloud Security Posture Management to read security configuration metadata). If var.cspm\_resource\_collection\_enabled, this is enabled automatically. | `bool` | `false` | no | | [stage](#input\_stage) | ID element. Usually used to indicate role, e.g. 'prod', 'staging', 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no | -| [tags](#input\_tags) | Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).
Neither the tag keys nor the tag values will be modified by this module. | `map(string)` | `{}` | no | +| [tags](#input\_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](#input\_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 diff --git a/iam_policy_all.tf b/iam_policy_all.tf index 428cbad..5d48876 100644 --- a/iam_policy_all.tf +++ b/iam_policy_all.tf @@ -106,7 +106,6 @@ module "all_label" { } locals { - enabled = var.enabled integrations = split(",", lower(join(",", var.integrations))) all_count = local.enabled && contains(local.integrations, "all") ? 1 : 0 resource_collection_count = local.enabled && contains(local.integrations, "resource_collection") ? 1 : 0 @@ -180,10 +179,3 @@ resource "aws_iam_role_policy_attachment" "resource_collection" { role = aws_iam_role.default[0].name policy_arn = aws_iam_policy.resource_collection[0].arn } - -# Attach AWS Managed SecurityAudit Policy for Resource Collection -resource "aws_iam_role_policy_attachment" "security_audit" { - count = local.resource_collection_count - role = aws_iam_role.default[0].name - policy_arn = "arn:aws:iam::aws:policy/SecurityAudit" -}