【发布时间】:2021-12-11 07:51:53
【问题描述】:
我已将我的 firebase 项目作为 terraform 资源导入,但在运行 terraform plan 时得到了这个:
│ Error: Error when reading or editing FirebaseProject "projects/myproject": googleapi: Error 403: Your application has authenticated using end user credentials from the Google Cloud SDK or Google Cloud Shell which are not supported by the firebase.googleapis.com. We recommend configuring the billing/quota_project setting in gcloud or using a service account through the auth/impersonate_service_account setting. For more information about service accounts and how to use them in your application, see https://cloud.google.com/docs/authentication/. If you are getting this error with curl or similar tools, you may need to specify 'X-Goog-User-Project' HTTP header for quota and billing purposes. For more information regarding 'X-Goog-User-Project' header, please check https://cloud.google.com/apis/docs/system-parameters.
│ Details:
│ [
│ {
│ "@type": "type.googleapis.com/google.rpc.ErrorInfo",
│ "domain": "googleapis.com",
│ "metadata": {
│ "consumer": "projects/774686551450",
│ "service": "firebase.googleapis.com"
│ },
│ "reason": "SERVICE_DISABLED"
│ }
│ ]
│
│ with google_firebase_project.default,
│ on main.tf line 27, in resource "google_firebase_project" "default":
│ 27: resource "google_firebase_project" "default" {
如果我将GOOGLE_APPLICATION_CREDENTIALS env var 设置为该项目的服务帐户,它似乎可以工作,但我想避免它,因为每次我更改环境时都需要重新导出该变量.
我已通过我的用户对gcloud 进行了身份验证,该用户是所有相关项目的管理员。
【问题讨论】:
-
如果您已经为该项目创建了服务帐户,您可以尝试使用
gcloud auth activate-service-account service_account_email --key-file=/path/to/your/service/account/keyfile.json验证 Cloud SDK 更多信息 - cloud.google.com/sdk/gcloud/reference/auth/… -
@st_rt_dl_8 我想完全避免使用服务帐户,因为每次部署到不同的环境时都需要切换。
-
你能解决这个问题吗?我面临同样的问题。服务帐户也不适合我
标签: firebase terraform terraform-provider-gcp