使用Terraform设置GKE环境时出现“ googleapi:错误500:遇到内部错误,backendError”?

问题描述

我正在尝试遵循本教程https://learn.hashicorp.com/tutorials/terraform/gke。我对存储库所做的唯一更改是定义了一个项目名称,该名称等于gcloud config get-value project的结果:

kurtpeek@Kurts-MacBook-Pro ~/g/s/g/k/learn-terraform-provision-gke-cluster (master)> git diff
diff --git a/terraform.tfvars b/terraform.tfvars
index a13174b..4f7eaae 100644
--- a/terraform.tfvars
+++ b/terraform.tfvars
@@ -1,2 +1,2 @@
-project_id = "REPLACE_ME"
+project_id = "kurtpeek-179513"
 region     = "us-central1"
kurtpeek@Kurts-MacBook-Pro ~/g/s/g/k/learn-terraform-provision-gke-cluster (master)> 
gcloud config get-value project
kurtpeek-179513

但是,如果我运行terraform apply,则会收到以以下错误结尾的日志:

Do you want to perform these actions?
  terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

google_compute_network.vpc: Creating...
google_compute_network.vpc: Still creating... [10s elapsed]
google_compute_network.vpc: Still creating... [20s elapsed]
google_compute_network.vpc: Creation complete after 23s [id=projects/kurtpeek-179513/global/networks/kurtpeek-179513-vpc]
google_compute_subnetwork.subnet: Creating...
google_compute_subnetwork.subnet: Still creating... [10s elapsed]
google_compute_subnetwork.subnet: Still creating... [20s elapsed]
google_compute_subnetwork.subnet: Creation complete after 23s [id=projects/kurtpeek-179513/regions/us-central1/subnetworks/kurtpeek-179513-subnet]
google_container_cluster.primary: Creating...
google_container_cluster.primary: Still creating... [10s elapsed]
google_container_cluster.primary: Still creating... [20s elapsed]
google_container_cluster.primary: Still creating... [30s elapsed]
google_container_cluster.primary: Still creating... [40s elapsed]
google_container_cluster.primary: Still creating... [50s elapsed]
google_container_cluster.primary: Still creating... [1m0s elapsed]

Error: googleapi: Error 500: Internal error encountered.,backendError

  on gke.tf line 17,in resource "google_container_cluster" "primary":
  17: resource "google_container_cluster" "primary" {

根据https://github.com/hashicorp/terraform/issues/20029,这可能是由于不正确的项目名称引起的,但是我相信我已按照指示设置了该变量(@L_404_2@)。知道是什么原因造成的吗? (可从https://github.com/hashicorp/learn-terraform-provision-gke-cluster获得terraform项目代码)。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)