https://pulumi.com logo
Title
g

great-sunset-355

06/22/2021, 3:43 PM
Hi Is it possible to get
str
of Output so I can use it as part of
resource_name
in another resource? I tried:
access_rds = ec2.SecurityGroupRule(
        eb_env.id.apply(lambda x: f'awseb-{x}-to-db'),
)
But it still gave me
<pulumi.output.Output object at 0x7f81213b3bb0>
instead of an actual value
b

billowy-army-68599

06/22/2021, 3:48 PM
you can't use apply for a resource name, it must be known at runtime
it has to be a string
a

acceptable-army-69872

06/22/2021, 4:21 PM
FWIW, we use the stack variable in the resource name to provide uniqueness, and then most objects you can set the "name" of the object in the saas provider with an apply. You get a consistent resource name for pulumi to be happy, and your human eyes get whatever name you want, not resourcename-$hash. For a while I didn't realize there was a way to control the name of the object in AWS, and I was going down the same path trying to make the resource name prettier.
👍 1