Commit 2aff231e authored by Daniele Valeriani's avatar Daniele Valeriani
Browse files

Finish configuring the load balancers

parent 76a026a9
...@@ -4,21 +4,19 @@ resource "google_compute_forwarding_rule" "fe_forwarding_rule_http" { ...@@ -4,21 +4,19 @@ resource "google_compute_forwarding_rule" "fe_forwarding_rule_http" {
region = "${var.region}" region = "${var.region}"
target = "${google_compute_target_pool.fe_lb_http_pool.self_link}" target = "${google_compute_target_pool.fe_lb_http_pool.self_link}"
load_balancing_scheme = "EXTERNAL" load_balancing_scheme = "EXTERNAL"
port_range = "80"
// ports = ["80"] ip_address = "${google_compute_address.fe_external_ip.address}"
// ip_address = "${google_compute_address.fe_external_ip.address}"
} }
resource "google_compute_target_pool" "fe_lb_http_pool" { resource "google_compute_target_pool" "fe_lb_http_pool" {
project = "${var.project}" project = "${var.project}"
name = "gitlab-frontend-http-pool" name = "gitlab-frontend-http-pool"
region = "${var.region}" region = "${var.region}"
session_affinity = "NONE" session_affinity = "NONE"
instances = ["${var.fe_http_instances}"] instances = ["${var.fe_http_instances}"]
health_checks = [ health_checks = [
"${google_compute_http_health_check.fe_lb_http_health_check.name}", "${google_compute_http_health_check.fe_lb_http_health_check.self_link}",
] ]
} }
......
...@@ -4,37 +4,18 @@ resource "google_compute_forwarding_rule" "fe_forwarding_rule_https" { ...@@ -4,37 +4,18 @@ resource "google_compute_forwarding_rule" "fe_forwarding_rule_https" {
region = "${var.region}" region = "${var.region}"
target = "${google_compute_target_pool.fe_lb_https_pool.self_link}" target = "${google_compute_target_pool.fe_lb_https_pool.self_link}"
load_balancing_scheme = "EXTERNAL" load_balancing_scheme = "EXTERNAL"
port_range = "443"
// ports = ["443"] ip_address = "${google_compute_address.fe_external_ip.address}"
// ip_address = "${google_compute_address.fe_external_ip.address}"
} }
resource "google_compute_target_pool" "fe_lb_https_pool" { resource "google_compute_target_pool" "fe_lb_https_pool" {
project = "${var.project}" project = "${var.project}"
name = "gitlab-frontend-https-pool" name = "gitlab-frontend-https-pool"
region = "${var.region}" region = "${var.region}"
session_affinity = "NONE" session_affinity = "NONE"
instances = ["${var.fe_https_instances}"] instances = ["${var.fe_https_instances}"]
/*
health_checks = [ health_checks = [
"${google_compute_https_health_check.fe_lb_https_health_check.name}", "${google_compute_http_health_check.fe_lb_http_health_check.self_link}",
] ]
*/
} }
/*
resource "google_compute_https_health_check" "fe_lb_https_health_check" {
project = "${var.project}"
name = "fe-lb-https-health-check"
host = "gitlab.com"
port = "443"
request_path = "/help"
timeout_sec = 2
check_interval_sec = 2
healthy_threshold = 2
unhealthy_threshold = 2
}
*/
...@@ -4,38 +4,18 @@ resource "google_compute_forwarding_rule" "fe_forwarding_rule_ssh" { ...@@ -4,38 +4,18 @@ resource "google_compute_forwarding_rule" "fe_forwarding_rule_ssh" {
region = "${var.region}" region = "${var.region}"
target = "${google_compute_target_pool.fe_lb_ssh_pool.self_link}" target = "${google_compute_target_pool.fe_lb_ssh_pool.self_link}"
load_balancing_scheme = "EXTERNAL" load_balancing_scheme = "EXTERNAL"
port_range = "22"
// ports = ["22"] ip_address = "${google_compute_address.fe_external_ip.address}"
// ip_address = "${google_compute_address.fe_external_ip.address}"
} }
resource "google_compute_target_pool" "fe_lb_ssh_pool" { resource "google_compute_target_pool" "fe_lb_ssh_pool" {
project = "${var.project}" project = "${var.project}"
name = "gitlab-frontend-ssh-pool" name = "gitlab-frontend-ssh-pool"
region = "${var.region}" region = "${var.region}"
session_affinity = "NONE" session_affinity = "NONE"
instances = ["${var.fe_ssh_instances}"] instances = ["${var.fe_ssh_instances}"]
/*
health_checks = [ health_checks = [
"${google_compute_health_check.fe_lb_ssh_health_check.name}", "${google_compute_http_health_check.fe_lb_http_health_check.self_link}",
] ]
*/
}
/*
resource "google_compute_health_check" "fe_lb_ssh_health_check" {
project = "${var.project}"
name = "fe-lb-ssh-health-check"
timeout_sec = 2
check_interval_sec = 2
healthy_threshold = 2
unhealthy_threshold = 2
tcp_health_check {
port = "22"
}
} }
*/
...@@ -14,9 +14,9 @@ variable "gitlab_net_zone_id" {} ...@@ -14,9 +14,9 @@ variable "gitlab_net_zone_id" {}
## Google ## Google
provider "google" { provider "google" {
credentials = "${file("../../private/google-credentials/${var.environment}.json")}" # credentials = "${file("../../private/google-credentials/${var.environment}.json")}"
project = "${var.project}" project = "${var.project}"
region = "${var.region}" region = "${var.region}"
} }
################################## ##################################
...@@ -413,9 +413,9 @@ module "google_load_balancers" { ...@@ -413,9 +413,9 @@ module "google_load_balancers" {
source = "./load-balancers" source = "./load-balancers"
project = "${var.project}" project = "${var.project}"
region = "${var.region}" region = "${var.region}"
fe_http_instances = "${module.external-lb.instances_self_link}" fe_http_instances = "${module.external-lb.instances_without_attached_disk_self_link}"
fe_https_instances = "${module.external-lb.instances_self_link}" fe_https_instances = "${module.external-lb.instances_without_attached_disk_self_link}"
fe_ssh_instances = "${module.external-lb.instances_self_link}" fe_ssh_instances = "${module.external-lb.instances_without_attached_disk_self_link}"
} }
################################## ##################################
......
output "instances_self_link" { output "instances_without_attached_disk_self_link" {
# value = "${length(google_compute_instance.instance_without_attached_disk.*.self_link) > 0 ? google_compute_instance.instance_without_attached_disk.*.self_link : google_compute_instance.instance_with_attached_disk.*.self_link}"
value = "${google_compute_instance.instance_without_attached_disk.*.self_link}" value = "${google_compute_instance.instance_without_attached_disk.*.self_link}"
} }
output "instances_with_attached_disk_self_link" {
value = "${google_compute_instance.instance_with_attached_disk.*.self_link}"
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment