https://pulumi.com logo
m

mammoth-caravan-51104

05/14/2020, 3:33 PM
hello! might be a simple question. i'm trying to set a tag on a subnet with an eks cluster name. subnet needs to exist for cluster to be created. how to update a subnet with a new tag?
s

stocky-island-3676

05/14/2020, 3:43 PM
Hi @mammoth-caravan-51104. Simply by changing the tag on the subnet and then
pulumi up
.? Perhaps it’s not that easy. Can you give us context: 1. Are you using the NodeJS-package `@pulumi/eks`? 2. Or another language than TypeScript/JavaScript?
m

mammoth-caravan-51104

05/14/2020, 3:46 PM
thanks, it's nodeJS
eks
to setup a cluster,
awsx
to setup VPC. tricky thing is that i need to create vpc before cluster, but subnet needs a cluster name in the tag, so it needs to be updated after cluster is created. at least this is how i think it is.
Copy code
const vpc = new awsx.ec2.Vpc("xxx", {})
const cluster = new eks.Cluster("xxx", {
  vpcId: vpc.id,
  subnetIds: vpc.publicSubnetIds,
})

const subnets = vpc.publicSubnets
is there a method to update tags? couldn't find it in the class description: https://github.com/pulumi/pulumi-aws/blob/77e0ff920b7c5506e93aa1564cbe97b77621e377/sdk/nodejs/ec2/subnet.ts#L49
s

stocky-island-3676

05/14/2020, 3:55 PM
If you’re fine to not have the automatic name suffix, you could set the
eks.Cluster(name, {name})
.
subnet needs a cluster name in the tag
I don’t know such details. Sorry. Might be good if you then ask in #aws channel.
m

mammoth-caravan-51104

05/14/2020, 3:59 PM
thanks, much appreciated. setting a name without suffix would allow to set the tag on creation. that could work, thanks
original problem was setting up alb ingress. autodiscovery can get tricky there. finally i just set subnet ids annotation and it worked right away
s

stocky-island-3676

05/14/2020, 4:21 PM
You’re welcome. Just remembered there was a similar issue with EKS and security-group ID. Maybe that helps you, too.
👍 1
l

little-cartoon-10569

05/14/2020, 9:55 PM
Is it possible to create the name before the VPC, then pass it into both - awsx.ec2.Vpc's constructor (args as
{ subnets: [ {type: "public", tags: { cluster: "name"}} ]
), and - eks.Cluster (name).
2 Views