Hello everyone, I have some existing resources on ...
# azure
r
Hello everyone, I have some existing resources on Azure cloud, and I need to discover them and run a
pulumi import
to retrieve a main.py file. I've already discovered these resources using the Azure library for Python and created a file like this:
Copy code
{
  "resources": [
    {
      "name": ...,
      "type": ...,
      "id": ...
    },
    {
      "name": ...,
      "type": ...,
      "id": ...
    },
    ...
  ]
}
After running
pulumi import -f file.json -o __main__.py
, I destroy my resources on the cloud and try
pulumi up
with the generated script. However, I encounter errors because the deployment of resources doesn't follow the correct dependencies between resources. For instance, a VM with a network card is deployed before the network card. The dependency ID is a string like
Copy code
vm= azure_native.compute.VirtualMachine("vm_name",
    .....,
    network_profile=azure_native.compute.NetworkProfileArgs(
        network_interfaces=[azure_native.compute.NetworkInterfaceReferenceArgs(
            id="/subscriptions/..../resourceGroups/...../providers/Microsoft.Network/networkInterfaces/netinterf_name",
....
but I need
nameOfResource.id
to make the dependency understandable to Pulumi. Does anyone know how to automate this process?