From d4ad045a5802c674d2506d045fcb4bcab38e3e0c Mon Sep 17 00:00:00 2001 From: John Corrales Date: Wed, 7 Apr 2021 22:05:28 -0700 Subject: [PATCH 1/5] add rfc for loosely coupled refs --- text/0309-parameter-cross-stack-ref.md | 82 ++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 text/0309-parameter-cross-stack-ref.md diff --git a/text/0309-parameter-cross-stack-ref.md b/text/0309-parameter-cross-stack-ref.md new file mode 100644 index 000000000..6b331741e --- /dev/null +++ b/text/0309-parameter-cross-stack-ref.md @@ -0,0 +1,82 @@ +--- +rfc pr: [#xxx](https://github.com/aws/aws-cdk-rfcs/pull/xxx) <-- fill this after you've already created the PR +tracking issue: https://github.com/aws/aws-cdk-rfcs/issues/309 +--- + +# [Loosely Coupled Cross Stack Ref] + +Use Parameter Store parameters for cross stack references + +## Working Backwards + +When passing object or class properties between stacks, instead of creating a CFN Export, +Create a SSM Parameter in parameter store, then have the consuming stack create a parameter +to consume the value from parameter store + +### CHANGELOG + +feat(core): loosely coupled cross stack references + +BREAKING CHANGE: Stacks will need to decouple their exports with dummy values + +### README + +#### Loosely Coupled Stack References + +By default when you pass a Stack property to another Stack cdk uses cloudformation exports and Fn::ImportValue to share +the value cross stack. Adding `'@aws-cdk/core:looseCrossStackRefs'` to your cdk.json changes this behavior +so that parameter store is used for storing and retrieving values across stacks + +## FAQ + +### What are we launching today? + +A new feature in core which enables stacks to be loosely coupled but maintain high cohesion by moving to parameters + +### Why should I use this feature? + +Creating standardized parameter store paths for values based on the stack we are deploying then consuming +those cross stack using the native cloudformation parameterstore parameter type gives a lot of flexibility, +allowing us to update resources as we need and then running stack updates on consuming stacks to pick up the +new values + +## Internal FAQ + + +### Why are we doing this? + +Prevent stacks being export locked and unable to update + +### Why should we _not_ do this? + +Exports lock resources for a reason. In some cases exports may be preferred + +### What changes are required to enable this change? + +A feature flag which changes the what gets returned when requesting a value from another stack + +### Is this a breaking change? + +Yes + + +### What are the drawbacks of this solution? + +Tight coupling means the resources you are dependent on wont go away, in some instances +this behavior prevents breaking consumers. + +### What alternative solutions did you consider? + +Adding extra methods for storing and retrieving parameters from standardized paths, but +this requires a lot of overhead when developing apps + + +### What is the high level implementation plan? + +Add a feature flag, when the flag is enabled create a parameter and return a parameter for the consuming stack + + +### Are there any open issues that need to be addressed later? + +## Appendix + From 19bd442a2351dce38df0c018e3cfff44811879bd Mon Sep 17 00:00:00 2001 From: John Corrales Date: Wed, 7 Apr 2021 22:11:14 -0700 Subject: [PATCH 2/5] PR --- text/0309-parameter-cross-stack-ref.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text/0309-parameter-cross-stack-ref.md b/text/0309-parameter-cross-stack-ref.md index 6b331741e..3554f5e98 100644 --- a/text/0309-parameter-cross-stack-ref.md +++ b/text/0309-parameter-cross-stack-ref.md @@ -1,5 +1,5 @@ --- -rfc pr: [#xxx](https://github.com/aws/aws-cdk-rfcs/pull/xxx) <-- fill this after you've already created the PR +rfc pr: [#311](https://github.com/aws/aws-cdk-rfcs/pull/311) tracking issue: https://github.com/aws/aws-cdk-rfcs/issues/309 --- From 87032e95dbcbedb245afb640fb4cb205ef4875e4 Mon Sep 17 00:00:00 2001 From: John Corrales Date: Sun, 11 Apr 2021 23:46:49 -0700 Subject: [PATCH 3/5] remove extra lines --- text/0309-parameter-cross-stack-ref.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/text/0309-parameter-cross-stack-ref.md b/text/0309-parameter-cross-stack-ref.md index 3554f5e98..9f2ea33b6 100644 --- a/text/0309-parameter-cross-stack-ref.md +++ b/text/0309-parameter-cross-stack-ref.md @@ -42,7 +42,6 @@ new values ## Internal FAQ - ### Why are we doing this? Prevent stacks being export locked and unable to update @@ -59,7 +58,6 @@ A feature flag which changes the what gets returned when requesting a value from Yes - ### What are the drawbacks of this solution? Tight coupling means the resources you are dependent on wont go away, in some instances @@ -70,13 +68,10 @@ this behavior prevents breaking consumers. Adding extra methods for storing and retrieving parameters from standardized paths, but this requires a lot of overhead when developing apps - ### What is the high level implementation plan? Add a feature flag, when the flag is enabled create a parameter and return a parameter for the consuming stack - ### Are there any open issues that need to be addressed later? ## Appendix - From 8bcb735a8f7bc8fe37e3d4a0fc2c2d6aafafe4a0 Mon Sep 17 00:00:00 2001 From: John Corrales Date: Wed, 14 Apr 2021 15:37:23 -0700 Subject: [PATCH 4/5] Update 0309-parameter-cross-stack-ref.md --- text/0309-parameter-cross-stack-ref.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/text/0309-parameter-cross-stack-ref.md b/text/0309-parameter-cross-stack-ref.md index 9f2ea33b6..746699a5b 100644 --- a/text/0309-parameter-cross-stack-ref.md +++ b/text/0309-parameter-cross-stack-ref.md @@ -48,7 +48,17 @@ Prevent stacks being export locked and unable to update ### Why should we _not_ do this? -Exports lock resources for a reason. In some cases exports may be preferred +Exports lock resources for a reason. In some cases exports may be preferred. + +For example: +- Resources may be temporarily unavailable while being replaced causing +errors for downstream consumers. + +- If a stack outside of the app consumes the parameter, there is no tracking, so if the provider +stack is torn down, other stacks may unexpectedly break. + +- For resources that have a more persistent lifecycle (VPCs, Subnets, etc) export locks are +generally a non-issue ### What changes are required to enable this change? From 50a5bdb1b3e6b25c97e504c643d5f321a8e59d02 Mon Sep 17 00:00:00 2001 From: John Corrales Date: Mon, 3 May 2021 11:21:59 -0700 Subject: [PATCH 5/5] strip whitespace --- text/0309-parameter-cross-stack-ref.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/text/0309-parameter-cross-stack-ref.md b/text/0309-parameter-cross-stack-ref.md index 746699a5b..e87f1e9e0 100644 --- a/text/0309-parameter-cross-stack-ref.md +++ b/text/0309-parameter-cross-stack-ref.md @@ -50,9 +50,9 @@ Prevent stacks being export locked and unable to update Exports lock resources for a reason. In some cases exports may be preferred. -For example: -- Resources may be temporarily unavailable while being replaced causing -errors for downstream consumers. +For example: + +- Resources may be temporarily unavailable while being replaced causing errors for downstream consumers. - If a stack outside of the app consumes the parameter, there is no tracking, so if the provider stack is torn down, other stacks may unexpectedly break.