'Terraform Google Uptime check module - how to specify a region

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": 


Solution 1:[1]

Try entering region like listed in this doc:

USA, EUROPE, SOUTH_AMERICA, or ASIA_PACIFIC

Solution 2:[2]

Gogole Cloud has multiple regions in North America, which (Currently) are:

  • northamerica-northeast1, northamerica-northeast2
  • us-east1, us-east4
  • us-west1, us-west2, us-west3, us-west4
  • us-central1

You have to choose and set the correct region name. See:

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2