terraform 0.12 application gateway ssl certificate issue

Viewed 99

We are trying to upgrade terraform 0.11 to 0.12, and there is an application gateway ssl certificate issue. It works fine when use like below by 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}"
  } 

After upgarde to terraform 0.12.31 and terragrunt 0.19.0 It appears error: Call to function "file" failed: contents of certificates/helm_mbw_pfx_file.pfx are not valid UTF-8; use the filebase64 function to obtain the Base64 encoded contents or the other file functions (e.g. filemd5, filesha256) to obtain file hashing results instead

How should I update the data field? Thanks.

1 Answers

As per the error you can try using below:

  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}"
  } 

Instead of

  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}"
  } 
Related