Last active
June 4, 2024 15:49
-
-
Save cnunciato/93dfba1036b7503270eefa498d122299 to your computer and use it in GitHub Desktop.
Calling `pulumi.export` from within an `apply`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from some_module import make_bucket | |
| # Call a function to make a bucket. | |
| make_bucket() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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