1- # Testing Guide: SSM Parameter Store — Cross-Stack Sharing (PR 1 of 2)
1+ # SSM Parameter Store — Cross-Stack Sharing Migration Guide
22
33## Overview
44
5- This is the first of two PRs that together eliminate CloudFormation ` Fn::ImportValue `
6- hard dependencies between ` BaseStack ` and ` DeepracerEventManagerStack ` .
5+ This is ** PR 1 of 3** that together eliminate CloudFormation ` Fn::ImportValue ` hard
6+ dependencies between ` BaseStack ` and ` DeepracerEventManagerStack ` and remove the
7+ Terms & Conditions feature.
8+
9+ > ** BREAKING CHANGE — Sequential upgrade required**
10+ >
11+ > If you have an ** existing deployment** , you must apply these three PRs ** in order** .
12+ > Skipping directly to the latest release will break your deployment with:
13+ > ```
14+ > Delete canceled. Cannot delete export drem-backend-X-base:ExportsOutput...
15+ > as it is in use by drem-backend-X-infrastructure.
16+ > ```
17+ > The three PRs must be deployed as separate pipeline runs in sequence:
18+ > 1. **PR 1** `feat/ssm-cross-stack-sharing` — adds SSM parameters + removes T&C frontend (this PR)
19+ > 2. **PR 2** `feat/ssm-infra-migration` — switches infra to SSM, removes T&C CDK infrastructure
20+ > 3. **PR 3** `feat/restore-base-first-ordering` — restores correct base-first pipeline ordering
21+ >
22+ > Fresh installations (no existing stacks) can apply any single PR or all three in one go.
723
824**Why this matters:** `Fn::ImportValue` creates a CloudFormation lock between stacks
925that blocks independent updates. The symptom is:
@@ -15,16 +31,22 @@ as it is in use by drem-backend-X-infrastructure.
1531
1632### What this PR does (additive only — safe for fresh installs and upgrades)
1733
18- - Adds 14 SSM parameters to ` BaseStack ` under ` /${stackName}/<key> `
34+ - Adds 19 SSM parameters to `BaseStack` under `/${stackName}/<key>`
1935- Removes T&C checkbox/link from sign-up flow and admin Create User form
2036- No changes to `DeepracerEventManagerStack`, the pipeline stage, or any cross-stack
2137 references — existing `Fn::ImportValue` dependencies are untouched
2238
23- ### What PR 2 does (follow-up — requires two-pipeline migration, documented below )
39+ ### What PR 2 does (follow-up — requires two-pipeline migration run from PR 1 )
2440
25- - Switches ` DeepracerEventManagerStack ` to read all 14 values from SSM instead of
41+ - Switches `DeepracerEventManagerStack` to read all values from SSM instead of
2642 via `Fn::ImportValue`
2743- Removes T&C CDK infrastructure (S3 bucket, CloudFront distributions, pipeline step)
44+ - Deploys infra before base so infra can drop `Fn::ImportValue` while base still exports
45+
46+ ### What PR 3 does (one-liner after PR 2 is deployed)
47+
48+ - Restores `stack.addDependency(baseStack)` (base-first ordering) for ongoing development
49+ - Ensures new SSM parameters created in BaseStack exist before infra reads them
2850
2951---
3052
@@ -103,15 +125,15 @@ make install
103125
104126Approve ` DeployDREM ` when prompted. Expected: 45–90 min.
105127
106- This is a safe upgrade — the pipeline only ** adds** 14 SSM parameters to the base
128+ This is a safe upgrade — the pipeline only ** adds** 19 SSM parameters to the base
107129stack. No exports are removed, no cross-stack references change.
108130
109131### Step 4 — Verify post-deploy state
110132
111133#### SSM Parameter Store console
112134
113135Open [ SSM Parameter Store] ( https://console.aws.amazon.com/systems-manager/parameters )
114- and filter by ` /drem-backend-<label>-base/ ` . Expect ** 14 parameters** :
136+ and filter by ` /drem-backend-<label>-base/ ` . Expect ** 19 parameters** :
115137
116138| Parameter | Contains |
117139| -----------| ---------|
@@ -129,6 +151,11 @@ and filter by `/drem-backend-<label>-base/`. Expect **14 parameters**:
129151| ` commentatorGroupRoleArn ` | IAM Role ARN |
130152| ` registrationGroupRoleArn ` | IAM Role ARN |
131153| ` authenticatedUserRoleArn ` | IAM Role ARN |
154+ | ` defaultUserRole ` | IAM Role ARN |
155+ | ` regionalWafWebAclArn ` | WAF Web ACL ARN |
156+ | ` appsyncHelpersLambdaLayerArn ` | Lambda Layer ARN |
157+ | ` helperFunctionsLambdaLayerArn ` | Lambda Layer ARN |
158+ | ` powertoolsLambdaLayerArn ` | Lambda Layer ARN |
132159
133160Or via CLI:
134161
@@ -153,66 +180,18 @@ make test.cdk
153180> - Admin Create User form has no T&C checkbox
154181> - T&C page still accessible at its CloudFront URL (CDK infrastructure not yet removed)
155182
156- ### Step 5 — Clean up
157-
158- ``` sh
159- make drem.clean
160- ```
161-
162- ---
163-
164- ## PR 2 Migration Guide (Fn::ImportValue removal)
165-
166- > Run this ** after** PR 1 has been deployed and confirmed working.
167-
168- PR 2 switches ` DeepracerEventManagerStack ` from ` Fn::ImportValue ` to SSM reads, and
169- removes the T&C CDK infrastructure. Because this removes CloudFormation exports that
170- the infra stack currently imports, it ** cannot be done in a single pipeline run** when
171- upgrading from PR 1. Two pipeline runs are required.
172-
173- ### Why two pipeline runs are needed
174-
175- With ` Fn::ImportValue ` , CloudFormation enforces: a stack cannot remove an export while
176- another stack imports it. Even if both stacks update in the same pipeline run, the
177- evaluation is against the ** currently deployed** infra state.
178-
179- - ** Pipeline run 1** (infra-first ordering): Infra drops all ` Fn::ImportValue ` references
180- (reads from SSM instead). Base unchanged.
181- - ** Pipeline run 2** (base-first ordering): Base removes the now-unused ` CfnOutput `
182- exports and the T&C CDK resources. Infra already uses SSM — no conflict.
183-
184- ### Pipeline run 1 — Drop Fn::ImportValue from infra
185-
186- Switch ` build.config ` to the PR 2 branch with ` stack.addDependency ` temporarily
187- ** reversed** (infra first). SSM params already exist from PR 1, so infra can resolve
188- them at changeset creation time.
189-
190- After this pipeline run completes, infra no longer has any ` Fn::ImportValue ` :
191-
192- ``` sh
193- aws cloudformation get-template \
194- --stack-name drem-backend-< label> -infrastructure \
195- --region < region> \
196- --query ' TemplateBody' \
197- | grep -c ' Fn::ImportValue'
198- # Expected: 0
199- ```
200-
201- ### Pipeline run 2 — Remove base exports and T&C infrastructure
202-
203- Restore ` stack.addDependency(baseStack) ` (base first). Trigger a second pipeline run.
204- Base can now safely remove its ` CfnOutput ` exports and T&C resources.
183+ ### Step 5 — Continue to PR 2
205184
206- > See ` docs/testing-ssm-cross-stack-migration-pr2.md ` (in the PR 2 branch) for the
207- > full step-by-step guide .
185+ See [ ` docs/testing-ssm-cross-stack-migration-pr2.md ` ] ( testing-ssm-cross-stack-migration-pr2.md )
186+ for the PR 2 and PR 3 migration steps .
208187
209188---
210189
211190## Key Files Changed (PR 1)
212191
213192| File | What changed |
214193| ------| -------------|
215- | ` lib/base-stack.ts ` | Writes 14 SSM parameters at end of constructor |
194+ | ` lib/base-stack.ts ` | Writes 19 SSM parameters at end of constructor |
216195| ` lib/constructs/cdn.ts ` | Added ` comment ` prop for CloudFront distribution descriptions |
217196| ` lib/constructs/leaderboard.ts ` | Passes ` comment ` to Cdn construct |
218197| ` lib/constructs/streaming-overlay.ts ` | Passes ` comment ` to Cdn construct |
@@ -221,7 +200,7 @@ Base can now safely remove its `CfnOutput` exports and T&C resources.
221200| ` website/public/locales/en/translation.json ` | Removed T&C translation strings |
222201| ` scripts/generate_amplify_config_cfn.py ` | Removed ` termsAndConditionsUrl ` from config |
223202| ` tsconfig.json ` | Exclude ` website*/ ` subdirs from CDK ` tsc ` compilation |
224- | ` test/deepracer-event-manager.test.ts ` | CDK assertion test for the 14 SSM parameters |
203+ | ` test/deepracer-event-manager.test.ts ` | CDK assertion test for the SSM parameters |
225204| ` jest.config.ts ` | Converted from ` .js ` to ` .ts ` |
226205| ` Makefile ` | ` make drem.clean ` , Python venv fixes, ` make test.cdk ` , ` --require-approval never ` |
227206| ` CLAUDE.md ` | Project overview, commands, and architecture notes |
0 commit comments