Reputation: 11
So I have my terraform file where I have created my uptime check, where I am checking the SSL certs and not the uptime, configured it so just to check the cert expire. Now suppose by default
I have Acceptable HTTP Response Code 200 allowed but if I want to allow 404 code as well so that if the website gives 404 response but still by test passes how can I allow that in the terraform code..?
so for example
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"
}
}
}
This is passed if I click test option
but I need to allow 404 as well so that the test will pass if the return is 404 as well.
Can anyone plz help me with the correct code to include 404 under Acceptable HTTP Response Code->Response Code Classes allow 404 and 200.
Upvotes: 0
Views: 427
Reputation: 1
you can specify exact response codes:
http_check {
path = "/some-path"
port = "443"
use_ssl = true
validate_ssl = true
accepted_response_status_codes {
status_class = "STATUS_CLASS_2XX"
}
accepted_response_status_codes {
status_value = 404
}
accepted_response_status_codes {
status_value = 302
}
}
Upvotes: 0