我正在通过 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
}
}
terraform 验证:成功
地形规划:
我可以看到以下内容;
+ 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!
但是当我去实例组检查一切是否正确时,健康检查设置为“无健康检查”,但我的健康检查创建得很好。
我试图了解为什么实例组不应用我的运行状况检查。
谢谢,。