0

我使用部署管理器并尝试在 python 文件中描述我的资源(部署管理器允许使用 Python 或 Jinja 创建配置)。实际上,

我使用 json-format 来创建主题资源 -

return
{ 
    'name': topic, 
    'type': 'pubsub.v1.topic',
    'properties': { 
        'topic': topic 
    },
    'accessControl': {
        'gcpIamPolicy': { 
            'bindings': [ 
                { 
                    'role': 
                    'roles/pubsub.publisher',
                    'members': [ 'service_account = project_name + '@gs-project-accounts.iam.gserviceaccount.com' ]
                } 
            ] 
        }  
    }
}

[project_name]@gs-project-accounts.iam.gserviceaccount.com几周前该格式运行良好,但对于新创建的项目,找不到此类服务帐户。

  1. 为新创建的项目更改了谷歌云存储服务帐户的格式是否正确service account ... doesn't exist?它是- [project-name]@gs-project-accounts.iam.gserviceaccount.com,现在是service-[projectId]@gs-project-accounts.iam.gserviceaccount.com。我通过这个API 和我得到的特殊新创建项目检查它 - 这种格式:service-[project_Id]@gs-project-accounts.iam.gserviceaccount.com.

  2. 我们如何在部署管理器配置文件中动态获取谷歌云存储服务帐户?正如我在这里看到的,只有几个环境变量,如 project_name、project_id、time 等,并且没有任何 storage_service_account 环境变量

4

1 回答 1

1

The GCS service account format recently changed to the following format:

service-[PROJECT_NUMBER]@gs-project-accounts.iam.gserviceaccount.com

Existing projects will continue to work with the previous format.

For new projects, the new format will be the way moving forward.

To verify format you can get projects.serviceAccount.

于 2018-07-16T14:47:00.393 回答