Skip to content

armgit / floci

Public Imported from GitHub
0

Light, fluffy, and always free - The AWS Local Emulator alternative

feat(iam): seed the managed policies CDK bootstrap and the scenario stacks attach (#2064)

lex0043aea0983d53
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 <arn> 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());