https://pulumi.com logo
#general
Title
# general
h

hundreds-gpu-71155

03/25/2024, 11:28 PM
how do I override the generated ID of a resource?
l

little-cartoon-10569

03/25/2024, 11:31 PM
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

hundreds-gpu-71155

03/25/2024, 11:32 PM
i need to manage the exact name manually because of circular dependencies
l

little-cartoon-10569

03/25/2024, 11:32 PM
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

hundreds-gpu-71155

03/25/2024, 11:34 PM
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

little-cartoon-10569

03/25/2024, 11:35 PM
And that can't be created after the resource you want to rename?
h

hundreds-gpu-71155

03/25/2024, 11:35 PM
nope, UUIDs generated by the OAuth stuff need to be passed to the app config
l

little-cartoon-10569

03/25/2024, 11:37 PM
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

hundreds-gpu-71155

03/25/2024, 11:37 PM
oh,
pulumi_random
solves that
and yeah, just passing
name
handled that, cool
2 Views