-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
44 lines (38 loc) · 1.67 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import * as pulumi from "@pulumi/pulumi";
import * as awsx from "@pulumi/awsx";
import * as aws from "@pulumi/aws";
import * as eks from "@pulumi/eks";
// importing local configs
const config = new pulumi.Config();
const vpc_cidrs = config.get("vpc_cidr") || "10.0.0.0/24"
const availability_zones = config.getNumber("number_of_availability_zones") || 3
const myname = 'demo'
// creating a vpc
const myvpc = new awsx.ec2.Vpc(`${myname}-vpc`, {
cidrBlock: vpc_cidrs,
numberOfAvailabilityZones: availability_zones,
natGateways: {strategy: "Single"}
});
// export vpc outputs
export const vpc_id = myvpc.vpcId;
export const vpc_az_zones = availability_zones;
export const vpc_cidr = vpc_cidrs;
export const vpc_number_of_nat_gateways = 1;
export const vpc_private_subnet_ids = myvpc.privateSubnetIds;
export const vpc_public_subnet_ids = myvpc.publicSubnetIds;
// create a vpc, don't pass in security group. Default ones will be created.
const mycluster = new eks.Cluster(`${myname}-eks`, {
instanceType: "t3a.micro",
version: "1.22",
nodeRootVolumeSize: 10,
encryptRootBlockDevice: true,
vpcId: myvpc.vpcId,
publicSubnetIds: myvpc.publicSubnetIds,
privateSubnetIds: myvpc.privateSubnetIds,
enabledClusterLogTypes: ["api", "audit", "authenticator", "controllerManager", "scheduler"],
});
// Export the eks cluster and the default security group that was created.
export const cluster_name = mycluster.eksCluster.id;
export const cluster_security_group_name = mycluster.clusterSecurityGroup.name;
export const cluster_security_group_ingress = mycluster.clusterSecurityGroup.ingress;
export const cluster_security_group_egress = mycluster.clusterSecurityGroup.egress;