hello! might be a simple question. i'm trying to s...
# general
m
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
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
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
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
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
You’re welcome. Just remembered there was a similar issue with EKS and security-group ID. Maybe that helps you, too.
👍 1
l
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).