rough-pilot-49913
11/16/2023, 3:26 PMpulumi 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:
{
"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
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?