我正在努力通过 terraform 代码创建 GCP SSL 代理网络负载平衡器。 我已经通过 terraform 创建了应用程序 (HTTPS) 和网络 TCP 负载平衡器。但是我找不到用于 SSL 代理前端和后端创建的正确 terraform 资源。
我尝试了多个应用程序和网络负载均衡器资源,但没有用。
我可以通过 GCP gui 创建它。如果有人可以指导我找到正确的 terraform 资源。
我尝试了以下建议的代码,但我不知道是使用前端 IP 和端口。而在后端,应该是实例组。
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"
}
}