I am trying to create an eks cluster in aws use so...
# typescript
s
I am trying to create an eks cluster in aws use some explicit subnet definitions in a vpc. I am having issues with getting this to work as is and I was wondering if anyone knew of another way to just make this work? If I seperate the subnets into const's they subnets will not be attached to the vpc and pulumi tries to create a second set of subnets which will obviously fail.
Copy code
// Create a VPC
let vpc = new awsx.ec2.Vpc('vpc', {
    cidrBlock: "10.0.0.0/16",
    numberOfAvailabilityZones: 2,
    subnetSpecs: [
        { type: awsx.ec2.SubnetType.Private, cidrMask: 20 },
        { type: awsx.ec2.SubnetType.Public, cidrMask: 20 },
        { type: awsx.ec2.SubnetType.Private, cidrMask: 20 },
        { type: awsx.ec2.SubnetType.Public, cidrMask: 20 },
    ],
});

const subnetIds = vpc.publicSubnetIds.apply(publicSids => 
    vpc.privateSubnetIds.apply(privateSids => publicSids.concat(privateSids))
);

const cluster = new eks.Cluster("eks-cluster", {
    vpcId: vpc.vpcId,
    subnetIds: subnetIds,
    storageClasses: "io1",
    deployDashboard: false,
    roleMappings: [{
      roleArn: role.arn.apply(arn => arn),
      groups: ["system:masters"],
      username: "pulumi:admin",
    }],
    vpcCniOptions: {
      warmIpTarget: 4,
    },
    encryptRootBlockDevice: true,
    enabledClusterLogTypes: [
      "api",
      "audit",
      "authenticator",
    ],
    version: "1.28",
    nodeGroupOptions: {
      instanceType: "t3.xlarge",
      desiredCapacity: 3,
      minSize: 1,
      maxSize: 3,
      labels: {"Environment": "dev"},
    },
  }, {
    dependsOn: [eksPolicyAttachment]
  });