hundreds-receptionist-31352
09/08/2020, 12:35 PMcool-fireman-90027
09/08/2020, 4:05 PMconst vpc = new awsx.ec2.Vpc(`${vpc_name}`, {
cidrBlock: vpc_cidr,
numberOfNatGateways: number_of_nat_gateways,
subnets: [
{ type: "public", name: "pulumi-public-web-1", location: {cidrBlock: "10.0.0.0/24",availabilityZone: "us-east-1e" }},
{ type: "public", name: "pulumi-public-web-2", location: {cidrBlock:"10.0.1.0/24", availabilityZone: "us-east-1e"}},
{ type: "private", name: "pulumi-private-apps-1", location: {cidrBlock:"10.0.2.0/24", availabilityZone: "us-east-1d"}},
{ type: "private", name: "pulumi-private-apps-2", location: {cidrBlock:"10.0.3.0/25", availabilityZone: "us-east-1e"}},
{ type: "private", name: "pulumi-private-databases", location: {cidrBlock:"10.0.3.128/25", availabilityZone: "us-east-1f"}},
]
});
hundreds-receptionist-31352
09/08/2020, 5:09 PMcool-fireman-90027
09/08/2020, 5:56 PMall
of the az's to have it spread them all.
https://www.pulumi.com/docs/reference/pkg/nodejs/pulumi/awsx/ec2/#VpcArgs-numberOfAvailabilityZones
You could add/set the subnets as a variable in the config file:
pulumi config set subnet_1_cidr 10.0.0.0/..
pulumi config set subnet_1_cidr 10.0.0.1/..
and then you could read it into you index.ts
like this:
const number_of_nat_gateways = config.requireNumber("number_of_nat_gateways");
and then later in the vpc construct you have:
numberOfNatGateways: number_of_nat_gateways,
billowy-army-68599
09/08/2020, 6:01 PMhundreds-receptionist-31352
09/08/2020, 6:58 PM