feat(core): add Fn::GetStackOutput for cross-region references#37724
Conversation
Introduces a new feature flag `USE_GET_STACK_OUTPUT` that enables using the CloudFormation intrinsic function `Fn::GetStackOutput` for cross-region stack references instead of custom resources with SSM parameters. When `crossRegionReferences=true` and this flag is enabled, cross-region references are resolved using `Fn::GetStackOutput`, which directly retrieves outputs from other stacks without requiring custom resources. Changes: - Add `Fn.getStackOutput()` method and `FnGetStackOutput` class in cfn-fn.ts - Implement `createGetStackOutput()` in refs.ts to generate outputs and references - Add `USE_GET_STACK_OUTPUT` feature flag with recommended value `true` - Update feature flags documentation and recommended flags configuration - Add test coverage for the new functionality
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
|
Resolving the security guardian violation in the |
|
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 29 minutes 37 seconds in the queue, including 29 minutes 19 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. |
By default, the CDK only allows references between resources if they are in the same environment (account and region). But users can opt in to an experimental feature that allows cross-region, same-account references, by setting the
crossRegionReferenceflag totruein the consumer stack. With this feature on, when there is a cross-region reference, the CDK generates two custom resources that communicate with each other via SSM parameters. A writer resource is deployed to the producer stack, and a reader resource is deployed to the consumer stack.So far, this was the best mechanism to "export" a value in the producer and "import" it in the consumer. But CloudFormation has now released a new intrinsic function,
Fn::GetStackOutput, which, as the name suggests, gets the value of a arbitrary output. This function works cross-region and cross-account. This PR introduces support for these two use cases.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license