prehistoric-kite-30979
01/25/2021, 3:12 PMbrave-planet-10645
01/25/2021, 3:22 PMprehistoric-kite-30979
01/25/2021, 3:24 PMconstructor(name: string, args: ClusterArgs) {
super("tetrate:aws:eks", name)
this.name = name
const roles = this.createNodeGroupRoles(args.nodeGroups)
this.eksCluster = new eks.Cluster(name, {
version: args.version,
vpcId: args.vpcId,
publicSubnetIds: args.publicSubnetIds,
privateSubnetIds: args.privateSubnetIds,
enabledClusterLogTypes: ["api", "audit", "authenticator", "controllerManager", "scheduler"],
createOidcProvider: true,
skipDefaultNodeGroup: true,
instanceRoles: roles,
},{parent: this})
this.createNodeGroups(args.nodeGroups, roles)
}
brave-planet-10645
01/25/2021, 3:25 PMprehistoric-kite-30979
01/25/2021, 3:25 PMaws:eks:Cluster (cloudops-eksCluster):
error: 1 error occurred:
* error creating EKS Cluster (cloudops-eksCluster-ff5ae24): InvalidParameterException: Security group(s) [sg-xxx] are not in the same VPC as the subnets. Please specify a security group that is associated with the VPC: vpc-xxx.
{
RespMetadata: {
StatusCode: 400,
RequestID: "be90565c-6cda-4e87-9d56-d86e32600c4d"
},
ClusterName: "cloudops-eksCluster-ff5ae24",
Message_: "Security group(s) [sg-xxx] are not in the same VPC as the subnets. Please specify a security group that is associated with the VPC: vpc-xxx."
}
brave-planet-10645
01/25/2021, 3:30 PMprehistoric-kite-30979
01/25/2021, 3:32 PMconst networkStack = new pulumi.StackReference("aws.network.global")
const vpc = (networkStack.requireOutput("cloudops") as pulumi.Output<VpcImport>)
const eksCluster = new Eks("cloudops", {
version: "1.18",
vpcId: vpc.id,
publicSubnetIds: vpc.publicSubnetIds,
privateSubnetIds: vpc.privateSubnetIds,
})
brave-planet-10645
01/25/2021, 3:32 PMprehistoric-kite-30979
01/25/2021, 3:32 PM"@pulumi/eks": "^0.21.0",
brave-planet-10645
01/25/2021, 3:44 PMprehistoric-kite-30979
01/25/2021, 3:45 PMbrave-planet-10645
01/25/2021, 3:46 PMprehistoric-kite-30979
01/25/2021, 3:46 PMget output(): VpcExport {
return {
vpcId: this.id,
publicSubnetIds: this.publicSubnetIds,
privateSubnetIds: this.privateSubnetIds,
isolatedSubnetIds: this.isolatedSubnetIds,
internetGatewayId: this.internetGateway.then((igw) => {return igw?.internetGateway.id}),
natGatewayIds: this.natGateways.then((natgws) => {return natgws.map((natgw) => {return natgw.natGateway.id})})
}
}
brave-planet-10645
01/25/2021, 3:49 PMprehistoric-kite-30979
01/25/2021, 3:49 PMbrave-planet-10645
01/25/2021, 4:15 PMvpcId
property but when you pass in the argument you're passing it in as vpc.id
. Can you do an export of the vpc object before you initialise the cluster... so something like this:
const networkStack = new pulumi.StackReference("aws.network.global")
const vpc = (networkStack.requireOutput("cloudops") as pulumi.Output<VpcImport>)
export const clusterVpc = vpc;
const eksCluster = new Eks("cloudops", {
version: "1.18",
vpcId: vpc.id,
publicSubnetIds: vpc.publicSubnetIds,
privateSubnetIds: vpc.privateSubnetIds,
})
prehistoric-kite-30979
01/25/2021, 4:18 PM+ clusterVpc: {
+ internetGatewayId: "igw-0f295e01a8f642779"
+ isolatedSubnetIds: [
+ [0]: "subnet-0e380d25a405c9d29"
+ [1]: "subnet-0add20b1f6e3c152d"
+ [2]: "subnet-0a1593001387e5003"
]
+ natGatewayIds : [
+ [0]: "nat-0c90334400f5f0829"
+ [1]: "nat-0d73b08c5793a0d40"
+ [2]: "nat-0aa02eb6feb839121"
]
+ privateSubnetIds : [
+ [0]: "subnet-065c56466b6531f31"
+ [1]: "subnet-0bf778d758cc65322"
+ [2]: "subnet-0fb73ccbf5f130d85"
]
+ publicSubnetIds : [
+ [0]: "subnet-0cb9dea16c8c7f43f"
+ [1]: "subnet-016267fc4f9031836"
+ [2]: "subnet-07292ebfa06a1384f"
]
+ vpcId : "vpc-xxx"
}
brave-planet-10645
01/25/2021, 4:21 PMconst eksCluster = new Eks("cloudops", {
version: "1.18",
vpcId: vpc.vpcId,
publicSubnetIds: vpc.publicSubnetIds,
privateSubnetIds: vpc.privateSubnetIds,
})
prehistoric-kite-30979
01/25/2021, 4:21 PMbrave-planet-10645
01/25/2021, 4:22 PMprehistoric-kite-30979
01/25/2021, 4:25 PMbrave-planet-10645
01/25/2021, 4:26 PMprehistoric-kite-30979
01/25/2021, 4:27 PMbrave-planet-10645
01/25/2021, 4:40 PMimport * as awsx from "@pulumi/awsx";
import * as eks from "@pulumi/eks";
const vpc = new awsx.ec2.Vpc("vpc", {
subnets: [{type: "private"}, {type: "public"}],
numberOfAvailabilityZones: 2
});
const cluster = new eks.Cluster("cluster", {
version: "1.18",
publicSubnetIds: vpc.publicSubnetIds,
privateSubnetIds: vpc.privateSubnetIds,
enabledClusterLogTypes: ["api", "audit", "authenticator", "controllerManager", "scheduler"],
createOidcProvider: true,
skipDefaultNodeGroup: true,
})
(so not passing in the id of the VPC I created)