aws-cdk-lib: cross-stage references with PhysicalName.GENERATE_IF_NEEDED #26571
Labels
aws-cdk-lib
Related to the aws-cdk-lib package
effort/medium
Medium work item – several days of effort
feature-request
A feature should be added or improved.
p2
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: