Is there any way to expand an `Output<Resource[...
# general
a
Is there any way to expand an
Output<Resource[]>
to create child resources based on each
Resource
, without creating resources inside a
.apply()
? https://github.com/pulumi/pulumi/issues/5392#issuecomment-1203668256
l
No. Were the resources created based on another array, maybe of names or something? You could use that as your starting point. This is the same problem as with awsx.ec2.Vpc: your code cannot know how many subnets will be created, you need to work with Promises or Outputs. Even though you may have hardcoded public and private subnets, three AZs (therefore 6 subnets), you cannot have non-future references to those known 6 items.
a
Got it. I'm specifically asking about
gcp.certificatemanager.DnsAuthorization
. It returns an
Output<DnsAuthorizationDnsResourceRecord[]>
, and then for each
DnsAuthorizationDnsResourceRecord
we need to create a matching DNS record. It seems like the way to do it is with
.apply()
, even though that causes the previews to be wrong. https://www.pulumi.com/registry/packages/gcp/api-docs/certificatemanager/dnsauthorization/#state_dnsresourcerecords_nodejs
e
Yeh you have to do this inside Apply at the moment. You might want to use
--target
to just create the certificate manager and then do a preview for the other resources that should then be correct.