https://pulumi.com logo
Title
d

damp-painting-47843

11/16/2022, 12:13 AM
I have a situation where I’m specifying a resource A before resource B because resource B refers to resource A. But I also want to make resource B the parent of resource A. I can’t specify in A that B is the parent because B is not yet defined. But I have to define A first because it is referred to in B. How do I do this?
l

little-cartoon-10569

11/16/2022, 12:42 AM
You can't, the opts are constructor-time configurable only. You could create a ComponentResource and make both real resources children of that?
The problem is fairly common: my "favourite" is the CertificateValidation resource, that I want to be the parent of a route53 Record: the only reason I'm creating the Record is to satisfy the validation requirement. But I can't. So I've created a ValidCertificate component, which has all three resources (certificate, validation and record) as its children.
d

damp-painting-47843

11/16/2022, 3:24 PM
Thank @little-cartoon-10569, I’ll take a look at that.