我想为GKE集群绑定一个标签,但不能,因为:
google_tags_tag_binding.gke-tag-value-binding: Creating...
╷
│ Error: Error creating TagBinding: googleapi: Error 400: Request contains an invalid argument.
│ Details:
│ [
│ {
│ "@type": "type.googleapis.com/google.rpc.BadRequest",
│ "fieldViolations": [
│ {
│ "description": "Must be a valid One Platform resource name of a tag-compatible global resource. Did you forget to specify the correct location?",
│ "field": "binding.resource"
│ },
│ {
│ "description": "Resource type not supported in location global",
│ "field": "binding.resource"
│ }
│ ]
│ }
│ ]
│
│ with google_tags_tag_binding.gke-tag-value-binding,
│ on main.tf line 162, in resource "google_tags_tag_binding" "gke-tag-value-binding":
│ 162: resource "google_tags_tag_binding" "gke-tag-value-binding" {
│
╵
字符串
地形图:
Terraform will perform the following actions:
# google_tags_tag_binding.gke-tag-value-binding will be created
+ resource "google_tags_tag_binding" "gke-tag-value-binding" {
+ id = (known after apply)
+ name = (known after apply)
+ parent = "//container.googleapis.com/projects/xxx/locations/asia-southeast2-a/clusters/gke-cluster"
+ tag_value = "tagValues/xxx"
}
型
与tag相关的代码:
resource "google_tags_tag_key" "gke-tag" {
parent = "projects/${var.gcp-proj}"
short_name = "gke-cluster"
description = ""
}
resource "google_tags_tag_value" "gke-tag-value" {
parent = google_tags_tag_key.gke-tag.id
short_name = "gke-cluster-true"
description = "It's True"
}
resource "google_tags_tag_binding" "gke-tag-value-binding" {
provider = google.oprek
parent = "//container.googleapis.com/${google_container_cluster.gke-cluster.id}"
tag_value = google_tags_tag_value.gke-tag-value.id
}
型
我的Terraform配置有什么问题?我认为定义的代码是正确的,并遵循文档。
相关文档:
Google Cloud Doc: Manage GKE resources using Tags
Terraform Registry Doc: Google Provider - resource.google_tags_tag_binding的
1条答案
按热度按时间yhqotfr81#
案件结案
我将代码改为:
字符串
}
和工作良好