https://pulumi.com logo
#python
Title
# python
t

thousands-knife-3009

02/28/2024, 6:50 PM
I'm new to Pulumi and am encountering an issue when trying to create a pulumi component. I've added the components code and the output with the error here https://gist.github.com/jeffclay/df65ae2d32e19bcca0d363c8f81b0231 It seems that I'm doing something wrong with the RandomPassword result but everything I have tried (including the suggestion in the error log) have the same result. Any help would be greatly appreciated.
a

adventurous-butcher-54166

02/29/2024, 9:41 AM
Try passing the
.result
directly without
.apply(lambda v: f"prefix{v}suffix")
- you are basically trying to concat the value with "prefix" + result + "suffix" when the result value isn't yet known. https://gist.github.com/jeffclay/df65ae2d32e19bcca0d363c8f81b0231#file-component-py-L55 Using outputs in resource_names can be problematic when outputs aren't yet known – and thus pulumi wouldn't know what logical name to use for the resource (see issue #5234). And I'm not sure you can access name here as you're passing in the
.result
property and not the
RandomPassword
instance. https://gist.github.com/jeffclay/df65ae2d32e19bcca0d363c8f81b0231#file-component-py-L123 https://gist.github.com/jeffclay/df65ae2d32e19bcca0d363c8f81b0231#file-component-py-L159 Although I haven't used pulumi-gcp or pulumi-gitlab, you can in most cases pass in unknown outputs as input parameters and Pulumi will take care of that once the value is known. Or if you still get warnings just append
.apply(lambda v: v)
In this particular case you don't have to do any string mangling to compose the bucket url as that is one of the outputs from Bucket so you can simply do
value=self.gcp_bucket.url
https://gist.github.com/jeffclay/df65ae2d32e19bcca0d363c8f81b0231#file-component-py-L77