それでも気分は高専生

元高専生が自分のやってきたことを記事として残すためのてきとーなブログ

我々は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ってみたら似たようなエラーで死んでる人がいた...

stackoverflow.com

んー...ん?

f:id:takahiro0914:20190203184825p:plain

Project ID のところに Project Name 書いてた

variable "project" {
  type = "map"
  default = {
    "id" = "gke-project-230601"
    "cred_path" = "credentials.json"
  }
}

あっはい...サーセンっす...