Hey folks! I'm looking at trying to create an <App...
# azure
f
Hey folks! I'm looking at trying to create an Application Gateway for a VM Scale Set, and I'm noticing that the creation process seems to be pretty... janky? It seems like you need to do a bunch of ID self-referencing through
SubResourceArgs
. For example, you define
FrontendPorts
for the Gateway inside the resource declaration, but when you later set up the
HttpListeners
, you need to refer back to the
FrontendPorts
you created and you can only refer to them by Resource ID. See the snippet for an example of what I mean. Yet, we can't manually construct these Resource IDs, as we don't know the name of the Application Gateway in advance due to Pulumi's unique ID appending to the end of resource names. I also can't create them in advance, as there's no standalone
FrontendPorts
resource that I can create separately, then pass in later. My question: is there any intelligent, programmatic way to do these self-references before the Gateway has been created (something magic like
self.Id
)? Or do I just need to bite the bullet, manually name Gateway and bypass the unique name generation, and manually write these Resource IDs out? Thank you!
m
Hey! Yes, unfortunately it is indeed janky at this point. This is recorded as issue https://github.com/pulumi/pulumi-azure-native/issues/631 (please upvote). However, the issue does at least have a workaround using
apply
. Could you use this approach as well?
f
Thanks, Thomas! Glad to know it's not just me. I upvoted that issue as well 🙂 I ended up just making a large C# anonymous object with a map of sub resources, which each contained their name and a string concatenation of what I'm pretty sure their resource IDs will end up being. It's inelegant, but it should at least work until some sort of self-referencing ability is put in!