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
Embed
What would you like to do?
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