fix(core): share a single IAM role across cross-account Fn::GetStackOutput consumers#37871
Conversation
…utput consumers - When multiple consumer stacks in different accounts reference the same producer via Fn::GetStackOutput, the producer now creates a single IAM role with all consumer principals in its trust policy, instead of one role per reference. - The role and policy construct IDs are now stable (GetStackOutputRole / GetStackOutputPolicy) rather than derived from each reference's resolved value, ensuring idempotent construct creation. - The trust policy uses Lazy.any to defer principal resolution, accumulating consumers as references are discovered. Test plan - Unit test: multiple consumers produce a single role with multiple principals in the trust policy - Unit test: single consumer with multiple attribute references produces a single principal (not an array) - Existing cross-region and cross-account reference tests continue to pass
|
PRs without a linked issue will receive lower priority for review and merging. Please update the description to follow the PR template and include a line like |
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
|
|
||||||||||||||
|
|
||||||||||||||
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Merge Queue Status
This pull request spent 47 minutes 34 seconds in the queue, including 46 minutes 42 seconds running CI. Required conditions to merge
|
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
|
Comments on closed issues and PRs are hard for our team to see. |
For cross-account references, the producer creates one role per reference.
Change it to create a single IAM role with all consumer principals in its trust policy. The role and policy construct IDs are now stable (
GetStackOutputRole/GetStackOutputPolicy) rather than derived from each reference's resolved value, ensuring idempotent construct creation. The trust policy usesLazy.anyto defer principal resolution, accumulating consumers as references are discovered.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license