Channels
welcome
pulumi-cdk
cloudengineering
yaml
blog-posts
localstack
pulumi-ai
package-authoring
general
pulumiup-booth-support
oracle-cloud-infrastructure
learn-pulumi-events
linen
registry
built-with-pulumi
pulumi-cloud
contribex
testingtesting321
hacktoberfest
pulumi-crosscode
content-share
finops
multi-language-hackathon
office-hours
workshops
gitlab
pulumi-kubernetes-operator
jobs
pulumi-deployments
dotnet
aws
golang
announcements
java
pulumiverse
python
install
getting-started
cloudengineering-support
testingtesting123
hackathon-03-19-2020
typescript
google-cloud
contribute
azure
kubernetes
docs
automation-api
status
Powered by
#typescript
Title
l
little-whale-73288
09/27/2021, 9:05 AM
Hello, is it kosher to instantiate resource classes inside
.apply
callbacks?
Answering myself: nope:
https://www.pulumi.com/docs/intro/concepts/inputs-outputs/#apply
: "you should not allocate new resources inside of your callbacks either, as it could lead to
pulumi preview
being wrong"
In this case, what is the proper way of instantiating a resource per each of zones returned by
https://www.pulumi.com/docs/reference/pkg/aws/getavailabilityzones/
?
perhaps it's OK to do it inside
.then
on a promise, but not inside
.apply
on an output?
b
billowy-army-68599
09/27/2021, 3:11 PM
while we try and recommend not doing this, it's sometimes unavoidable, this seems like one of those cases
if you're okay with the preview being wrong, you can go with this
l
little-whale-73288
09/28/2021, 6:02 AM
thanks. It's an option, but OTOH we consider reliable previews necessary
Post