How to create GCP custom IAM role with help of .yaml file?
One of the pretty easy ways to create a GCP custom IAM role help of YAML file.
Here is one sample format you can follow on how to create, Hope it will be helpful for you to create a custom role.
Step 1:
To create .yaml file with below editor
nano role-definition.yaml
or
vim role-definition.yaml
or
vi role-definition.yaml
As per requirement, custom role define in .yaml file body
title: "Role Editor"
description: "Edit access for App Versions"
stage: "ALPHA"
includedPermissions:
- appengine.versions.create
- appengine.versions.delete
Once YAML file is ready along with your requirement you can simply execute the below CLI gcloud cmd in cloud shell.
gcloud iam roles create editor - project $DEVSHELL_PROJECT_ID \
- file role-definition.yaml
If you want to excute this cmd from your local laptop that is also possible but you have to install cloud sdk and configure with your project
Create environment variable
export PROJECT_ID=”YOURS_PROJRCT_ID”
gcloud iam roles create editor - project $PROJECT_ID \
- file role-definition.yaml