-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
165 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
examples/vpc/nodejs/vpc-ipam-ipv4-auto-cidrblock-with-specs/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/bin/ | ||
/node_modules/ |
8 changes: 8 additions & 0 deletions
8
examples/vpc/nodejs/vpc-ipam-ipv4-auto-cidrblock-with-specs/Pulumi.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name: vpc-ipam-ipv4-auto-cidrblock-with-specs | ||
runtime: | ||
name: nodejs | ||
description: Test inheriting the cidrBlock from an IPv4 IPAM pool and constraining the subnet specs | ||
config: | ||
pulumi:tags: | ||
value: | ||
pulumi:template: aws-typescript |
62 changes: 62 additions & 0 deletions
62
examples/vpc/nodejs/vpc-ipam-ipv4-auto-cidrblock-with-specs/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import * as awsx from "@pulumi/awsx"; | ||
import * as aws from "@pulumi/aws"; | ||
import { SubnetAllocationStrategy } from "@pulumi/awsx/ec2"; | ||
|
||
const repository = "pulumi/pulumi-awsx"; | ||
const testcase = "vpc-ipam-ipv4-auto-cidrblock-with-specs"; | ||
|
||
const tags = { | ||
"repository": repository, | ||
"testcase": testcase, | ||
}; | ||
|
||
const currentRegion = aws.getRegionOutput({}); | ||
|
||
const myVpcIpam = new aws.ec2.VpcIpam("myVpcIpam", { | ||
operatingRegions: [{ | ||
regionName: currentRegion.name, | ||
}], | ||
description: `IPAM for ${repository} example ${testcase}`, | ||
tags: tags, | ||
}); | ||
|
||
const myVpcIpamPool = new aws.ec2.VpcIpamPool("myVpcIpamPool", { | ||
addressFamily: "ipv4", | ||
ipamScopeId: myVpcIpam.privateDefaultScopeId, | ||
locale: currentRegion.name, | ||
tags: tags, | ||
}); | ||
|
||
const myVpcIpamPoolCidr = new aws.ec2.VpcIpamPoolCidr("myVpcIpamPoolCidr", { | ||
ipamPoolId: myVpcIpamPool.id, | ||
cidr: "172.20.0.0/16", | ||
}); | ||
|
||
const myVpc = new awsx.ec2.Vpc("myVpc", { | ||
numberOfAvailabilityZones: 3, | ||
subnetStrategy: SubnetAllocationStrategy.Auto, | ||
ipv4IpamPoolId: myVpcIpamPool.id, | ||
ipv4NetmaskLength: 22, | ||
subnetSpecs: [ | ||
{ | ||
type: "Private", | ||
name: "private", | ||
cidrMask: 25, | ||
}, | ||
{ | ||
type: "Public", | ||
name: "public", | ||
cidrMask: 27, | ||
}, | ||
], | ||
tags: tags, | ||
}, { | ||
dependsOn: [myVpcIpamPoolCidr], | ||
}); | ||
|
||
export const regionName = currentRegion.name; | ||
export const subnetLayout = myVpc.subnetLayout; | ||
export const subnets = myVpc.subnets.apply(s => s.map(x => ({ | ||
availabilityZone: x.availabilityZone, | ||
cidrBlock: x.cidrBlock | ||
}))); |
13 changes: 13 additions & 0 deletions
13
examples/vpc/nodejs/vpc-ipam-ipv4-auto-cidrblock-with-specs/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "vpc-ipam-ipv4-auto-cidrblock-with-specs", | ||
"main": "index.ts", | ||
"devDependencies": { | ||
"@types/node": "^18", | ||
"typescript": "^5.0.0" | ||
}, | ||
"dependencies": { | ||
"@pulumi/aws": "^6.0.0", | ||
"@pulumi/awsx": "^2.0.2", | ||
"@pulumi/pulumi": "^3.113.0" | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
examples/vpc/nodejs/vpc-ipam-ipv4-auto-cidrblock-with-specs/tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"compilerOptions": { | ||
"strict": true, | ||
"outDir": "bin", | ||
"target": "es2020", | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"sourceMap": true, | ||
"experimentalDecorators": true, | ||
"pretty": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"noImplicitReturns": true, | ||
"forceConsistentCasingInFileNames": true | ||
}, | ||
"files": [ | ||
"index.ts" | ||
] | ||
} |