From 43aea0983d53c41eff4ed4307663b8ab1424c567 Mon Sep 17 00:00:00 2001 From: lex00 <121451605+lex00@users.noreply.github.com> Date: Tue, 4 Aug 2026 20:37:20 -0600 Subject: [PATCH] feat(iam): seed the managed policies CDK bootstrap and the scenario stacks attach (#2064) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(iam): seed the managed policies CDK bootstrap and the scenario stacks attach Four AWS-managed policies were missing from the catalog, and each surfaced the same way: "Policy arn:aws:iam::aws:policy/ does not exist" reported on the role that consumed it, rolling the whole stack back several resources from the cause. - AWSCloudFormationReadOnlyAccess — attached by the roles `cdk bootstrap` creates, so CDKToolkit rolled back and no CDK application could deploy at all. - AmazonAthenaFullAccess, AmazonRedshiftFullAccess, AmazonS3TablesReadOnlyAccess — attached by the QA roles the aws-bench ec2-multiregion scenario deploys. Supersedes #2059, which carried only the first of the four. * fix(iam): drop the AWSCloudFormationReadOnlyAccess duplicate landed by #2057 * fix(iam): match the AWS-published descriptions for two seeded policies Both verified with iam:GetPolicy against real AWS. AWSCloudFormationReadOnlyAccess was seeded by #2057 as "Provides read only access to Cloud Control and CloudFormation."; AWS returns "Provides access to AWS CloudFormation via the AWS Management Console." AmazonS3TablesReadOnlyAccess said "Provides read-only access to Amazon S3 Tables."; AWS returns "Provides read only access to all S3 table buckets." --- .../floci/services/iam/AwsManagedPolicies.java | 11 ++++++++++- .../hectorvent/floci/services/iam/IamServiceTest.java | 11 +++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/hectorvent/floci/services/iam/AwsManagedPolicies.java b/src/main/java/io/github/hectorvent/floci/services/iam/AwsManagedPolicies.java index 284a784582..c6a0f91343 100644 --- a/src/main/java/io/github/hectorvent/floci/services/iam/AwsManagedPolicies.java +++ b/src/main/java/io/github/hectorvent/floci/services/iam/AwsManagedPolicies.java @@ -57,13 +57,22 @@ final class AwsManagedPolicies { new ManagedPolicyDef("AWSLambdaFullAccess", "/", "Provides full access to Lambda, S3, DynamoDB, CloudWatch Metrics and Logs."), new ManagedPolicyDef("AWSCloudFormationReadOnlyAccess", "/", - "Provides read only access to Cloud Control and CloudFormation."), + "Provides access to AWS CloudFormation via the AWS Management Console."), new ManagedPolicyDef("AWSCloudFormationFullAccess", "/", "Provides full access to AWS CloudFormation."), new ManagedPolicyDef("AWSXRayDaemonWriteAccess", "/", "Allows write permissions to the AWS X-Ray daemon."), new ManagedPolicyDef("AmazonElasticFileSystemClientFullAccess", "/", "Provides root client access to an Amazon EFS file system."), + // Attached by the roles `cdk bootstrap` creates, so without it the CDKToolkit stack + // rolls back and no CDK app can be deployed. + new ManagedPolicyDef("AmazonAthenaFullAccess", "/", + "Provide full access to Amazon Athena and scoped access to the dependencies " + + "needed to enable querying, writing results, and data management."), + new ManagedPolicyDef("AmazonRedshiftFullAccess", "/", + "Provides full access to Amazon Redshift via the AWS Management Console."), + new ManagedPolicyDef("AmazonS3TablesReadOnlyAccess", "/", + "Provides read only access to all S3 table buckets."), new ManagedPolicyDef("AWSCloudTrail_FullAccess", "/", "Provides full access to AWS CloudTrail."), new ManagedPolicyDef("AWSCloudTrail_ReadOnlyAccess", "/", diff --git a/src/test/java/io/github/hectorvent/floci/services/iam/IamServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/iam/IamServiceTest.java index 0e39790470..9f03ff0b31 100644 --- a/src/test/java/io/github/hectorvent/floci/services/iam/IamServiceTest.java +++ b/src/test/java/io/github/hectorvent/floci/services/iam/IamServiceTest.java @@ -590,6 +590,17 @@ class IamServiceTest { assertTrue(admin.getPolicyId().startsWith("ANPA")); assertEquals("v1", admin.getDefaultVersionId()); + // Referenced by the roles `cdk bootstrap` and the aws-bench scenario stacks create. + // A missing entry surfaces as "Policy does not exist" on the consuming role, + // which rolls the whole stack back. + for (String name : new String[] { + "AWSCloudFormationReadOnlyAccess", "AmazonAthenaFullAccess", + "AmazonRedshiftFullAccess", "AmazonS3TablesReadOnlyAccess" }) { + IamPolicy seeded = iamService.getPolicy("arn:aws:iam::aws:policy/" + name); + assertEquals(name, seeded.getPolicyName()); + assertEquals("/", seeded.getPath()); + } + IamPolicy lambda = iamService.getPolicy( "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"); assertEquals("AWSLambdaBasicExecutionRole", lambda.getPolicyName());