我正在尝试通过Deployment Manager向GCP项目中的用户(Google帐户)分配自定义IAM角色,但是收到403错误代码。 我遵循了Google Cloud Platform存储库中提供的示例: https://github.com/GoogleCloudPlatform/deploymentmanager-samples/tree/master/community/cloud-foundation/templates/iam_member
基本上,我创建了一个配置YAML文件,其内容如下:
- path: ../iam_member.py
name: iam_member.py
resources:
- name: iam-member-oval-unity-test-0
type: iam_member.py
properties:
projectId: oval-unity-88908
type: string
roles:
- role: roles/GARawDataViewer
members:
- user:<USER_EMAIL>
GARawDataViewer是在项目椭圆形统一性88908中创建的自定义角色,并且是我尝试向其分配自定义IAM角色的用户电子邮件地址的值。
最后,我部署了运行以下命令:
gcloud deployment-manager deployments create deployment-oval-unity-member-test --config examples/oval_unity_member.yaml
运行gcloud部署管理器后,我收到以下错误消息:
- code: CONDITION_NOT_MET
location: /deployments/deployment-oval-unity-member-test/resources/get-iam-policy-iam-member-oval-unity-test-0-0-0->$.properties->$.policy
message: |-
InputMapping for field [policy] for method [setIamPolicy] could not be set from input, mapping was: [$.gcpIamMemberBinding($.intent, $.inputs.policy.response, $.resource.properties)], and evaluation context was:
{
"deployment" : {
"id" : 4858392305054927640,
"name" : "deployment-oval-unity-member-test"
},
"extensions" : {
"EnableAdditionalJsonPathFunctions" : true,
"EnableGoogleTypeProviderFunctionsExperiment" : true
},
"inputs" : {
"policy" : {
"error" : {
"code" : "403",
"message" : "{\"code\":403,\"message\":\"The caller does not have permission\",\"status\":\"PERMISSION_DENIED\",\"statusMessage\":\"Forbidden\",\"requestPath\":\"https://cloudresourcemanager.googleapis.com/v1/projects/oval-unity-88908:getIamPolicy\",\"httpMethod\":\"POST\"}"
}
}
},
"intent" : "CREATE",
"matches" : [ ],
"project" : "dm-creation-project-0",
"requestId" : "f3c7f0c4-1ff7-3e26-a060-b0adc068866d",
"resource" : {
"name" : "get-iam-policy-iam-member-oval-unity-test-0-0-0",
"previous" : { },
"properties" : {
"member" : "<USER_EMAIL_ADDRESS!>",
"resource" : "oval-unity-88908",
"role" : "roles/GARawDataViewer"
},
"self" : { }
}
}
Error was:
Parameter for gcpIamMemberBinding at position 1 is not of type map, value was [null]
有趣的是,我已经能够成功地分配一个预定义的角色,例如“ editor”:role / editor,但使用自定义角色失败。
我什至尝试使用自定义角色的完整路径:projects / oval-unity-88908 / roles / GARawDataViewer 但仍然显示相同的错误。
您是否知道如何解决此问题? 预先感谢!
答案 0 :(得分:0)
问题可能是,您没有为部署管理器使用的服务帐户提供正确的权限来处理IAM事务。如here所述,您可以通过完成以下步骤来解决此问题:
[PROJECT_NUMBER]@cloudservices.gserviceaccount.com
。让我知道您是否需要进一步的帮助!