正在运行的地形应用程序出现以下错误。
{"error":{"code":403,"message":"The billing account for the owning project is disabled in state absent","errors":[{"message":"The billing account for the owning project is disabled in state absent","domain":"global","reason":"accountDisabled","locationType":"header","location":"Authorization"}]}}: timestamp=2022-12-31T00:04:43.690-0500
对于项目,我添加了计费帐户。
我可以使用相同的服务帐户从shell运行gcloud命令而不会出现任何错误。
terraform_gcp % gcloud auth activate-service-account --key-file=sakey.json
Activated service account credentials for: [gcp-terraform@saproject.iam.gserviceaccount.com]
terraform_gcp % gsutil ls
gs://mygcptfstatebucket/
terraform_gcp % gcloud compute instances list
Listed 0 items.
我的主。tf是
terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "4.47.0"
}
}
}
provider "google" {
project = "my-gcp-project"
region = "us-east1"
zone = "us-east1-b"
}
关于此错误的任何见解
尝试添加下面的块,其工作似乎与我的配置有关。
data "google_project" "project_name" {
project_id = "projectid"
}
并在资源块中引用project_id
。