https://pulumi.com logo
Title
p

purple-train-14007

02/06/2023, 4:21 PM
Is there a way to have pulumi manage this resource name for me and the name I want in the console be what the tag says?
m

melodic-tomato-39005

02/06/2023, 6:26 PM
Not sure I understand the question correctly. You can specify your own name, without the auto-generated suffix. https://www.pulumi.com/docs/intro/concepts/resources/names/#autonaming
p

purple-train-14007

02/06/2023, 7:03 PM
well the name has to be unique
this.RTassnA = new aws.ec2.RouteTableAssociation(this.vpc.id + "assnA",{
      subnetId: this.subnet1.id.toString(),
      routeTableId: this.privatertA.id,
    },{parent: this});
I thought I could append the vpcId to it but Im overriding the values in the name tag.
nvm, generated my own UUID for the resource to stop name collision
ok nvm dont add a uuid to your resource name or itll delete your entire stack...like resources you arent even changing
m

melodic-tomato-39005

02/06/2023, 8:31 PM
Wait what? There must be something else going on.
p

purple-train-14007

02/06/2023, 9:41 PM
yeah it killed my whole network
replaced my network and made me have to get our network team to reconnect the tgw to it
here is the stack output from the pipeline
Untitled.ts
its cool though...it was just our lab. I have the pipeline require manual intervention for our prod environments so I was able to stop it
but yeah it replaced everything after just adding a uuid to a route table name and association
s

stocky-restaurant-98004

02/07/2023, 5:24 PM
@purple-train-14007 You might find this example code a useful reference for both the infra you're building and the naming stuff you're hitting: https://github.com/pulumi/workshops/tree/main/aws-advanced-networking
This is an example of how I get unique names within components: https://github.com/pulumi/workshops/blob/main/aws-advanced-networking/hub.py#L29-L30
p

purple-train-14007

02/08/2023, 2:47 PM
Thanks Josh!