我々はGCPのプロジェクト名とプロジェクトIDを勘違いしてはならない...
TerraformでGKEのクラスタを立てようとしていたところ,terraform apply実行時にエラーが出た.
variable "project" { type = "map" default = { "id" = "gke-project" "cred_path" = "credentials.json" } } provider "google" { credentials = "${file(var.project["cred_path"])}" project = "${var.project["id"]}" }
エラーメッセージは以下のとおり.
Error: Error applying plan: 1 error(s) occurred: * google_container_cluster.gke: 1 error(s) occurred: * google_container_cluster.gke: googleapi: Error 403: Required "container.clusters.create" permission(s) for "projects/gke-project". See https://cloud.google.com/kubernetes-engine/docs/troubleshooting#gke_service_account_deleted for more info., forbidden Terraform does not automatically rollback in the face of errors. Instead, your Terraform state file has been partially updated with any resources that successfully completed. Please address the error above and apply again to incrementally change your infrastructure.
ggってみたら似たようなエラーで死んでる人がいた...
んー...ん?
Project ID のところに Project Name 書いてた
variable "project" { type = "map" default = { "id" = "gke-project-230601" "cred_path" = "credentials.json" } }
あっはい...サーセンっす...