sparse-optician-70334
09/12/2023, 7:25 AMimport pulumi
from pulumi_aws_native import s3
# Create an AWS resource (S3 Bucket)
bucket = s3.Bucket("my_bucket")
pulumi.export("my_bucket", bucket.id)
with open('./Pulumi.README.md') as f:
pulumi.export('readme', f.read())
The readme with contents of:
- main bucket ${bucket.id}
- my_bucket ${my_bucket}
The file is neatly uploaded. However, the ${} reference to the variable is never resolved and empty. What do I need to change to get the variables to resolve?billowy-army-68599
sparse-optician-70334
09/12/2023, 2:10 PMbillowy-army-68599
bucket.id.apply(
# anything that happens inside this apply block happens
# after the s3 bucket has finished being created
lambda bucket_id: open("README.md", "w").write(bucket_id)
)
sparse-optician-70334
09/12/2023, 2:19 PMbillowy-army-68599
Pulumi.README.md
- they operate differently and render in the Pulumi Cloud interface. Notice the README itself looks like this:
# Stack README
Full markdown support! Substitute stack outputs dynamically so that links can depend on your infrastructure! Link to dashboards, logs, metrics, and more.
1. Reference a string stack output: ${outputs.strVar}
2. Reference an array stack output: ${outputs.arrVar[1]}
More info on stack readme’s can be found here: https://www.pulumi.com/blog/stack-readme/
You will see those outputs in the cloud console, not in your regular file. If you just want to populate a regular file, you’ll have to do it the way I explained.sparse-optician-70334
09/12/2023, 2:47 PMbillowy-army-68599
sparse-optician-70334
09/12/2023, 2:56 PMbillowy-army-68599
sparse-optician-70334
09/12/2023, 3:01 PMbillowy-army-68599