Skip to content

Instantly share code, notes, and snippets.

@cnunciato
Last active June 4, 2024 15:49
Show Gist options
  • Select an option

  • Save cnunciato/93dfba1036b7503270eefa498d122299 to your computer and use it in GitHub Desktop.

Select an option

Save cnunciato/93dfba1036b7503270eefa498d122299 to your computer and use it in GitHub Desktop.
Calling `pulumi.export` from within an `apply`
from some_module import make_bucket
# Call a function to make a bucket.
make_bucket()
import pulumi
from pulumi_aws import s3
def make_bucket():
bucket = s3.Bucket("my-bucket")
# This won't work:
bucket.id.apply(lambda id: pulumi.export("foo", f"{id}-foo"))
# But this will:
bar = bucket.id.apply(lambda id: f"{id}-bar")
pulumi.export("bar", bar)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment