运行部署管理器以创建部署时,我从 GCP 收到 403 PERMISSION_DENIED 响应,该部署创建服务帐户并使用云资源管理器 API 为其设置 IAM 策略。这是 setIamPolicy 模板:
{
'resources': [
{
'name': context.env['name'],
'action': 'gcp-types/cloudresourcemanager-v1:cloudresourcemanager.projects.setIamPolicy',
'properties': {
'resource': context.properties['resource'],
'policy': {
'bindings': context.properties['bindings']
}
}
}
]
}
来自 GCP 的回应:
'{"ResourceType":"gcp-types/cloudresourcemanager-v1:cloudresourcemanager.projects.setIamPolicy","ResourceErrorCode":"403","ResourceErrorMessage":{"code":403,"message":"调用者没有有权限","status":"PERMISSION_DENIED","statusMessage":"Forbidden","requestPath":" https://cloudresourcemanager.googleapis.com/v1/projects/project-name@project-name.iam.gserviceaccount .com:setIamPolicy ","httpMethod":"POST"}}'
仅供参考:机器人帐户 (12345@cloudservices.gserviceaccount.com) 在 IAM 中被授予项目所有者权限。