-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws-cdk-lib: cross-stage references with PhysicalName.GENERATE_IF_NEEDED #26571
Comments
I am not sure if this is a good idea as this introduces breaking change but having cross-stage reference is a good feature request. |
@pahud thanks for the feedback. I agree. What could be an alternative? I have 2 ideas:
|
We probably need more feedback from more people but if your proposed solution would not introduce any breaking changes, we always welcome community PRs for that. Also if you need to discuss the design with the core team SDE in the PR planning stage, feel free to schedule an office hour slot with the team. Stay tuned on this thread or the contributing channel on cdk.dev. |
Thanks @pahud. I will book a slot for an office hour event as soon it will be announced. |
FWIW I found using |
Describe the feature
I suggest to allow passing resorces between stages if resource name is marked with
PhysicalName.GENERATE_IF_NEEDED
.Use Case
I have a CDK Pipeline with multiple deployment stage running in a wave. 1 stage = 1 region, but same account. I also want to have 1 stage that deploying after all these stages. In my case, I want to deploy Cloudwatch dashboard that will show graph widget for the same lambda deployed to many regions (I want to use
addLeftMetric
, so graph widget will show 1 line per region on a single widget).Proposed Solution
It could be simple as this: 0e86b2e
The only concern I have:
Looking at this code I can say that
PhysicalName.GENERATE_IF_NEEDED
can generate same names for different stages. It could be an issue if for stages deployed to the same account and region it will generage exactly the same resource names.It could be solved by including this into name generator:
But it is a breaking change (it will generate new names for people who was using
PhysicalName.GENERATE_IF_NEEDED
before this change).Other Information
I currently found a way to build a single dashboard using resources deployed by multiple stages. It looks like this: https://gist.github.com/braska/6f622fdac92d8c66d9d69300d480fbed
The only reason why it is possible - dashboard deployed to the different region where non of other stages deployed. You can see
env.region
for stages inpipeline.ts
. It works because of this condition CDK will generate static name.But I still want to deploy dashboard into
us-east-1
and it is not possible with current implementation.Acknowledgements
CDK version used
2.88.0
Environment details (OS name and version, etc.)
(irrelevant)
The text was updated successfully, but these errors were encountered: