Anyone have a nice pattern to apply Tags to the AW...
# golang
g
Anyone have a nice pattern to apply Tags to the AWS Native Resources which now have custom specific Tag Array Type?
Copy code
&ec2.SubnetArgs{
			AvailabilityZone: pulumi.String(azResult.Azs[i]),
			CidrBlock:        cidr,
			VpcId:            infra.Vpc.ID(),
			Tags: &ec2.SubnetTagArray{},
		}
I'm attempting to iterate over a map of strings to append to this specific type but it is not iterable.
m
Hi @gifted-fall-44000, how about this?
Copy code
var subnetTags ec2.SubnetTagArray
		var mapOfStrings map[string]string
		for k, v := range mapOfStrings {
			subnetTags = append(subnetTags, ec2.SubnetTagArgs{
				Key:   pulumi.String(k),
				Value: pulumi.String(v),
			})
		}

		ec2.SubnetArgs{
			VpcId:            pulumi.String("vpc-12345678"),
			AvailabilityZone: pulumi.String("us-west-2a"),
			CidrBlock:        pulumi.String(""),
			Tags:             subnetTags,
		}