Hi
I’m creating a bunch of synthetic api tests in datadog via code.
I have 218 of these various URL’s/Healthchecks/etc list like this - 2 examples below from local file zabbix_internal_urls:
- url: https://URL1/HealthCheck/status
name: URL1_health_check
message: TBD
tags: [“env:prod”, “team:xxx”, “iac:terraform”, “origin:yyy”, “service:zzz”]
locations: ["pl:PRIV_LOC_1]
target_status_code: “200”
follow_redirects: “false” - url: https://URL2/health
name: URL2_health_check
message: TBD
tags: [“env:dev”, “team:www”, “iac:terraform”, “origin:xxx”, “group:yyy”, “squad:zzz”]
locations: [“pl:PRIV_LOC_1”]
target_status_code: “200”
follow_redirects: “false”
And the code I’m using is this:
resource “datadog_synthetics_test” “this” {
for_each = { for url in local.zabbix_internal_urls : url.name => url }
name = each.value.name
type = “api”
subtype = “http”
status = “live”
message = each.value.message
locations = each.value.locations
tags = each.value.tags
request_definition {
method = “GET”
url = each.value.url
}
assertion {
type = “statusCode”
operator = “is”
target = each.value.target_status_code
#target = “200”
}
assertion {
type = “responseTime”
operator = “lessThan”
target = “10000”
}
options_list {
tick_every = “3600”
min_failure_duration = “900”
min_location_failed = “1”
follow_redirects = each.value.follow_redirects
retry {
count = “2”
interval = “60000”
}
}
}
My issue is, example URL1 also needs to be tested on a against a 3rd datadog assertion over and above
status code 200 and
interval 10000ms
which ALL of the 218 URLs are tested for.
Only SOME of the URL healthchecks provides a body of text.
So I want to test them against the body of text.
Can it be done whereby those that DON’T require testing against a body of text simply bypass that assertion test?
Hope this makes sense.