Skip to content

Commit 05ac045

Browse files
Cleanup stacks and lookups
1 parent f0de79d commit 05ac045

4 files changed

Lines changed: 15 additions & 28 deletions

File tree

cdk/cdk.context.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,5 @@
44
"eu-west-1a",
55
"eu-west-1b",
66
"eu-west-1c"
7-
],
8-
"ssm:account=764918915129:parameterName=/env/dev/domainName:region=eu-west-1": "dev1.codu.co",
9-
"ssm:account=764918915129:parameterName=/env/dev/hostedZoneId:region=eu-west-1": "Z09797183E6CQSVU1LFVP"
7+
]
108
}

cdk/lib/app-stack.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ import * as acm from "aws-cdk-lib/aws-certificatemanager";
1414
import { HttpsRedirect } from "aws-cdk-lib/aws-route53-patterns";
1515

1616
interface Props extends cdk.StageProps {
17-
domainName: string;
18-
hostedZoneId: string;
1917
db: cdk.aws_rds.DatabaseInstance;
2018
production?: boolean;
2119
}
@@ -27,7 +25,19 @@ export class AppStack extends cdk.Stack {
2725

2826
constructor(scope: Construct, id: string, props: Props) {
2927
super(scope, id, props);
30-
const { domainName, hostedZoneId, db } = props;
28+
const { db } = props;
29+
30+
const domainName = ssm.StringParameter.valueForStringParameter(
31+
this,
32+
`/env/domainName`,
33+
1
34+
);
35+
36+
const hostedZoneId = ssm.StringParameter.valueForStringParameter(
37+
this,
38+
`/env/hostedZoneId`,
39+
1
40+
);
3141

3242
const cluster = new ecs.Cluster(this, "ServiceCluster");
3343

cdk/lib/app-stage.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,12 @@ import type { Construct } from "constructs";
33
import { StorageStack } from "./storage-stack";
44
import { AppStack } from "./app-stack";
55

6-
interface Props extends cdk.StageProps {
7-
domainName: string;
8-
hostedZoneId: string;
9-
}
10-
116
export class AppStage extends cdk.Stage {
12-
constructor(scope: Construct, id: string, props: Props) {
7+
constructor(scope: Construct, id: string, props: cdk.StageProps) {
138
super(scope, id, props);
149

15-
const { domainName, hostedZoneId } = props;
16-
1710
const storageStack = new StorageStack(this, "StorageStack");
1811
new AppStack(this, "AppStack", {
19-
domainName,
20-
hostedZoneId,
2112
db: storageStack.db,
2213
}).addDependency(storageStack);
2314
}

cdk/lib/pipeline-stack.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,12 @@ export class PipelineStack extends cdk.Stack {
3030
`/env/${env}/accountId`
3131
);
3232

33-
const domainName = ssm.StringParameter.valueFromLookup(
34-
this,
35-
`/env/${env}/domainName`
36-
);
37-
38-
const hostedZoneId = ssm.StringParameter.valueFromLookup(
39-
this,
40-
`/env/${env}/hostedZoneId`
41-
);
42-
4333
return {
4434
env: {
4535
// Dummy value on synth prep that causes fail
4636
account: accountId.includes("dummy-value") ? "123456789" : accountId,
4737
region: "eu-west-1",
4838
},
49-
domainName: domainName,
50-
hostedZoneId: hostedZoneId,
5139
};
5240
};
5341

0 commit comments

Comments
 (0)