I am starting to code in Terraform for Azure. Currently I am not admin of the Azure Portal with which I work with and we have this pre-defined by the admins Resource group and Virtual networks that absolutely need to be used when we deploy a infrastructure.
My problem now is that I want to create something as simple as a VM using those configurations using Terraform. I was almost able to create all of this in a different Resource group copying the properties of that resource group and as well by creating a copy Virtual network using Terraform import.
So now, I absolutely need to find a way to configure my Virtual Machine and so on using the Virtual Network created by my Admins. I have imported to my terraform.tfstate , rg, virtual network, subnet and network interface and when I do this using these resource group and VIrutal network already pre-prepared for us the Terraform Apply fails with the following error.
I dont understand why its destroying the virtual network interface
azurerm_network_interface.vni-014229-VNET-PCC-DEV: Destroying… [id=/subscriptions/443fdeaf-65b5-4c03-ad94-a37cb063b1bd/resourceGroups/014229-VNET-PCC-DEV/providers/Microsoft.Network/virtualNetworks/014229-VNET-PCC-DEV]
Error: Error retrieving Network Interface “” (Resource Group “014229-VNET-PCC-DEV”):
properties was nil
Is there any way that I can simply Deploy a VM and simply copy all configurations already that already exist there.
Thank you advance,