Is there a way to tags resources more aptly when u...
# golang
f
Is there a way to tags resources more aptly when using awsx? I have the below starter code, but I only see a way to set tags at the VPC level and not for the other components that the vpcx module creates.
Copy code
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cidr := "192.168.0.0/16"
		vpcName := "dna"
		_, err := ec2x.NewVpc(ctx, vpcName, &ec2x.VpcArgs{
			CidrBlock: &cidr,
			Tags:      pulumi.ToStringMap(namedTags(ctx, vpcName)),
		})
		if err != nil {
			log.Fatalln(err)
		}
		return nil
	})
}
This code does what is needed but the names are like
<vpc-name>-private-1
for a subnet for example.
b
what would you like to happen?
f
@billowy-army-68599 I would like to name the subnets, NATs, EIPs in a way that includes the AZ in the name.
b
you would need to retrieve them using a getter function in that case
f
Ohh you mean retrieve and tag? I did not know that could be done. @billowy-army-68599
@billowy-army-68599 I tried using a getter, but I was not able to find a way to modify the said resource after fetching the state. I don't see a way to set/modify the already provisioned resource. Please correct me if I am missing something.
b
If you want to modify and existing resource you haven't provisioned with Pulumi, you'll need to import it first
You can't just patch a resource that exists
It needs to be fully managed by Pulumi
f
Got it. Thanks!