Skip to content

Commit f9fcbb4

Browse files
committed
eli-383 adding in a wait of 10s to allow IAMS to propagate
1 parent 0c9414a commit f9fcbb4

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

infrastructure/stacks/api-layer/csoc_log_forwarding.tf

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,17 @@ resource "aws_iam_role_policy_attachment" "cwl_to_csoc_destination" {
8080
policy_arn = aws_iam_policy.cwl_to_csoc_destination.arn
8181
}
8282

83+
# Wait for IAM role to propagate across AWS
84+
# This prevents "Make sure you have given CloudWatch Logs permission to assume the provided role" errors
85+
resource "time_sleep" "wait_for_iam_propagation" {
86+
depends_on = [
87+
aws_iam_role.cwl_subscription_role,
88+
aws_iam_role_policy_attachment.cwl_to_csoc_destination
89+
]
90+
91+
create_duration = "10s"
92+
}
93+
8394
# Create the subscription filter to forward logs to CSOC
8495
# This forwards all logs from the existing API Gateway log group to the CSOC destination
8596
# Note: A log group can have up to 2 subscription filters
@@ -93,6 +104,6 @@ resource "aws_cloudwatch_log_subscription_filter" "csoc_forwarding" {
93104
depends_on = [
94105
module.eligibility_signposting_api_gateway,
95106
aws_iam_role.cwl_subscription_role,
96-
aws_iam_role_policy_attachment.cwl_to_csoc_destination
107+
time_sleep.wait_for_iam_propagation
97108
]
98109
}

0 commit comments

Comments
 (0)