mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
fix(cloudformation): AWS::IAM::ManagedPolicy exposes PolicyArn for Fn::GetAtt (#2056)
CloudFormation documents PolicyArn as the attribute for this type, so a template written against AWS reads it back with Fn::GetAtt [<policy>, PolicyArn]. The provisioner only recorded the value under "Arn", so that GetAtt did not resolve and the unresolved literal propagated into whatever consumed it — typically a role's ManagedPolicyArns, which then failed with "Policy <logicalId>.PolicyArn does not exist" and rolled the stack back, several resources away from the cause. Both keys are now recorded; "Arn" stays for anything already reading it.
This commit is contained in:
1 parent
875e0f2d3b
commit
f71903379c
2 files changed
+28
No files matched your search
+6
@@ -2201,7 +2201,13 @@ public class CloudFormationResourceProvisioner {
|
||||
var policy = iamService.createPolicy(policyName, "/", null, document, Map.of());
|
||||
r.getAttributes().put(ROLLBACK_OWNED_ATTR, "true");
|
||||
r.setPhysicalId(policy.getArn());
|
||||
// PolicyArn is the attribute CloudFormation documents for this type, and what a template
|
||||
// written against AWS asks for. Without it Fn::GetAtt does not resolve and the unresolved
|
||||
// literal reaches whatever consumed it — a role's ManagedPolicyArns, typically, which then
|
||||
// fails with "policy does not exist" and rolls the stack back. "Arn" stays for callers
|
||||
// already using it.
|
||||
r.getAttributes().put("Arn", policy.getArn());
|
||||
r.getAttributes().put("PolicyArn", policy.getArn());
|
||||
r.getAttributes().put("ManagedPolicyRoleTargets", String.join("\n", roleNames));
|
||||
|
||||
LinkedHashSet<String> attachedRoleNames = new LinkedHashSet<>();
|
||||
|
||||
Reference in new issue
Block a user