【问题标题】:GCP SSL Proxy LoadBalancer via Terraform通过 Terraform 的 GCP SSL 代理负载平衡器
【发布时间】:2021-05-14 10:09:51
【问题描述】:

我们正在 GCP 上为我们的应用程序创建基础架构,该应用程序在 GCP 上使用 SSL Porxy 负载均衡器。我们使用 Terraform 进行部署,并且正在努力通过 terraform 创建 SSL 代理负载均衡器。

如果有人可以指向示例代码或指向我可以找到一些资源来创建负载均衡器的方向

【问题讨论】:

  • Stackoverflow 上有很多 Terraform 专家。然而,如果你没有努力明确你的问题,展示你的工作和你遇到的问题,……花时间在你的问题和解决问题上。这是一个帮助链接:stackoverflow.com/help/how-to-ask

标签: google-cloud-platform terraform load-balancing


【解决方案1】:

你可以试试下面的example:

resource "google_compute_target_ssl_proxy" "default" {
  name             = "test-proxy"
  backend_service  = google_compute_backend_service.default.id
  ssl_certificates = [google_compute_ssl_certificate.default.id]
}

resource "google_compute_ssl_certificate" "default" {
  name        = "default-cert"
  private_key = file("path/to/private.key")
  certificate = file("path/to/certificate.crt")
}

resource "google_compute_backend_service" "default" {
  name          = "backend-service"
  protocol      = "SSL"
  health_checks = [google_compute_health_check.default.id]
}

resource "google_compute_health_check" "default" {
  name               = "health-check"
  check_interval_sec = 1
  timeout_sec        = 1
  tcp_health_check {
    port = "443"
  }
}

考虑到Health Check 指向端口443/tcp,如果您想要不同的端口,请在此处更改。

【讨论】:

    猜你喜欢
    • 2022-01-10
    • 2011-09-20
    • 2020-05-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-03
    • 1970-01-01
    相关资源
    最近更新 更多