Terraform Google Uptime 检查模块 - 如何指定区域
我想指定一个区域来运行正常运行时间检查。我指定了参数 selected_regions
并指定了值“北美”,但出现以下错误
我的 terraform 代码
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":
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":
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试输入此文档中列出的区域:
Try entering region like listed in this doc:
该列表很难找到。截至 2023 年 8 月 31 日,位置如下:
https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.uptimeCheckConfigs#UptimeCheckRegion
使用示例:
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: