This message was deleted.
# golang
s
This message was deleted.
b
@fancy-spoon-7206 no, you can't convert an output to a string. you can only resolve the output and then use the string value. see here for an explanation as to why: https://leebriggs.co.uk/blog/2021/05/09/pulumi-apply
for your specific example though, you can do:
Copy code
natGatewayName := pulumi.Sprintf("natgw+ %s", publicSubnets[0].AvailabilityZone)
f
If I do that, then natGatewayName is of type StringOutput and I cannot give that as an input to any function as a string. For example,
Copy code
ec2.NewNatGateway(ctx, natGatewayName, ... )
wont work
b
you cannot use an output as a resource name, unfortunately. it needs to be known at run time. if you want to do what you're trying to do, you'd have to do it inside an
ApplyT
but then your previews wouldn't be valid
f
Ahh that makes sense.