使用 Terraform 使用自签名证书部署应用程序网关
Deploy Application Gateway with self-signed certificate with Terraform
我有一个 Terraform 部署,它在 Azure 中部署一个应用程序网关来控制流向托管应用程序的应用程序服务环境的流量。目前,部署创建了一个使用端口 80/HTTP 的侦听器,但现在我已经按照我的意愿进行了所有工作,我想修改部署以在 App Gateway 处执行 SSL 终止。我创建了一个用于测试目的的自签名证书,并将该证书加载到 Azure Key Vault 中。我现在正试图弄清楚如何修改我的部署以使用证书。我唯一能找到的是需要将 ssl_certificate_name
属性 添加到侦听器,但我知道还有更多。我如何告诉 Terraform "where" 证书是什么?
不幸的是,应用程序网关不支持直接从存储在密钥保管库中的证书获取引用,您可以投票给 support SSL certificates stored in Key Vault secrets for listeners and backend HTTP settings on Application Gateway。
从此document, a http_listener
block only supports reference a certificate via ssl_certificate_name
, so you could reference the certificate from the name
and data
attribute in ssl_certificate
block. In this block, the data
requires the contents of the Authentication Certificate which should be used. Also, you could use a built-in function file阅读证书base64encode
内容。例如读取一个文件:${file("path.txt")}
.
ssl_certificate {
name = "default"
data = "${base64encode(file("mycert.pfx"))}"
password = "XXXXXXX"
}
和
http_listener {
name = "https"
frontend_ip_configuration_name = "default"
frontend_port_name = "https"
protocol = "Https"
ssl_certificate_name = "default"
}
您可以获得更多关于 and Azure Application Gateway with end-to-end SSL 的场景。
我有一个 Terraform 部署,它在 Azure 中部署一个应用程序网关来控制流向托管应用程序的应用程序服务环境的流量。目前,部署创建了一个使用端口 80/HTTP 的侦听器,但现在我已经按照我的意愿进行了所有工作,我想修改部署以在 App Gateway 处执行 SSL 终止。我创建了一个用于测试目的的自签名证书,并将该证书加载到 Azure Key Vault 中。我现在正试图弄清楚如何修改我的部署以使用证书。我唯一能找到的是需要将 ssl_certificate_name
属性 添加到侦听器,但我知道还有更多。我如何告诉 Terraform "where" 证书是什么?
不幸的是,应用程序网关不支持直接从存储在密钥保管库中的证书获取引用,您可以投票给 support SSL certificates stored in Key Vault secrets for listeners and backend HTTP settings on Application Gateway。
从此document, a http_listener
block only supports reference a certificate via ssl_certificate_name
, so you could reference the certificate from the name
and data
attribute in ssl_certificate
block. In this block, the data
requires the contents of the Authentication Certificate which should be used. Also, you could use a built-in function file阅读证书base64encode
内容。例如读取一个文件:${file("path.txt")}
.
ssl_certificate {
name = "default"
data = "${base64encode(file("mycert.pfx"))}"
password = "XXXXXXX"
}
和
http_listener {
name = "https"
frontend_ip_configuration_name = "default"
frontend_port_name = "https"
protocol = "Https"
ssl_certificate_name = "default"
}
您可以获得更多关于