【问题标题】:Deploy Application Gateway with self-signed certificate with Terraform使用 Terraform 部署具有自签名证书的应用程序网关
【发布时间】:2019-06-14 07:16:09
【问题描述】:

我有一个 Terraform 部署,它在 Azure 中部署了一个应用程序网关,以控制到托管应用程序的应用程序服务环境的流量。目前,部署创建了一个使用端口 80/HTTP 的侦听器,但现在我的一切都按我想要的方式工作,我想修改部署以在应用程序网关处执行 SSL 终止。我为测试目的创建了一个自签名证书,并将证书加载到 Azure Key Vault 中。我现在正试图弄清楚如何修改我的部署以使用证书。我唯一能找到的是需要将ssl_certificate_name 属性添加到侦听器,但我知道还有更多。如何告诉 Terraform 证书在“哪里”?

【问题讨论】:

  • 你可以在部署时从kv中拉取值,不确定crappyform是否可以做到这一点,arm模板可以

标签: azure terraform-provider-azure


【解决方案1】:

很遗憾,应用程序网关不支持直接从存储在密钥库中的证书获取引用,您可以投票给support SSL certificates stored in Key Vault secrets for listeners and backend HTTP settings on Application Gateway

从此documenthttp_listener 块仅支持通过ssl_certificate_name 引用证书,因此您可以从ssl_certificate 块中的namedata 属性引用证书。在此块中,data 需要应使用的身份验证证书的内容。此外,您可以使用内置函数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"
  }

您可以获得更多关于attaching SSL certificate to Azure application gateway in TerraformAzure Application Gateway with end-to-end SSL 的场景。

【讨论】:

  • 感谢您的信息,这非常有帮助。除非我遗漏了什么,否则 Application Gateway 的 Terraform 文档中没有 ssl_certificate 块的文档。
  • 我也注意到了这一点,但我发现人们总是使用那个块。您可以在示例场景中阅读它。我认为这应该是与应用程序网关中的authentication_certificate 块相同的实用程序,但添加了额外的password 参数。
猜你喜欢
  • 1970-01-01
  • 2018-06-10
  • 1970-01-01
  • 1970-01-01
  • 2021-10-23
  • 2023-03-21
  • 1970-01-01
  • 2014-03-19
  • 1970-01-01
相关资源
最近更新 更多