Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google cloud platform 为terraform设置地面军事系统后端的问题_Google Cloud Platform_Google Cloud Storage_Terraform_Terraform Provider Gcp - Fatal编程技术网

Google cloud platform 为terraform设置地面军事系统后端的问题

Google cloud platform 为terraform设置地面军事系统后端的问题,google-cloud-platform,google-cloud-storage,terraform,terraform-provider-gcp,Google Cloud Platform,Google Cloud Storage,Terraform,Terraform Provider Gcp,我一直在尝试设置terraform后端,将状态文件存储在GCS bucket中。我创建了一个服务帐户,该帐户是项目所有者,具有gcs bucket storage admin访问权限,但仍面临以下错误: Initializing the backend... Error loading state: 2 errors occurred: * writing "gs://terraform-ubuntu-state-maintain/gcp/terraform.tfstate/de

我一直在尝试设置terraform后端,将状态文件存储在GCS bucket中。我创建了一个服务帐户,该帐户是项目所有者,具有gcs bucket storage admin访问权限,但仍面临以下错误:

Initializing the backend...
Error loading state: 2 errors occurred:
        * writing "gs://terraform-ubuntu-state-maintain/gcp/terraform.tfstate/default.tflock" failed: googleapi: Error 403: Insufficient Permission, insufficientPer
missions
        * storage: object doesn't exist. 

p、 s:gcs bucket也已创建,前缀路径为“gcp”。此外,还授予服务帐户权限。

我遇到了类似问题,结果证明是我使用的bucket名称。 GCS存储桶名称(如S3存储桶名称)是全局的,因此经常出现如下与权限相关的错误:

Error: Error inspecting states in the "gcs" backend:
    querying Cloud Storage failed: googleapi: Error 403: terraform@xxx.iam.gserviceaccount.com does not have storage.objects.list access to terraform-state., forbidden
与权限无关,但实际上是错误,因为您正试图读取其他人的存储桶(其他人已经在使用的存储桶名称)


顺便说一句,OG有一个名为“terraform state”的bucket,它一定收到了很多API请求来列出/创建对象…

我的错误是“配额项目”在
~/.config/gcloud/application\u default\u credentials.json中,指向一个不存在的项目。

您当前配置文件的
terraform
部分是什么样子的?特别是后端节。您是否提供了“凭据”参数?如果不是,则使用应用程序默认凭据。试着使用gsutil cp将一个随机文件复制到你的bucket中,看看你是否有执行该任务的权限。据我所知,我认为项目所有者对于服务帐户来说是不够的。我添加了:
Compute Storage Admin
Owner
Storage Admin
存储对象Admin
您好,我还建议模拟为服务帐户并尝试从shell运行命令,控制台中显示的错误包含有关错误的更多信息,如果将gsutil选项与-D一起使用,它将抛出有关请求的更多信息。我建议查看这是否仍然会引发gsutil错误,并使用该标志。请记住,此标志具有身份验证凭据。。因此,如果您计划与我们共享此信息,请确保取出所有身份验证和个人信息。