提问人:Kikeman26 提问时间:11/9/2023 更新时间:11/10/2023 访问量:26
Terraform Import Google 正常运行时间检查失败
Terraform Import Google Uptime Check fails
问:
我正在尝试导入Uptime_check但一直说该资源不存在。
我正在使用以下命令:
terraform import module.uptime_check.google_monitoring_uptime_check_config.default {{HTTP_GKE_Check_Backend_1}}
我的结构如下:
├── main.tf
└── modules
└── uptime_check
└── uptime_check.tf
我的资源是:
resource "google_monitoring_uptime_check_config" "default" {
display_name = "HTTP_GKE_Check_Backend_1"
project = "google-ABCD-012345"
}
我 main.tf 是:
module "uptime_check" {
source = ".//modules/uptime_check"
}
但是每次我尝试时,我都会收到错误:
Error: Cannot import non-existent remote object
│
│ While attempting to import an existing object to "module.uptime_check.google_monitoring_uptime_check_config.default", the provider detected that no object exists with the given id. Only pre-existing objects can be imported; check that the id is correct
│ and that it is associated with the provider's configured region or endpoint, or use "terraform apply" to create a new remote object for this resource.
当然,资源存在于帐户中。
答:
1赞
Kikeman26
11/10/2023
#1
解决了它。
云资源的 {{name}} 不仅仅是名称。
根据 Terraform 文档:
此 UptimeCheckConfig 的唯一资源名称。格式为 projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID]。
所以,这个命令对我有用:
terraform import module.uptime_check.google_monitoring_uptime_check_config.default projects/google-ABCD-012345/uptimeCheckConfigs/http-gke-check-backend-1-ABCDE12345
评论