Terraform - 配置错误

Terraform - 配置错误

我尝试使用 terraform 在 GCP 上配置基础设施,但总是收到此错误。

有人知道我该如何修复吗?

2020-05-05T22:08:28.461-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe: 2020/05/05 22:08:28 [DEBUG] Dismissed an error as retryable. Retryable error code 503 - googleapi: got HTTP response code 503 with body: HTTP/1.1 503 Service Unavailable
2020-05-05T22:08:28.461-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe: Connection: close
2020-05-05T22:08:28.461-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe: Transfer-Encoding: chunked
2020-05-05T22:08:28.461-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe: Alt-Svc: h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
2020-05-05T22:08:28.461-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe: Cache-Control: private
2020-05-05T22:08:28.461-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe: Content-Type: application/json; charset=UTF-8
2020-05-05T22:08:28.461-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe: Date: Wed, 06 May 2020 01:08:28 GMT
2020-05-05T22:08:28.461-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe: Server: ESF
2020-05-05T22:08:28.461-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe: Vary: Origin
2020-05-05T22:08:28.461-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe: Vary: X-Origin
2020-05-05T22:08:28.461-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe: Vary: Referer
2020-05-05T22:08:28.461-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe: X-Content-Type-Options: nosniff
2020-05-05T22:08:28.461-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe: X-Frame-Options: SAMEORIGIN
2020-05-05T22:08:28.461-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe: X-Xss-Protection: 0
2020-05-05T22:08:28.461-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe:
2020-05-05T22:08:28.470-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe: 10c
2020-05-05T22:08:28.470-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe: {
2020-05-05T22:08:28.470-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe:   "error": {
2020-05-05T22:08:28.470-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe:     "code": 503,
2020-05-05T22:08:28.470-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe:     "message": "Policy checks are unavailable.",
2020-05-05T22:08:28.470-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe:     "errors": [
2020-05-05T22:08:28.470-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe:       {
2020-05-05T22:08:28.470-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe:         "message": "Policy checks are unavailable.",
2020-05-05T22:08:28.470-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe:         "domain": "global",
2020-05-05T22:08:28.470-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe:         "reason": "backendError"
2020-05-05T22:08:28.470-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe:       }
2020-05-05T22:08:28.470-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe:     ],
2020-05-05T22:08:28.470-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe:     "status": "UNAVAILABLE"
2020-05-05T22:08:28.470-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe:   }
2020-05-05T22:08:28.470-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe: }
2020-05-05T22:08:28.470-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe:
2020-05-05T22:08:28.470-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe: 0
2020-05-05T22:08:28.470-0300 [DEBUG] plugin.terraform-provider-google_v3.20.0_x5.exe:

答案1

我使用了下面的命令和脚本:

提供者.tf

provider "google" {
  project     = "My First Project"
    credentials = file("My First Project-ab9b8254f549.json")
  region      = "southamerica-east1"
}

磁盘.tf

resource "google_compute_disk" "default" {
    name = "vm0-extendido"
    type = "pd-standard"
    zone = "southamerica-east1-a"
    physical_block_size_bytes = 4096
} 

命令:

terraform init
terraform plan
terrafor apply

但每次我都没有成功。

相关内容