布置好main.tf, 执行terraform init,terraform plan都顺利,执行terraform apply后,出现下面的错误:
google_storage_bucket.demo-bucket: Creating...
google_storage_bucket.demo-bucket: Still creating... [10s elapsed]
google_storage_bucket.demo-bucket: Still creating... [20s elapsed]
google_storage_bucket.demo-bucket: Still creating... [30s elapsed]
╷
│ Error: Post "https://storage.googleapis.com/storage/v1/b?alt=json&prettyPrint=false&project=coherent-ascent-379901": oauth2: cannot fetch token: Post "https://oauth2.googleapis.com/token": dial tcp 172.217.163.42:443: i/o timeout
我做了以下尝试,但是这些操作以后,错误仍然存在
1、gcloud auth list 命令来查看当前的身份验证状态,显示我的服务账号与用户账号都活跃
2、使用 gcloud components update 命令来更新 SDK,显示最新版本
3、运行 gcloud auth application-default print-access-token 命令并成功获取访问令牌
4、尝试运行 gcloud auth application-default login 命令重新进行授权
main.tf脚本:
terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "5.13.0"
}
}
}
provider "google" {
credentials = "./keys/my-creds.json" # Credentials only needs to be set if you do not have the GOOGLE_APPLICATION_CREDENTIALS set
project = "coherent-ascent-379901"
region = "us-central1"
}
resource "google_storage_bucket" "demo-bucket" {
name = "coherent-ascent-379901-terra-bucket"
location = "US"
force_destroy = true
lifecycle_rule {
condition {
age = 2 //days
}
action {
type = "AbortIncompleteMultipartUpload"
}
}
}
有大佬遇到过这种问题吗?