Skip to content

Instantly share code, notes, and snippets.

@jen20

jen20/index.ts Secret

Created June 26, 2018 08:12
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jen20/27ed06a57d2a60af2f909cb3882f5277 to your computer and use it in GitHub Desktop.
import * as aws from "@pulumi/aws";
const baseTags = {
"Project": "Demo"
};
let azs = aws.getAvailabilityZones();
let getAz = async function (index: number): Promise<string> {
return (await azs).names[index];
};
const vpc = new aws.ec2.Vpc("vpc", {
cidrBlock: "10.0.0.0/16",
enableDnsHostnames: true,
enableDnsSupport: true,
tags: baseTags
});
const privateSubnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"].map((cidr, index) => {
return new aws.ec2.Subnet(`subnet${index}`, {
availabilityZone: getAz(index),
cidrBlock: cidr,
mapPublicIpOnLaunch: false,
vpcId: vpc.id,
tags: Object.assign({"Name": `Private Subnet ${index + 1}`}, baseTags)
});
});
export const vpcId = vpc.id;
export const privateSubnetIds = privateSubnets.map((subnet) => subnet.id);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment