首页 > 解决方案 > 无法在 terraform 中为 FrontDoor 设置最低 TLS 版本

问题描述

我正在使用 terraform 1.44。当我尝试运行它时:

resource "azurerm_frontdoor" "frontdoor" {
  name                                         = "my-fd"
  location                                     = "${azurerm_resource_group.default.location}"
  resource_group_name                          = "${azurerm_resource_group.default.name}"
  enforce_backend_pools_certificate_name_check = false

  routing_rule {
    .....
  }

  backend_pool_load_balancing {
    ......
  }

  backend_pool_health_probe {
    .....
  }

  backend_pool {
    .......
  }

  frontend_endpoint {
    name                                    = "myFrontendEndpoint"
    host_name                               = "my-custom.hostname.com"
    custom_https_provisioning_enabled       = true
    custom_https_configuration {
      certificate_source = "FrontDoor"
      minimum_tls_version = "1.2"
    }
  }
}

它失败了

错误:“frontend_endpoint.custom_https_configuration.minimum_tls_version”:无法设置此字段

根据this GitHub issue它应该已经解决了,但是文档链接被破坏了......并且在当前文档中没有提到这个领域......

我怎样才能创建这个前端?没有设置minimum_tls_version它的错误

为前端端点启用自定义域 HTTPS 时出错:frontdoor.FrontendEndpointsClient#EnableHTTPS:发送请求失败:StatusCode=400 -- 原始错误:Code="BadRequest" Message="\"minimumTlsVersion\" 是必需参数。"

标签: azureterraformtls1.2azure-front-door

解决方案


Azure 前门 SSL 配置

2019 年 9 月之后创建的所有 Front Door 配置文件都使用 TLS 1.2 作为默认最小值。

Front Door 支持 TLS 版本 1.0、1.1 和 1.2。尚不支持 TLS 1.3。

terraform 文档中,该属性minimum_tls_version只能从custom_https_configuration块中导出。它不能像参数引用一样设置。

例如,

....
      frontend_endpoint {
        name                              = "exampleFrontendEndpoint1"
        host_name                         = "example-FrontDoor.azurefd.net"

        custom_https_provisioning_enabled       = true
        custom_https_configuration {
          certificate_source = "FrontDoor"

      }
      }
    }

    output "minimum_tls_version" {
      value = "${azurerm_frontdoor.example.frontend_endpoint[0].custom_https_configuration[0].minimum_tls_version}"
    }

在此处输入图像描述


推荐阅读