terraform-provider-azurerm
terraform-provider-azurerm copied to clipboard
azurerm_virtual_hub_bgp_connection fails and expects existing provisioned HubVirtualNetworkConnection
Is there an existing issue for this?
- [X] I have searched the existing issues
Community Note
- Please vote on this issue by adding a :thumbsup: 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 Version
1.1.5
AzureRM Provider Version
3.16.0
Affected Resource(s)/Data Source(s)
azurerm_virtual_hub_bgp_connection
Terraform Configuration Files
I took examples straight from the terraform Azure provider docs and modified slightly.
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_hub_bgp_connection
As a result, this is my bgp connection block...
resource "azurerm_virtual_hub_bgp_connection" "example" {
name = "example"
virtual_hub_id = azurerm_virtual_hub.vHub.id
peer_asn = 65530
peer_ip = "10.1.1.250"
}
Debug Output/Panic Output
Error: creating/updating Bgp Connection: (Name "example / Virtual Hub Name "giroux123-vHub-dd6a" / Resource Group "giroux123-rg-nva-dd6a"): network.VirtualHubBgpConnectionClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="HubBgpConnectionMustReferenceFullyProvisionedHubVirtualNetworkConnection" Message="HubBgpConnection /subscriptions/xxxx-xxxx-xxxx-xxxx-xxxx/resourceGroups/giroux123-rg-nva-dd6a/providers/Microsoft.Network/virtualHubs/giroux123-vHub-dd6a/bgpConnections/bigip-1 must reference existing provisioned HubVirtualNetworkConnection." Details=[]
│
│ with azurerm_virtual_hub_bgp_connection.example,
│ on main.tf line 272, in resource "azurerm_virtual_hub_bgp_connection" "example":
│ 272: resource "azurerm_virtual_hub_bgp_connection" "example" {
Expected Behaviour
BGP connection should successfully create based on provided input parameters of code block.
Actual Behaviour
"must reference existing provisioned HubVirtualNetworkConnection"
It appears that the BGP connection is looking for an existing hub connection...to which I do indeed have an existing hub connection. I created it with the below command block...
resource "azurerm_virtual_hub_connection" "nva" {
name = format("%s-nva-%s", var.prefix, random_id.buildSuffix.hex)
virtual_hub_id = azurerm_virtual_hub.vHub.id
remote_virtual_network_id = module.network["nva"].vnet_id
}
However, terraform apply fails with the error provided about requiring an existing hub connection. From a quick glance, the resource azurerm_virtual_hub_connection seems to require the ID of an existing virtual network connection. But yet, there is not an option to provide such parameter value.
Note: workaround, I can easily go into the portal and create a BGP connection by clicking around the UI. One of the dropdowns is indeed the "Virtual Network Connection" parameter as shown in the Azure docs link here - https://docs.microsoft.com/en-us/azure/virtual-wan/create-bgp-peering-hub-portal.
Steps to Reproduce
Use example bgp connection resource from the Azure terraform examples. https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_hub_bgp_connection
Important Factoids
No response
References
No response
I opened an Azure support ticket too, send them the failed terraform error when trying to add a BGP peer. Then support came back and said it's a terraform problem.
Can you please tell me why the "virtual network connection" is missing from the terraform resource block? We need that added in order to get past the BGP peer adding error.
From support... I have engaged further resources to check your issue as well, and we found that at this point, this is a Terraform script/code related problem ( you need to check why there’s no option to provide the Hub Virtual network connection details, hence the insights need to come from Github/Terraform team, as it's clearly not an issue in the vWAN service/product.
@JeffGiroux thanks for opening this issue here. PR for resource azurerm_virtual_hub_bgp_connection to support virtual_network_connection_id has been submitted. Could you track it for updates?
I see it and will watch. Thx.
This functionality has been released in v3.25.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.
For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!
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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.