Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_network_connection_monitor failed to create with properties source and destination in API version 2020-03-01 #7309

Closed
neil-yechenwei opened this issue Jun 12, 2020 · 2 comments · Fixed by #8640

Comments

@neil-yechenwei
Copy link
Contributor

neil-yechenwei commented Jun 12, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform (and AzureRM Provider) Version

Terraform v0.12.26
provider.azurerm v2.14.0

Affected Resource(s)

  • azurerm_network_connection_monitor

Terraform Configuration Files

provider "azurerm" {
  features {}
  version = "2.14.0"
}

resource "azurerm_resource_group" "test" {
  name     = "acctestRG-watcher-test01"
  location = "northeurope"
}

resource "azurerm_network_watcher" "test" {
  name                = "acctnw-test01"
  location            = azurerm_resource_group.test.location
  resource_group_name = azurerm_resource_group.test.name
}

resource "azurerm_virtual_network" "test" {
  name                = "acctvn-test01"
  address_space       = ["10.0.0.0/16"]
  location            = azurerm_resource_group.test.location
  resource_group_name = azurerm_resource_group.test.name
}

resource "azurerm_subnet" "test" {
  name                 = "internalsubnet"
  resource_group_name  = azurerm_resource_group.test.name
  virtual_network_name = azurerm_virtual_network.test.name
  address_prefix       = "10.0.2.0/24"
}

resource "azurerm_network_interface" "src" {
  name                = "acctni-srctest01"
  location            = azurerm_resource_group.test.location
  resource_group_name = azurerm_resource_group.test.name

  ip_configuration {
    name                          = "testconfiguration1"
    subnet_id                     = azurerm_subnet.test.id
    private_ip_address_allocation = "Dynamic"
  }
}

resource "azurerm_virtual_machine" "src" {
  name                  = "acctvm-srctest01"
  location              = azurerm_resource_group.test.location
  resource_group_name   = azurerm_resource_group.test.name
  network_interface_ids = [azurerm_network_interface.src.id]
  vm_size               = "Standard_D2s_v3"

  storage_image_reference {
    publisher = "Canonical"
    offer     = "UbuntuServer"
    sku       = "16.04-LTS"
    version   = "latest"
  }

  storage_os_disk {
    name              = "osdisk-srctest01"
    caching           = "ReadWrite"
    create_option     = "FromImage"
    managed_disk_type = "Standard_LRS"
  }

  os_profile {
    computer_name  = "hostnametest01"
    admin_username = "admintest"
    admin_password = "Password1357!"
  }

  os_profile_linux_config {
    disable_password_authentication = false
  }
}

resource "azurerm_virtual_machine_extension" "src" {
  name                       = "network-watcher01"
  virtual_machine_id         = azurerm_virtual_machine.src.id
  publisher                  = "Microsoft.Azure.NetworkWatcher"
  type                       = "NetworkWatcherAgentLinux"
  type_handler_version       = "1.4"
  auto_upgrade_minor_version = true
}

resource "azurerm_network_connection_monitor" "test" {
  name                 = "acctestcm-test01"
  network_watcher_name = azurerm_network_watcher.test.name
  resource_group_name  = azurerm_resource_group.test.name
  location             = azurerm_network_watcher.test.location

  source {
    virtual_machine_id = azurerm_virtual_machine.src.id
  }

  destination {
    address = "terraform.io"
    port    = 80
  }

  depends_on = [azurerm_virtual_machine_extension.src]
}

Debug Output

Panic Output

Expected Behavior

azurerm_network_connection_monitor should create sucessfully.

Actual Behavior

azurerm_network_connection_monitor failed to create with properties source and destination in API version 2020-03-01 and threw below error message. After do more testing, it works fine with previous api version.

Error: Error creating Connection Monitor "acctestcm-test01" (Watcher "acctnw-test01" / Resource Group "acctestRG-watcher-test01"): network.ConnectionMonitorsClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="IncorrectAPIVersionToCreateSingleSourceDestinationConnectionMonitor" Message="Cannot create single-source-destination connection monitor /subscriptions//resourceGroups//providers/Microsoft.Network/networkWatchers//connectionMonitors/ using this api version 2020-03-01. Supported version is 2019-06-01 or lower." Details=[]

Steps to Reproduce

  1. terraform apply

Important Factoids

References

  • #0000
@ghost
Copy link

ghost commented Nov 12, 2020

This has been released in version 2.36.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.36.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Dec 11, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Dec 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.