Terraform Google Uptime 检查模块 - 如何指定区域

问题描述 投票:0回答:3

我想指定一个区域来运行正常运行时间检查。我指定了参数

selected_regions
并指定了值“北美”,但出现以下错误


我的地形代码

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

错误

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": 
google-cloud-platform terraform monitoring terraform-provider-gcp uptime
3个回答
2
投票

尝试输入此doc中列出的区域:

美国、欧洲、南美洲或亚太地区


0
投票

Gogole Cloud 在北美拥有多个区域,(目前)是:

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

您必须选择并设置正确的区域名称。参见:


0
投票

该列表很难找到。截至 2023 年 8 月 31 日,它在这里:

https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.uptimeCheckConfigs#UptimeCheckRegion

  • REGION_UNSPECIFIED
  • 美国 欧洲
  • 南美洲
  • 亚洲_太平洋地区
  • 美国_俄勒冈州
  • 美国_爱荷华州
  • 美国_弗吉尼亚州
© www.soinside.com 2019 - 2024. All rights reserved.