Skip to content

Commit

Permalink
CMDCT-4184 - cleans up env variables during import naming
Browse files Browse the repository at this point in the history
  • Loading branch information
peoplespete committed Feb 3, 2025
1 parent b542ca6 commit 4adc8aa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions deployment/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ async function main() {
cdk.Tags.of(app).add("PROJECT", config.project);

let correctParentStack;
if (process.env.WITHOUT_IMPORTS) {
if (process.env.IMPORT_VARIANT == "empty") {
correctParentStack = WithoutImportsParentStack
} else if (process.env.WITH_IMPORTS) {
} else if (process.env.IMPORT_VARIANT == "imports_included") {
correctParentStack = WithImportsParentStack
} else {
correctParentStack = ParentStack
Expand Down
6 changes: 3 additions & 3 deletions deployment/import_instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ cognito.UserPool -
1. Create just the new cdk stack without anything inside of it.

```bash
WITHOUT_IMPORTS=true ./run deploy --stage <YOUR_BRANCH_NAME>
IMPORT_VARIANT=empty ./run deploy --stage <YOUR_BRANCH_NAME>
```

2. Now import all the serverless ejected resources.

```bash
WITH_IMPORTS=true PROJECT=seds cdk import --context stage=<YOUR_BRANCH_NAME> --force
IMPORT_VARIANT=imports_included PROJECT=seds cdk import --context stage=<YOUR_BRANCH_NAME> --force
```
As this import occurs you'll have to provide the information you gathered just before destroying the serverless stacks. For the dynamo tables the default should be correct but read closely to be sure.

3. Run a deploy on that same imported resource set.

```bash
WITH_IMPORTS=true ./run deploy --stage <YOUR_BRANCH_NAME>
IMPORT_VARIANT=imports_included ./run deploy --stage <YOUR_BRANCH_NAME>
```

4. Run a full deploy by kicking off the full cdk deploy.
Expand Down
6 changes: 5 additions & 1 deletion src/write-ui-env-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,15 @@ export async function writeUiEnvFile(stage: string, local = false) {
}
const deploymentOutput = JSON.parse(Parameter!.Value!);

let api_url = deploymentOutput.apiGatewayRestApiUrl;
if (!local) {
api_url = api_url.slice(0, -1)
}
const envVariables = {
LOCAL_LOGIN: "false",
SKIP_PREFLIGHT_CHECK: "true",
API_REGION: region,
API_URL: deploymentOutput.apiGatewayRestApiUrl,
API_URL: api_url,
COGNITO_REGION: region,
COGNITO_IDENTITY_POOL_ID: deploymentOutput.identityPoolId,
COGNITO_USER_POOL_ID: deploymentOutput.userPoolId,
Expand Down

0 comments on commit 4adc8aa

Please sign in to comment.