Skip to content
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

Parameter Store for cross stack references #309

Closed
corrjo opened this issue Apr 6, 2021 · 2 comments
Closed

Parameter Store for cross stack references #309

corrjo opened this issue Apr 6, 2021 · 2 comments
Labels
management/tracking status/stale The RFC did not get any significant enough progress or tracking and has become stale.

Comments

@corrjo
Copy link
Contributor

corrjo commented Apr 6, 2021

Description

(see: aws/aws-cdk#13184, aws/aws-cdk#13804)

Cloudformation exports work really well for consuming properties of long lived resources, like vpc or subnet ids, however when you have a cdk app with stacks and resources that have variable lifecycles, using exports can lead to a rough time with stacks or resources being locked because something is consuming its export leading to having to do something like https://www.endoflineblog.com/cdk-tips-03-how-to-unblock-cross-stack-references

How I handled this in CFN
Before using cdk, this was an issue that would pop up on occasion and this led me and my team to make broader use of nested stacks, and parameter store.

Nested stacks worked well enough, but it ended up requiring a lot of planning and overhead since passing values between nested stacks at the same level or more than 1 level deep becomes a bit convoluted, hence parameter store to the rescue.

Creating standardized parameter store paths for values based on the app or service we were deploying and consuming those cross stack using the native cloudformation parameter store parameter type gave us a lot of flexibility, allowed us to update resources as we needed and run the stack update on the consuming stacks to pick up new values

I believe using parameter store as the default method for sharing values across different stacks in the same app makes makes the most sense in cdk.

Working Backwards

When passing objects or values between stacks, instead of the producer stack creating a cfn export, it creates a ssm parameter store parameter. The consuming stack then consumes that parameter and the value is resolved with a !Ref

Roles

  • Driver (drives the proposal to completion): @corrjo
  • Approver(s): (assigned by CDK team)
@jstag711
Copy link

Is this just bypassing the safety mechanism that CFN offers? If I have a Lambda in Stack A that imports an IAM Role from Stack B and sticks it in some env variable, even if you dynamically update the reference in the stack defnition, my active lambdas will still be using the old value and will fail assuming you deleted the old role.

Looking at https://www.endoflineblog.com/cdk-tips-03-how-to-unblock-cross-stack-references, isn't another option to cdk deploy --exclusively {consuming stack} to remove the reference, then proceed with the update of the rest of the stacks?

@mrgrain
Copy link
Contributor

mrgrain commented Oct 27, 2023

Duplicate of #82

@mrgrain mrgrain marked this as a duplicate of #82 Oct 27, 2023
@mrgrain mrgrain closed this as not planned Won't fix, can't repro, duplicate, stale Oct 27, 2023
@mrgrain mrgrain added status/stale The RFC did not get any significant enough progress or tracking and has become stale. and removed status/proposed Newly proposed RFC labels Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
management/tracking status/stale The RFC did not get any significant enough progress or tracking and has become stale.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants