Created
January 21, 2023 11:23
-
-
Save wparad/6932ff057544e5820d5ca1d7242b6ed4 to your computer and use it in GitHub Desktop.
ChatGPT says this is a GCP proxy using Cloud CDN, but I don't believe it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "google_compute_ssl_certificate" "proxy_cert" { | |
name = "proxy-cert" | |
domain = "new-domain.com" | |
cert_file = "cert.pem" | |
private_key_file = "key.pem" | |
} | |
resource "google_compute_target_https_proxy" "proxy" { | |
name = "proxy-target" | |
url_map = google_compute_url_map.proxy.self_link | |
ssl_certificates = [google_compute_ssl_certificate.proxy_cert.self_link] | |
} | |
resource "google_compute_url_map" "proxy" { | |
name = "proxy-map" | |
default_service = google_compute_backend_service.proxy.self_link | |
host_rule { | |
host = "new-domain.com" | |
path_matcher = "proxy-matcher" | |
} | |
path_matcher { | |
name = "proxy-matcher" | |
path_rule { | |
paths = ["/*"] | |
service = google_compute_backend_service.proxy.self_link | |
} | |
} | |
} | |
resource "google_compute_backend_service" "proxy" { | |
name = "proxy-service" | |
health_checks = [google_compute_http_health_check.proxy.self_link] | |
protocol = "HTTPS" | |
port_name = "https" | |
timeout_sec = 30 | |
load_balancing_scheme = "EXTERNAL" | |
backend { | |
group = google_compute_instance_group.proxy.self_link | |
} | |
} | |
resource "google_compute_http_health_check" "proxy" { | |
name = "proxy-health-check" | |
request_path = "/health" | |
port = 443 | |
} | |
resource "google_compute_instance_group" "proxy" { | |
name = "proxy-group" | |
zone = "us-central1-a" | |
} | |
resource "google_compute_forwarding_rule" "proxy" { | |
name = "proxy-forwarding-rule" | |
ip_address = "global" | |
ip_protocol = "TCP" | |
port_range = "443" | |
target = google_compute_target_https_proxy.proxy.self_link | |
load_balancing_scheme = "EXTERNAL" | |
} | |
resource "google_compute_cdn_url_map" "proxy" { | |
host = "new-domain.com" | |
origin = "https://hello.internal-domain.com" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment