I am working on creating NAT gateway in azure using terraform. I have existing virtual network having subnets which the virtual machines. I would like to associate this existing subnet with my NAT gateway.
I have created a root module for my NAT gateway where I imported my existing virtual network configuration using terraform import
Terraform plan is successful but I am getting below error while executing terraform apply
Error: A resource with the ID "/subscriptions/22e07cbf-2803-48ed-8dec-7db32f9f6103/resourceGroups/iomsaas-euc-play/providers/Microsoft.Network/virtualNetworks/iomsaas-euc-play-vnet" already exists - to be managed via Terraform this resource needs to be imported into the State. Please see the resource documentation for "azurerm_virtual_network" for more information.
I am new to terraform. Can anyone assist here. Any helps will be appreciated. Thanks in advance.
Expected Result
1 Create a NAT Gateway 2 Attach it with a public IP 3 Attach it with an existing subnet which contains the VMs