fix(iam): seed AmazonAPIGatewayPushToCloudWatchLogs managed policy (#2147)

* fix(iam): seed AmazonAPIGatewayPushToCloudWatchLogs managed policy

Floci seeded 52 AWS-managed policies at boot but none matched
API Gateway, so AttachRolePolicy for this standard service-role
policy returned NoSuchEntity. It's the policy attached to the API
Gateway CloudWatch-logs role that aws_api_gateway_account depends
on, so this blocked the first apply of any Terraform config that
enables API Gateway access logging.

Fixes #2121

* test(iam): add regression test for AmazonAPIGatewayPushToCloudWatchLogs seeding

Reproduces #2121: GetPolicy for the API Gateway CloudWatch-logs
managed policy returned 404 NoSuchEntity before the fix.
This commit is contained in:
Feyikemi Ogunsanya authored and GitHub committed 2026-08-07 17:20:39 -05:00
1 parent 76b264f667
commit b1f953efb1
2 files changed
+23

No files matched your search

@@ -127,6 +127,10 @@ final class AwsManagedPolicies {
new ManagedPolicyDef("CloudWatchLambdaApplicationSignalsExecutionRolePolicy", "/",
"Provides write access to X-Ray and CloudWatch Application Signals log group."),
// API Gateway execution role policy
new ManagedPolicyDef("AmazonAPIGatewayPushToCloudWatchLogs", "/service-role/",
"Allows API Gateway to push logs to CloudWatch Logs."),
// Config execution role policy
new ManagedPolicyDef("AWSConfigRulesExecutionRole", "/service-role/",
"Allows AWS Config Rules Lambda functions to call AWS services and read the configuration of AWS resources."),