Hello guys, I made a code to create a VM in Azure ...
# azure
m
Hello guys, I made a code to create a VM in Azure with the following order First I create the rule to connect to the RDP or SSH Then I create the public IP that will be associated with the VM's NIC Then I create that NIC and associate that IP Finally I create the VM with the components, it is created, there is no error in the creation, but when I want to execute the pulumi destroy command, this error appears can help me with this?
Copy code
azure-native:network:NetworkInterface (NIC-VMWindows1-063-100-160):
     error: Code="NicInUse" Message="Network Interface /subscriptions/8e23e0ca-e424-495e-b142-813621dbb51f/resourceGroups/rg-archie-nonprod-eaus2/providers/Microsoft.Network/networkInterfaces/NIC-VMWindows1-063-100 -160 is used by existing resource /subscriptions/8e23e0ca-e424-495e-b142-813621dbb51f/resourceGroups/rg-archie-nonprod-eaus2/providers/Microsoft.Compute/virtualMachines/VMWindows1-063-archie-nonprod-eaus2-160- 4. In order to delete the network interface, it must be dissociated from the resource. To learn more, see <http://aka.ms/deletenic|aka.ms/deletenic>." Details=[]
b
you will need resource options. if Azure deletes the nic when you delete the VM, then you can just use
deletedWith
. This will not call explicit deletion on the NIC, just assumes it is deleted when you delete the VM. But I';m not sure how Azure currently handles associated resources. https://www.pulumi.com/docs/concepts/options/
Or you can try putting in Dependencies (which honestly already should be there since you use the NIC in the VM, but not sure what happens). https://www.pulumi.com/docs/concepts/options/dependson/
m
where is deleWith??