https://pulumi.com logo
Title
n

nutritious-shampoo-16116

07/13/2021, 9:59 AM
is it forbidden to use Outputs as resource name? seems like pulumi can't resolve those
w

witty-dentist-91954

07/13/2021, 10:02 AM
I think you can't use an Output as resource_name (with Python), but you can set the resource's
name
with an Output
n

nutritious-shampoo-16116

07/13/2021, 10:05 AM
I keep getting
TypeError: Expected resource name to be a string
I am trying
self.rand = random.RandomId(
            self.resource_name(), byte_length=4, keepers={'target_port': target_port},
        ).hex
listener_kwargs = {
            'default_actions': [{'type': 'forward', 'target_group_arn': target_group.arn}],
            'load_balancer_arn': load_balancer.arn,
            'port': listener_port,
            'protocol': listener_protocol,
            'resource_name': pulumi.Output.concat(self.resource_name(), self.rand.hex),
        }
where self.resource_name() returns a string
and name can't be set with the listener 🤷‍♂️
w

witty-dentist-91954

07/13/2021, 10:56 AM
p

prehistoric-nail-50687

07/13/2021, 12:57 PM
resource names are static identifiers used by pulumi to build its internal graph, as `Output`s are dynamic (unknown until resolved), these can not be used to build a name
👍 1