provider "google" {
project = "seemscloud"
region = "europe-central2"
credentials = "/home/taw/.gcp-creds.json"
}
terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "5.3.0"
}
}
}
resource "google_compute_forwarding_rule" "http" {
name = "regional-http"
load_balancing_scheme = "INTERNAL_MANAGED"
ip_protocol = "TCP"
port_range = "80"
target = google_compute_region_target_http_proxy.default.id
ip_address = google_compute_address.http.address
network = "projects/seemscloud/global/networks/default"
subnetwork = "projects/seemscloud/regions/europe-central2/subnetworks/default"
network_tier = "PREMIUM"
}
resource "google_compute_forwarding_rule" "https" {
name = "regional-https"
load_balancing_scheme = "INTERNAL_MANAGED"
ip_protocol = "TCP"
port_range = "443"
target = google_compute_region_target_https_proxy.default.id
ip_address = google_compute_address.https.address
network = "projects/seemscloud/global/networks/default"
subnetwork = "projects/seemscloud/regions/europe-central2/subnetworks/default"
network_tier = "PREMIUM"
}
resource "google_compute_address" "http" {
name = "regional-http"
address_type = "INTERNAL"
subnetwork = "projects/seemscloud/regions/europe-central2/subnetworks/default"
}
resource "google_compute_address" "https" {
name = "regional-https"
address_type = "INTERNAL"
subnetwork = "projects/seemscloud/regions/europe-central2/subnetworks/default"
}
resource "google_compute_region_target_http_proxy" "default" {
name = "regional-thp"
url_map = google_compute_region_url_map.http.id
}
resource "google_compute_region_target_https_proxy" "default" {
name = "regional-https"
ssl_certificates = [
google_compute_region_ssl_certificate.default.self_link
]
url_map = google_compute_region_url_map.https.id
}
resource "google_compute_region_url_map" "http" {
name = "regional-http"
default_service = google_compute_region_backend_service.default.id
}
resource "google_compute_region_url_map" "https" {
name = "regional-https"
default_service = google_compute_region_backend_service.default.id
}
resource "google_compute_region_backend_service" "default" {
name = "regional-bs"
load_balancing_scheme = "INTERNAL_MANAGED"
backend {
group = "projects/seemscloud/zones/europe-central2-b/instanceGroups/http"
balancing_mode = "UTILIZATION"
capacity_scaler = 1.0
}
health_checks = [
google_compute_health_check.default.id
]
}
resource "google_compute_health_check" "default" {
name = "regional-hc"
http_health_check {
port = 80
request_path = "/"
}
}
resource "google_compute_region_ssl_certificate" "default" {
name = "regional-sc"
private_key = <<EOT
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCc+fzvnHU5+3rF
2mk150f/rJ9IrpFORVq5yRTXCMmq87baJVdi9k1jIVUUtB26ocZk05WoPIj0NWa/
Dnk14zKCvnjRaPxIaN4kVsUMfnRajhIwUkSTzVU5Ny7n8aBDKtiaPALKgrF7Jy/9
AmahDCkbPbNWrUBpGIL03nJvqGrg+z+i9mwKi4nM1+RB9Or8zwmhBBzJOADlzQNh
psp3K6cErDN2oO17tbdAqOy2lQM9jWXoxyyZ4rT9hBMJgBpQFD1lW5WJ3OdPu0+t
2FqBDPPaE7YcwqeEDtN0YxFGOTSKX6Ju/q/ZHvXHsknxRPn3sEWQVi7pYOe6WUzA
9JyuD7wbAgMBAAECggEASSI60lN9Vg8wyt8P51oidB6zcwRJlELBmw7w06I3eprj
FM0S4ntH4KhV4DhuJVZbfPwKnH/feo8qmFag6Bc6oCknVsDn0MByxlFaqpB7mvjX
xoV9h7LBQs/P3aX3+XMLyQeucTTkhTDjraehsuRcfmGHnRlIie4ujPDaNeUsLjaF
A4cz7PP0bLhE0XlIM5/GVbfasN++HCRhY9XnLBONDegYXpbN+Q8JCQ+4rJ8iptdi
TmGsSih4oKn+SMndujmmkidcght2iR8cAVH732DdPAq1SxOTINX/R6B9wSKeI3GT
+3jCjvJ3w7d7qDERjOcQiy6tDUuI4aChDG2LQ+kOyQKBgQC9viMSttvFBYnNQsxA
zaaRrFKK7UOKzz4pFqro56ZAXaBjU2NwuAQLqtranMIwtCtUsadvSatzD/WrjRvE
Cp7nSrsKVXnoAOjaKA4FSRI+iCIKxPVsFBwGs3lgspXEe7q1bNeR0PlVDm/QqAAG
b7neclziB+n/zYd+KMZWOe4V/QKBgQDTyr+VSmXQup8+++Namb2LBIwBHRsyfGP2
Ue6d8NuKeaBy5/YSr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