2019-06-06 07:33:01 -07:00
|
|
|
# External and internal static IPs
|
2019-01-16 10:22:44 -08:00
|
|
|
resource "google_compute_address" "blc" {
|
2019-03-07 12:29:43 -08:00
|
|
|
name = "${var.name}-${var.net}-external-ip-${var.env}-${count.index}"
|
2019-05-31 07:23:30 -07:00
|
|
|
project = var.project
|
|
|
|
region = var.region
|
|
|
|
count = var.create_resources
|
2019-01-16 10:22:44 -08:00
|
|
|
}
|
|
|
|
|
2019-06-06 07:33:01 -07:00
|
|
|
resource "google_compute_address" "blc-internal" {
|
|
|
|
name = "${var.name}-${var.net}-internal-ip-${var.env}-${count.index}"
|
|
|
|
address_type = "INTERNAL"
|
|
|
|
project = var.project
|
|
|
|
region = var.region
|
|
|
|
count = var.create_resources
|
|
|
|
}
|
|
|
|
|
2019-01-16 10:22:44 -08:00
|
|
|
# Backend service
|
|
|
|
resource "google_compute_backend_service" "blc" {
|
2019-03-07 12:29:43 -08:00
|
|
|
name = "${var.name}-${var.net}-backend-service-${var.env}"
|
2019-01-16 10:22:44 -08:00
|
|
|
description = "Satellite API"
|
|
|
|
protocol = "HTTP"
|
|
|
|
port_name = "http"
|
2019-05-31 07:23:30 -07:00
|
|
|
timeout_sec = var.timeout
|
2019-06-06 07:33:01 -07:00
|
|
|
project = var.project
|
2019-05-31 07:23:30 -07:00
|
|
|
count = var.create_resources
|
2019-01-16 10:22:44 -08:00
|
|
|
|
|
|
|
backend {
|
2019-05-31 07:23:30 -07:00
|
|
|
group = google_compute_instance_group_manager.blc[0].instance_group
|
2019-01-16 10:22:44 -08:00
|
|
|
}
|
|
|
|
|
2019-05-31 07:23:30 -07:00
|
|
|
health_checks = [google_compute_health_check.blc[0].self_link]
|
2019-01-16 10:22:44 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
# Health checks
|
|
|
|
resource "google_compute_health_check" "blc" {
|
2019-03-07 12:29:43 -08:00
|
|
|
name = "${var.name}-${var.net}-health-check-${var.env}"
|
2019-05-31 07:23:30 -07:00
|
|
|
count = var.create_resources
|
2019-01-16 10:22:44 -08:00
|
|
|
|
|
|
|
check_interval_sec = 5
|
|
|
|
timeout_sec = 3
|
|
|
|
|
|
|
|
tcp_health_check {
|
|
|
|
port = "80"
|
|
|
|
}
|
|
|
|
}
|
2019-05-31 07:23:30 -07:00
|
|
|
|