Hello, is it kosher to instantiate resource classe...
# typescript
l
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
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
thanks. It's an option, but OTOH we consider reliable previews necessary