我正在通过Terraform创建GCP实例组。首先,我使用以下内容创建健康检查:
resource "google_compute_health_check" "http_8080" {
name = "http-8080"
check_interval_sec = 10
timeout_sec = 10
healthy_threshold = 3
unhealthy_threshold = 10 # 50 seconds
http_health_check {
request_path = "/"
port = "8080"
}
}
此后,我有了实例组代码,在其中定义了“ auto_healing_policies”,并附加了健康检查信息:
resource "google_compute_instance_group_manager" "app_instance_group" {
name = "app-instance-group"
base_instance_name = "app-node"
instance_template = "${google_compute_instance_template.app_template.self_link}"
update_strategy = "NONE"
zone = "${var.current_zone}"
target_size = 0
named_port {
name = "app8080"
port = 8080
}
auto_healing_policies {
health_check = "${google_compute_health_check.http_8080.self_link}"
initial_delay_sec = 300
}
}
地形验证:成功
地形方案:
我可以看到以下内容
+ auto_healing_policies {
+ health_check = "https://www.googleapis.com/compute/v1/projects/deltadna-live/global/healthChecks/http-8080"
+ initial_delay_sec = 300
}
terraform apply : Apply complete!
但是,当我转到实例组并检查是否一切正确时,运行状况检查设置为“ 无运行状况检查”,但是创建我的运行状况检查就可以了。
我试图理解为什么实例组不应用我的健康检查。
谢谢。