I'm using the terraform azurerm provider 2.0.0 and I'm trying to learn how everything works. I have a bunch of existing azure resources including a bunch of Windows VMs in a Resource Group. It appears that I have to manually import each of them one at a time using the
terraform import azurerm_wndows_virtual_machine.<myvmname> /subscriptions/<mysub>/resourceGroups/<myrg>/providers/Microsoft.Compute/virtualMachines/<myvmname>
command.
However, when I try to do this I get
Error: The "azurerm_windows_virtual_machine" resource doesn't support attaching OS Disks - please use the `azurerm_virtual_machine` resource instead
My understanding is that I need to put the imported resource in the terraform file as an empty element in order for terraform to connect the imported item with an item in the file.
My terraform script looks like this
# Configure the Azure provider
provider "azurerm" {
version = "=2.0.0"
subscription_id = "00000000-0000-0000-0000-000000000000"
tenant_id = "00000000-0000-0000-0000-000000000000"
}
resource "azurerm_resource_group" "myrg" {
}
resource "azurerm_windows_virtual_machine" "myvmname" {
}
What am I doing wrong?