Skip to content

Commit 506e3ac

Browse files
committed
Fix null partition error when create = false.
1 parent 263410b commit 506e3ac

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

aws_cloudwatch_observability.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
################################################################################
44

55
resource "aws_iam_role_policy_attachment" "aws_cloudwatch_observability" {
6-
for_each = { for k, v in {
6+
for_each = var.create && var.attach_aws_cloudwatch_observability_policy ? {
77
CloudWatchAgentServerPolicy = "arn:${local.partition}:iam::aws:policy/CloudWatchAgentServerPolicy"
88
AWSXrayWriteOnlyAccess = "arn:${local.partition}:iam::aws:policy/AWSXrayWriteOnlyAccess"
9-
} : k => v if var.create && var.attach_aws_cloudwatch_observability_policy }
9+
} : {}
1010

1111
role = aws_iam_role.this[0].name
1212
policy_arn = each.value

0 commit comments

Comments
 (0)