how do I override the generated ID of a resource?
# general
h
how do I override the generated ID of a resource?
l
Is it of an imported resource? If a resource is created, then Pulumi knows its ID. There would be no reason to change the ID.
Or do you mean the name? Which looks like the name arg, with a random suffix?
h
i need to manage the exact name manually because of circular dependencies
l
Namable resources have a name property, different to its name arg. You can set that.
It is usually not needed; the only times I've seen a real need for that is when the resource's name is used in an unmanaged (and usually, legacy) resource.
Recursion sounds like a good thing to avoid in infrastructure architecture 🙂
Circular dependencies can often be avoided, but if not, then a well-known name works.
So use the name property.
h
I've got an Azure WindowsFunctionApp, where I'm using the default hostname (because it's not important and I can't be arsed, which has an OAuth registration, which needs the redirect URL
l
And that can't be created after the resource you want to rename?
h
nope, UUIDs generated by the OAuth stuff need to be passed to the app config
l
Fair enough. Then given that you don't want to pass the host's name into the host when creating it, a well-known name sounds reasonable. Note that this will cause problems when updating via delete-recreate, and it may prevent you deploying twice to the same account.
h
oh,
pulumi_random
solves that
and yeah, just passing
name
handled that, cool