Error: Error creating TargetPool: googleapi: Error 400: Invalid value for field 'resource': '{ "name": "primary-pool", "healthCheck": ["projects/workspace/global/httpHealthChecks...'. 'backupPool' and 'failoverRatio' must be either both set or both unset., invalid
Terraform code:
resource "google_compute_forwarding_rule" "default" {
name = "frontend"
target = google_compute_target_pool.primary_pool.id
port_range = "80"
load_balancing_scheme = "EXTERNAL"
ip_protocol = "TCP"
}
resource "google_compute_target_pool" "standby_pool" {
name = "standby-pool"
instances = [
"us-central1-b/standby",
]
health_checks = [
google_compute_http_health_check.default.name,
]
}
resource "google_compute_target_pool" "primary_pool" {
name = "primary-pool"
instances = [
"us-central1-a/primary"
]
backup_pool = google_compute_target_pool.standby_pool.self_link
failover_ratio = 0
health_checks = [
google_compute_http_health_check.default.name,
]
depends_on = [google_compute_target_pool.standby_pool]
}
resource "google_compute_http_health_check" "default" {
name = "default"
request_path = "/"
check_interval_sec = 60
timeout_sec = 5
}
I’ve set both backup_pool and failover_ratio but still it throws error what could be the reason?