https://pulumi.com logo
Title
f

flaky-arm-38472

12/20/2022, 9:15 AM
How can I compose a tag key from an output?. I tried:
Tags: pulumi.StringMap{
					string(exampleResource.ApplyT(func(tagKey string) string {
						return "chained-name-" + tagKey
					}).(pulumi.StringOutput))[:]:                    pulumi.String("test"),
}
all the iterations I have done with ApplyT to convert an output to a tag key are giving errors. When I do the same for the key value, as it expect a strInput it works but not for tag keys (expecting plain string): Does not work on tag key
Tags: pulumi.StringMap{
					exampleResource.ApplyT(func(tagKey string) string {
						return "chained-name-" + tagKey
					}).(pulumi.StringOutput):                    pulumi.String("test"),
}
Ok for tag value:
Tags: pulumi.StringMap{
					"Example": exampleResource.ApplyT(func(tagKey string) string {
						return "chained-name-" + tagKey
					}).(pulumi.StringOutput),
}
Running out of ideas.
b

billowy-army-68599

12/21/2022, 4:20 AM
you need to do the
ApplyT
on the outside of your build, so for example (untested`
Tags: exampleResource.ApplyT( // do the rest here
you can’t do an
ApplyT
inside a
StringMap
f

flaky-arm-38472

12/21/2022, 5:42 AM
Interesting. I'm curious then why it can be done on the tag values inside the StringMap ?.