I have a configuration file in which I want to rep...
# python
w
I have a configuration file in which I want to replace
<BUCKET>
with a
bucket.id
.
userScript.replace('<BUCKET_NAME>', bucket.id)
causes the error
"Expected type 'str', got 'Output[str]' instead"
, which makes perfect sense. Could someone please tell me how I can tell Pulumi to execute this replacement only after the bucket resource has been created? (similar to what I usually
pulumi.Output.concat()
).
I'll answer my own question for now. The answer is here: https://www.pulumi.com/docs/intro/concepts/programming-model/#apply
Copy code
userScript_built = userScript.replace('<BUCKET_NAME>', bucket.id)
becomes something like:
Copy code
userScript_built = bucket.id.apply(lambda id: userScript.replace('<BUCKET_NAME>', id))