【发布时间】:2022-11-10 15:04:22
【问题描述】:
所以我有我的 terraform 文件,我在其中创建了正常运行时间检查,我正在检查 SSL 证书而不是正常运行时间,配置它只是为了检查证书过期。 现在假设默认情况下
我允许了可接受的 HTTP 响应代码 200,但如果我也想允许 404 代码,那么如果网站提供 404 响应但仍然通过测试,我该如何在 terraform 代码中允许它..?
所以例如
resource "google_monitoring_uptime_check_config" "https" {
display_name = "https-uptime-check"
timeout = "60s"
http_check {
path = "/some-path"
port = "443"
use_ssl = true
validate_ssl = true
}
monitored_resource {
type = "uptime_url"
labels = {
project_id = "my-project-name"
host = "192.168.1.1"
}
}
content_matchers {
content = "example"
matcher = "MATCHES_JSON_PATH"
json_path_matcher {
json_path = "$.path"
json_matcher = "REGEX_MATCH"
}
}
}
但我也需要允许 404,以便如果返回也是 404,测试也将通过。 任何人都可以帮助我使用正确的代码,在可接受的 HTTP 响应代码->响应代码类下包含 404 允许 404 和 200。
【问题讨论】:
标签: terraform-provider-gcp google-cloud-monitoring uptime-monitoring