mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
feat(iam): seed Amazon Bedrock managed policies (#2034)
* feat(iam): seed Amazon Bedrock managed policies AmazonBedrockFullAccess and AmazonBedrockReadOnly were absent from the seeded AWS-managed policy catalog. CloudFormation attaches managed policies inline when creating a role, so it never noticed; Terraform (and the raw IAM API) call AttachRolePolicy, which validates the policy exists and 404'd with NoSuchEntity on these two. Seed them alongside the existing Bedrock AgentCore policy, matching the pattern used for the RDS (#1559) and EKS (#1216) additions. * fix(iam): match the AWS-published Bedrock policy descriptions
This commit is contained in:
1 parent
43aea0983d
commit
58743487a7
2 files changed
+27
-1
No files matched your search
@@ -161,7 +161,12 @@ final class AwsManagedPolicies {
|
||||
new ManagedPolicyDef("AmazonDataZoneDomainExecutionRolePolicy", "/service-role/",
|
||||
"Provides permissions for the Amazon DataZone domain execution role."),
|
||||
|
||||
// Amazon Bedrock execution role policy
|
||||
// Amazon Bedrock policies
|
||||
new ManagedPolicyDef("AmazonBedrockFullAccess", "/",
|
||||
"Provides full access to Amazon Bedrock as well as limited access to related services "
|
||||
+ "that are required by it"),
|
||||
new ManagedPolicyDef("AmazonBedrockReadOnly", "/",
|
||||
"Provides read only access to Amazon Bedrock"),
|
||||
new ManagedPolicyDef("AmazonBedrockAgentCoreMemoryBedrockModelInferenceExecutionRolePolicy", "/",
|
||||
"Provides Bedrock Model inference permissions to Bedrock agent core memory."),
|
||||
|
||||
|
||||
@@ -622,6 +622,27 @@ class IamServiceTest {
|
||||
"arn:aws:iam::aws:policy/service-role/AmazonRDSEnhancedMonitoringRole");
|
||||
assertEquals("AmazonRDSEnhancedMonitoringRole", rdsMonitoring.getPolicyName());
|
||||
assertEquals("/service-role/", rdsMonitoring.getPath());
|
||||
|
||||
IamPolicy bedrock = iamService.getPolicy("arn:aws:iam::aws:policy/AmazonBedrockFullAccess");
|
||||
assertEquals("AmazonBedrockFullAccess", bedrock.getPolicyName());
|
||||
assertEquals("/", bedrock.getPath());
|
||||
|
||||
IamPolicy bedrockReadOnly = iamService.getPolicy("arn:aws:iam::aws:policy/AmazonBedrockReadOnly");
|
||||
assertEquals("AmazonBedrockReadOnly", bedrockReadOnly.getPolicyName());
|
||||
assertEquals("/", bedrockReadOnly.getPath());
|
||||
}
|
||||
|
||||
@Test
|
||||
void attachAmazonBedrockFullAccessToRole() {
|
||||
// Regression: AmazonBedrockFullAccess was absent from the seed catalog, so
|
||||
// AttachRolePolicy (the Terraform path — CloudFormation attaches inline and
|
||||
// never calls it) 404'd with NoSuchEntity. Attaching it must now succeed.
|
||||
iamService.createRole("BedrockRole", "/", "{}", null, 0, null);
|
||||
iamService.attachRolePolicy("BedrockRole", "arn:aws:iam::aws:policy/AmazonBedrockFullAccess");
|
||||
|
||||
List<String> attached = iamService.listAttachedRolePolicies("BedrockRole", null).stream()
|
||||
.map(IamPolicy::getArn).toList();
|
||||
assertTrue(attached.contains("arn:aws:iam::aws:policy/AmazonBedrockFullAccess"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in new issue
Block a user