Search code examples
azureterraformazure-rmhashicorp

azurerm_vpn_gateway_connection Unsupported attribute vpn_site_link_id


we are attempting to create an azurerm_vpn_gateway_connection using the documentation for it here https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/vpn_gateway_connection#bgp_enabled we are using

resource "azurerm_vpn_gateway_connection" "example" {
  name               = "example"
  vpn_gateway_id     = azurerm_vpn_gateway.example.id
  remote_vpn_site_id = azurerm_vpn_site.example.id

  vpn_link {
    name             = "link1"
    vpn_site_link_id = azurerm_vpn_site.example.vpn_site_link[0].id 
  }

  vpn_link {
    name             = "link2"
    vpn_site_link_id = azurerm_vpn_site.example.vpn_site_link[1].id 
  }
}

we are getting errors when running terraform plan

│ Error: Unsupported attribute
│
│   on main.tf line 95, in resource "azurerm_vpn_gateway_connection" "example":
│   95:     vpn_site_link_id = azurerm_vpn_site.example.vpn_site_link[0].id
│
│ This object has no argument, nested block, or exported attribute named "vpn_site_link".
╵

Solution

  • The issue is that azurerm_vpn_site does not have attribute vpn_site_link. I guess that maybe you wanted:

    vpn_site_link_id = azurerm_vpn_site.example.link[0].id
    

    Similarly for the second case.