mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
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:
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."),
|
||||
|
||||
@@ -254,6 +254,25 @@ class IamIntegrationTest {
|
||||
equalTo("arn:aws:iam::aws:policy/service-role/AmazonRDSEnhancedMonitoringRole"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(18)
|
||||
void getApiGatewayPushToCloudWatchLogsPolicy() {
|
||||
given()
|
||||
.formParam("Action", "GetPolicy")
|
||||
.formParam("PolicyArn",
|
||||
"arn:aws:iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs")
|
||||
.header("Authorization",
|
||||
"AWS4-HMAC-SHA256 Credential=test/20260227/us-east-1/iam/aws4_request")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body("GetPolicyResponse.GetPolicyResult.Policy.PolicyName",
|
||||
equalTo("AmazonAPIGatewayPushToCloudWatchLogs"))
|
||||
.body("GetPolicyResponse.GetPolicyResult.Policy.Arn",
|
||||
equalTo("arn:aws:iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(9)
|
||||
void stsGetCallerIdentityFallsBackForUnseededFlociAccessKey() {
|
||||
|
||||
Reference in new issue
Block a user