Skip to content

Commit f0ce065

Browse files
committed
[AEA-4684] explicitly state az's
1 parent 20a4b18 commit f0ce065

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

packages/cdk/bin/VpcResourcesApp.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ const app = new App()
1111

1212
const version = app.node.tryGetContext("VERSION_NUMBER")
1313
const commit = app.node.tryGetContext("COMMIT_ID")
14+
/* when getAz's is called behind the scenes it only returns the first 2 when the stack is account/region agnostic.
15+
Allow AZ's to be passed as context otherwise explicitly use the 3 in eu-west-2. */
16+
const availabilityZones = app.node.tryGetContext("AVAILABILITY_ZONES") || ["eu-west-2a", "eu-west-2b", "eu-west-2c"]
1417

1518
// add cdk-nag to everything
1619
Aspects.of(app).add(new AwsSolutionsChecks({verbose: true}))
@@ -24,7 +27,8 @@ const VpcResources = new VpcResourcesStack(app, "VpcResourcesStack", {
2427
region: "eu-west-2"
2528
},
2629
stackName: "vpc-resources",
27-
version: version
30+
version: version,
31+
availabilityZones: availabilityZones
2832
})
2933

3034
// run a synth to add custom resource lambdas and roles

packages/cdk/stacks/VpcResourcesStack.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {LogGroup} from "aws-cdk-lib/aws-logs"
1919

2020
export interface VpcResourcesStackProps extends StackProps{
2121
readonly version: string
22+
readonly availabilityZones: [string]
2223
}
2324

2425
/**
@@ -54,7 +55,7 @@ export class VpcResourcesStack extends Stack {
5455
ipAddresses: IpAddresses.cidr("10.190.0.0/16"),
5556
enableDnsSupport: true,
5657
enableDnsHostnames: true,
57-
maxAzs: 3,
58+
availabilityZones: props.availabilityZones,
5859
flowLogs: {
5960
"FlowLogCloudwatch": {
6061
destination: FlowLogDestination.toCloudWatchLogs(flowLogsLogGroup, flowLogsRole)

0 commit comments

Comments
 (0)