fix(cloudformation): resolve IAM assume role policy intrinsics - #2630
fix(cloudformation): resolve IAM assume role policy intrinsics#2630AbarnaaSree wants to merge 1 commit into
Conversation
|
🎉 Thanks for your first pull request to Floci! Your CI checks need a maintainer to approve them before they run. That is GitHub's standard gate on first-time contributors, not a problem with your PR — so if the checks look like they are doing nothing, that is why. Once a maintainer approves, CI and the compatibility suite start automatically. Nothing is needed from you in the meantime. While you wait, a couple of things that make review faster:
Come join us in Slack — it is the fastest way to reach maintainers if you get stuck, or want feedback on an approach before investing more time in it. |
|
| Filename | Overview |
|---|---|
| src/main/java/io/github/hectorvent/floci/services/cloudformation/provisioners/IamRoleCfnProvisioner.java | Resolves trust-policy intrinsics before persistence, but object- or array-valued Fn::If branches can collapse to empty strings. |
| src/test/java/io/github/hectorvent/floci/services/cloudformation/provisioners/IamRoleCfnProvisionerTest.java | Adds scalar Fn::Sub regression coverage, with inconsistent class-member indentation and no coverage for non-scalar intrinsic results. |
Reviews (1): Last reviewed commit: "fix(cloudformation): resolve IAM assume ..." | Re-trigger Greptile
| : "{\"Version\":\"2012-10-17\",\"Statement\":[]}"; | ||
| String assumeDoc = props == null | ||
| ? null | ||
| : ctx.engine().resolveJsonAttribute(props.path("AssumeRolePolicyDocument")); |
There was a problem hiding this comment.
| @Test | ||
| void assumeRolePolicyIntrinsicsAreResolved() { |
There was a problem hiding this comment.
Test indentation breaks convention
The new test annotation and method declaration are placed at column one rather than using the class-member indentation established throughout this file, while the adjacent ctx() helper also receives unrelated inconsistent indentation. Aligning these lines with the existing test structure keeps this focused fix readable and avoids formatting churn.
Context Used: AGENTS.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Summary
Closes #2538
Resolve
AssumeRolePolicyDocumentthroughCloudFormationTemplateEngine.resolveJsonAttributebefore storing it inAWS::IAM::Role.Previously, the raw template node was serialized directly, causing intrinsics such as
Fn::SubandRefto be stored as unresolved CloudFormation syntax.Added a regression test to verify that the resolved trust policy is passed to
IamService.createRolewithout unresolved intrinsic keys.Type of change
fix:)feat:)feat!:orfix!:)AWS Compatibility
The IAM role
AssumeRolePolicyDocumentwas previously stored with unresolved CloudFormation intrinsic functions such asFn::Sub.The fix resolves JSON-valued attributes using the existing
resolveJsonAttributehelper before passing the policy to the IAM service.Checklist
mvn -Dtest=IamRoleCfnProvisionerTest testpasses locally