Hi all, Is there some way to get Azure id to get e...
# azure
g
Hi all, Is there some way to get Azure id to get existing resource? I feel that this could be part of Pulumi resource. Now I need to build manually:
Copy code
azure.network.PublicIp.get(
    `${stackName}-public-ip`,
    `/subscriptions/${azureSubscriptionId}/resourceGroups/${aksResourceGroup.name}/providers/Microsoft.Network/publicIPAddresses/${azurePublicIPName}`
  );
a
Pulumi doesn't know about the component parts of your resource id in order to get the resource.
Pulumi would have to use
az <resource> list
or some other sort of query to explore your subscription in order to find the resource id so that it could ask
az
for the resource.
k
Not sure I follow 100% but you can get Pulumi to import existing resources. Then you can manage them with Pulumi from then on. https://www.pulumi.com/blog/adopting-existing-cloud-resources-into-pulumi/
g
@ancient-megabyte-79588 not really, some parts are static and rest could be provided by Azure provider or as parameter to .get resource method, but it is more work for guys developing Pulumi Azure provider
a
@gray-lawyer-89054 The parameters can certainly be provided. I do something like this myself where I
pulumi.interpolate
a string from stack variables, but Pulumi still needs me to tell it what the unique identity string is. Pulumi doesn't know which resource in Azure I want to
.get()
.