Channels
announcements
automation-api
aws
azure
blog-posts
built-with-pulumi
cloudengineering
cloudengineering-support
content-share
contribex
contribute
docs
dotnet
finops
general
getting-started
gitlab
golang
google-cloud
hackathon-03-19-2020
hacktoberfest
install
java
jobs
kubernetes
learn-pulumi-events
linen
localstack
multi-language-hackathon
office-hours
oracle-cloud-infrastructure
plugin-framework
pulumi-ai
pulumi-cdk
pulumi-cloud
pulumi-crosscode
pulumi-deployments
pulumi-kubernetes-operator
pulumiverse
python
registry
status
testingtesting123
testingtesting321
typescript
welcome
workshops
yaml
Powered by
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
#typescript
Join Slack