我将我的环境设置为云构建应用程序(Github应用程序)以通过云构建配置terraform 到谷歌云平台。该构建是一个具有云功能的简单云编辑器,它创建这些资源以及正确的服务帐户和成员。 但是,只有所有者权限才能成功执行此操作,我希望对云构建服务帐户拥有最小权限。我演过很多角色,但似乎都没有成功。即创建服务帐户、编辑器、访问上下文管理器管理员、访问审批批准者。当我通过 github commit 运行构建时,除了将所有者设置为角色之外,我收到此错误
Error: Error applying IAM policy for cloudfunctions cloudfunction googleapi: Error 403: Permission
Error: Batch "iam-project-redacted modifyIamPolicy" for request "Create IAM Members roles/composer.worker serviceAccount:[email protected] for \"project \\"redacted\\"\"" returned error: Error applying IAM policy for project "redacted": Error setting IAM policy for project "redacted": googleapi: Error 403: The caller does not have permission, forbidden. To debug individual requests, try disabling batching: https://www.terraform.io/docs/providers/google/guides/provider_reference.html#enable_batching
是否有 IAM 策略/角色允许服务帐户通过云构建成功构建?
将所有者角色设置为 cloudbuild 服务帐户后,一切都会成功构建
最佳答案
默认情况下,云构建服务帐户已分配具有权限 referred here 的云构建服务帐户角色。 。请注意,您只能执行 following tasks :其中包括执行相关事件以使构建成功(访问 Cloud Source Repository、Cloud Storage 和 Container Registry)。
除了 Cloud Build Service Account 角色之外,您还需要 grant additional roles取决于您使用 Cloud Build 执行的其他操作。
在错误消息的特定情况下,您需要添加 Cloud Functions Developer role为了能够完全访问云功能。整个过程都有记录here .
如果您还要部署到 App Engine,或管理 Google Kubernetes Engine 等,也会有类似的角色。查找所有可用角色的列表 here .
关于google-cloud-platform - 云构建服务帐号权限构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60158725/