首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法使用terraform通过资源azurerm_virtual_network_gateway_connection创建快速路由连接

无法使用terraform通过资源azurerm_virtual_network_gateway_connection创建快速路由连接
EN

Stack Overflow用户
提问于 2022-07-01 07:36:41
回答 1查看 143关注 0票数 0

你能告诉我这是窃听器还是我搞错了?我想创建一个带有新订阅的快速路由连接,如果我将通过Azure GUI控制台运行良好,但通过terraform (应用阶段)失败。在terraform计划中(成功地运行),我正确地看到了所有的输入值,但是我在下面得到了这个错误。有人知道发生了什么吗?

代码:

代码语言:javascript
复制
resource "azurerm_virtual_network_gateway_connection" "express_route_circuit_connection" {
  name                = "az-prd-euw-expressrouteconn-001"
  location            = azurerm_resource_group.resource_group.location
  resource_group_name = azurerm_resource_group.resource_group.name

  type                            = "ExpressRoute"
  virtual_network_gateway_id      = azurerm_virtual_network_gateway.disaster_recovery_virtual_network_gateway.id
  peer_virtual_network_gateway_id = data.azurerm_express_route_circuit.express_route_circuit.id
  authorization_key               = azurerm_express_route_circuit_authorization.marel-disasterrecovery.authorization_key
  routing_weight                  = 1
}

地形平面图阶段

代码语言:javascript
复制
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # module.disaster_recovery.azurerm_virtual_network_gateway_connection.express_route_circuit_connection will be created
  + resource "azurerm_virtual_network_gateway_connection" "express_route_circuit_connection" {
      + authorization_key                  = (sensitive value)
      + connection_mode                    = "Default"
      + connection_protocol                = (known after apply)
      + enable_bgp                         = (known after apply)
      + express_route_gateway_bypass       = (known after apply)
      + id                                 = (known after apply)
      + location                           = "westeurope"
      + name                               = "***********-expressrouteconn-001"
      + peer_virtual_network_gateway_id    = "/subscriptions/***********/resourceGroups/***********-rg-001/providers/Microsoft.Network/expressRouteCircuits/***********-001"
      + resource_group_name                = "***********-rg-001"
      + routing_weight                     = 1
      + type                               = "ExpressRoute"
      + use_policy_based_traffic_selectors = (known after apply)
      + virtual_network_gateway_id         = "/subscriptions/***********/resourceGroups/***********-rg-001/providers/Microsoft.Network/virtualNetworkGateways/***********-vgw-001"
    }

遵循错误消息:

代码语言:javascript
复制
module.disaster_recovery.azurerm_virtual_network_gateway_connection.express_route_circuit_connection: Creating...
╷
│ Error: ID was missing the `virtualNetworkGateways` element
│
│   with module.disaster_recovery.azurerm_virtual_network_gateway_connection.express_route_circuit_connection,
│   on modules/disaster-recovery/network.tf line 118, in resource "azurerm_virtual_network_gateway_connection" "express_route_circuit_connection":
│  118: resource "azurerm_virtual_network_gateway_connection" "express_route_circuit_connection" {
│

你能帮我解决这个奇怪的问题吗?我真的很感激你的帮助和时间

致以敬意,

EN

回答 1

Stack Overflow用户

发布于 2022-07-08 07:05:03

解决上述问题的方法之一,您可以遵循;

您使用的类型是ExpressRoute,在使用此类型时,需要传递而不是,因为当类型为Vnet2Vnet时使用。

例如:-

代码语言:javascript
复制
gateway_connection_type  = "ExpressRoute"
  express_route_circuit_id = var.express_route_circuit_id

欲知详情,请参阅以下连结:-

  • HashiCorp Terraform文档x .

@kumarvna.提供模块详细信息的

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72825870

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档