首页 > 解决方案 > terraform 0.12 应用程序网关 ssl 证书问题

问题描述

我们正在尝试将 terraform 0.11 升级到 0.12,并且存在应用程序网关 ssl 证书问题。当 terraform 0.11 如下使用时,它可以正常工作:

  ssl_certificate {
    name     = "helm-mbw-int.mercedes-benz.com.cn"
    data     = "${base64encode(file("certificates/${var.helm_mbw_pfx_file}"))}"
    password = "${var.helm_mbw_ssl_certificate_password}"
  } 

升级到 terraform 0.12.31 和 terragrunt 0.19.0 后出现错误:调用函数“文件”失败:证书/helm_mbw_pfx_file.pfx 的内容不是有效的 UTF-8;使用 filebase64 函数来获取 Base64 编码的内容或其他文件函数(例如 filemd5、filesha256)来获取文件哈希结果

我应该如何更新数据字段?谢谢。

标签: terraform-provider-azureazure-application-gateway

解决方案


根据错误,您可以尝试使用以下方法:

  ssl_certificate {
    name     = "helm-mbw-int.mercedes-benz.com.cn"
    data = "${filebase64("certificates/${var.helm_mbw_pfx_file}")}"
    password = "${var.helm_mbw_ssl_certificate_password}"
  } 

代替

  ssl_certificate {
    name     = "helm-mbw-int.mercedes-benz.com.cn"
    data     = "${base64encode(file("certificates/${var.helm_mbw_pfx_file}"))}"
    password = "${var.helm_mbw_ssl_certificate_password}"
  } 

推荐阅读