-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for INTERNAL_SELF_MANAGED backend service and global forw…
…arding rule
- Loading branch information
Showing
3 changed files
with
74 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
59 changes: 59 additions & 0 deletions
59
templates/terraform/examples/global_forwarding_rule_internal.tf.erb
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
resource "google_compute_global_forwarding_rule" "default" { | ||
provider = "google-beta" | ||
name = "<%= ctx[:vars]['forwarding_rule_name'] %>" | ||
target = "${google_compute_target_http_proxy.default.self_link}" | ||
port_range = "80" | ||
load_balancing_scheme = "INTERNAL_SELF_MANAGED" | ||
ip_address = "0.0.0.0" | ||
} | ||
|
||
resource "google_compute_target_http_proxy" "default" { | ||
provider = "google-beta" | ||
name = "<%= ctx[:vars]['http_proxy_name'] %>" | ||
description = "a description" | ||
url_map = "${google_compute_url_map.default.self_link}" | ||
} | ||
|
||
resource "google_compute_url_map" "default" { | ||
provider = "google-beta" | ||
name = "url-map-<%= ctx[:vars]['http_proxy_name'] %>" | ||
description = "a description" | ||
default_service = "${google_compute_backend_service.default.self_link}" | ||
|
||
host_rule { | ||
hosts = ["mysite.com"] | ||
path_matcher = "allpaths" | ||
} | ||
|
||
path_matcher { | ||
name = "allpaths" | ||
default_service = "${google_compute_backend_service.default.self_link}" | ||
|
||
path_rule { | ||
paths = ["/*"] | ||
service = "${google_compute_backend_service.default.self_link}" | ||
} | ||
} | ||
} | ||
|
||
resource "google_compute_backend_service" "default" { | ||
provider = "google-beta" | ||
name = "<%= ctx[:vars]['backend_service_name'] %>" | ||
port_name = "http" | ||
protocol = "HTTP" | ||
timeout_sec = 10 | ||
load_balancing_scheme = "INTERNAL_SELF_MANAGED" | ||
|
||
health_checks = ["${google_compute_health_check.default.self_link}"] | ||
} | ||
|
||
resource "google_compute_health_check" "default" { | ||
provider = "google-beta" | ||
name = "check-<%= ctx[:vars]['backend_service_name'] %>" | ||
check_interval_sec = 1 | ||
timeout_sec = 1 | ||
|
||
tcp_health_check { | ||
port = "80" | ||
} | ||
} |