Reputation: 53
I want to specify a region for uptime check to run . I specified argument selected_regions
and assigned value "North America" but getting the below error
My terraform code
resource "google_monitoring_uptime_check_config" "http1" {
project = var.project_id
display_name = "Website uptime check1"
timeout = "10s"
period = "60s"
selected_regions = [var.region1]
http_check {
path = "/"
port = "80"
}
monitored_resource {
type = "uptime_url"
labels = {
project_id = var.project_id
#region = var.region
host = "xx.xx.xx.xx"
}
}
}
Error
Step #1 - "terraform-apply": Error: Error updating UptimeCheckConfig "projects/xxxxxxxxxxxx/uptimeCheckConfigs/website-uptime-check-vh-T7eowa2Y": googleapi: Error 400: Invalid value at 'uptime_check_config.selected_regions[0]' (type.googleapis.com/google.monitoring.v3.UptimeCheckRegion), "North America"
Step #1 - "terraform-apply": Details:
Step #1 - "terraform-apply": [
Step #1 - "terraform-apply": {
Step #1 - "terraform-apply": "@type": "type.googleapis.com/google.rpc.BadRequest",
Step #1 - "terraform-apply": "fieldViolations": [
Step #1 - "terraform-apply": {
Step #1 - "terraform-apply": "description": "Invalid value at 'uptime_check_config.selected_regions[0]' (type.googleapis.com/google.monitoring.v3.UptimeCheckRegion), \"North America\"",
Step #1 - "terraform-apply": "field": "uptime_check_config.selected_regions[0]"
Step #1 - "terraform-apply": }
Step #1 - "terraform-apply": ]
Step #1 - "terraform-apply": }``
Step #1 - "terraform-apply": ]
Step #1 - "terraform-apply":
Upvotes: 1
Views: 1251
Reputation: 2080
The list is quite difficult to find. As of 31/08/2023, it is here:
https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.uptimeCheckConfigs#UptimeCheckRegion
Example of use:
variable "list_uptime_check_regions" {
type = list
description = "List of regions from which the check will be run."
default = [ "EUROPE", "ASIA_PACIFIC", "SOUTH_AMERICA" ]
}
resource "google_monitoring_uptime_check_config" "https_incident" {
display_name = "uptime-check_test"
selected_regions = var.list_uptime_check_regions
timeout = "60s"
...
}
Upvotes: 1