diff --git a/iam-general-policies/README.md b/iam-general-policies/README.md index 20b98d7..b5b9670 100644 --- a/iam-general-policies/README.md +++ b/iam-general-policies/README.md @@ -140,6 +140,7 @@ No modules. | [ipr\_vpc\_cidr\_blocks](#input\_ipr\_vpc\_cidr\_blocks) | VPC CIDR blocks for IP based API restrictions (default: none) | `list(string)` | `[]` | no | | [ipr\_vpc\_endpoints](#input\_ipr\_vpc\_endpoints) | VPC Endpoints to permit for IP based API restrictions (default: S3 interface endpoints in do2-govloud) | `list(string)` |
[| no | | [override\_prefixes](#input\_override\_prefixes) | Override built-in prefixes by component (efs, s3, ebs, kms, role, policy, security-group). This should be used primarily for common infrastructure things | `map(string)` | `{}` | no | +| [regions](#input\_regions) | List of regions for which multiple regions are used in creating region-based policies | `list(string)` | `[]` | no | | [tags](#input\_tags) | AWS Tags to apply to appropriate resources (S3, KMS). Do not include safeguard tags here, use the data\_safeguard field for such things. | `map(string)` | `{}` | no | ## Outputs diff --git a/iam-general-policies/policy.cloudforms.tf b/iam-general-policies/policy.cloudforms.tf index c587fdd..49e3e28 100644 --- a/iam-general-policies/policy.cloudforms.tf +++ b/iam-general-policies/policy.cloudforms.tf @@ -1,3 +1,7 @@ +locals { + regions = length(var.regions) == 0 ? ["*"] : var.regions + +} data "aws_iam_policy_document" "cloudforms" { # from AmazonEC2FullAccess statement { @@ -98,7 +102,7 @@ data "aws_iam_policy_document" "cloudforms" { statement { sid = "AWSManageCloudformsSQS" effect = "Allow" - resources = [for r in values(var.region_map) : format("arn:%v:sqs:%v:%v:manageiq-awsconfig-queue-*", data.aws_arn.current.partition, r, var.account_id)] + resources = [for r in values(var.regions) : format("arn:%v:sqs:%v:%v:manageiq-awsconfig-queue-*", data.aws_arn.current.partition, r, var.account_id)] actions = ["sqs:*"] } @@ -106,7 +110,7 @@ data "aws_iam_policy_document" "cloudforms" { statement { sid = "AWSCloudformsSNS" effect = "Allow" - resources = [for r in values(var.region_map) : format("arn:%v:sns:%v:%v:AWSConfig_topic", data.aws_arn.current.partition, r, var.account_id)] + resources = [for r in values(var.regions) : format("arn:%v:sns:%v:%v:AWSConfig_topic", data.aws_arn.current.partition, r, var.account_id)] actions = ["sns:*"] } diff --git a/iam-general-policies/variables.tf b/iam-general-policies/variables.tf index ef07820..6fefebb 100644 --- a/iam-general-policies/variables.tf +++ b/iam-general-policies/variables.tf @@ -51,3 +51,9 @@ variable "ipr_vpc_endpoints" { type = list(string) default = ["vpce-047c17aeb6c23cab8", "vpce-0bc724bf64e6aeb64"] } + +variable "regions" { + description = "List of regions for which multiple regions are used in creating region-based policies" + type = list(string) + default = [] +}
"vpce-047c17aeb6c23cab8",
"vpce-0bc724bf64e6aeb64"
]