File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
infrastructure/stacks/api-layer Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments