You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在Terraform中为Azure VPN添加OpenSSL隧道类型需指定哪个参数?

解决方法

你提到的「OpenSSL」应为OpenVPN(Azure点到站点VPN不支持OpenSSL作为隧道类型),要配置该隧道类型,需在vpn_client_configuration块中添加vpn_protocols参数,指定值为["OpenVPN"]。

修改后的完整代码如下:

resource "azurerm_virtual_network_gateway" "vpn-gw" {
  name                = "test"
  location            = azurerm_resource_group.rg[0].location
  resource_group_name = azurerm_resource_group.rg[0].name
  type                = "Vpn"
  vpn_type            = "RouteBased"
  active_active       = true
  enable_bgp          = false
  sku                 = "VpnGw1AZ"

  ip_configuration {
    name                          = "vnetGatewayConfig"
    public_ip_address_id          = azurerm_public_ip.vpn-gateway-ip.id    
    private_ip_address_allocation = "Dynamic"
    subnet_id                     = data.azurerm_subnet.gatewaysubnetdata.id
  }

  ip_configuration {
    name                          = "vnetGatewayConfig1"
    public_ip_address_id          = azurerm_public_ip.vpn-gateway-ip-secondary.id
    private_ip_address_allocation = "Dynamic"
    subnet_id                     = data.azurerm_subnet.gatewaysubnetdata.id
  }

  ip_configuration {
    name                          = "vnetGatewayConfig2"
    public_ip_address_id          = azurerm_public_ip.vpn-gateway-ip-vpn.id
    private_ip_address_allocation = "Dynamic"
    subnet_id                     = data.azurerm_subnet.gatewaysubnetdata.id
  }

  vpn_client_configuration {
    address_space      = ["xx.xxx.x.x/xx"]
    vpn_auth_types     = ["AAD"]
    aad_tenant         = "https://login.microsoftonline.com/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    aad_audience       = "41b23e61-6c1e-4545-b367-cd054e0ed4b4"
    aad_issuer         = "https://sts.windows.net/xxxxxxxxxxxxxxxxxxxxxxxx/"
    # 指定OpenVPN隧道类型
    vpn_protocols      = ["OpenVPN"]
  }
}

相关Terraform资源文档翻译

vpn_client_configuration块参数说明

  • vpn_protocols -(可选)用于点到站点连接的VPN协议(隧道类型)列表。可选值为IKEv2、OpenVPN、SSTP。若未指定,默认会启用IKEv2和SSTP(具体取决于网关SKU支持情况)。

内容的提问来源于stack exchange,提问作者asp

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.20 02:25:17