Google Cloud: Managing Access to Groups
Last updated
Last updated
In this tutorial, you'll learn how to configure to automate access requests to an Google Cloud Identity Group by attaching a Google Cloud Identity Group Membership. This use case models granting new users memberships to a GCP group.
The main terraform resources we'll be using for GCP are:
We will be using the GCP Identity Starter Kit as a base and replace configuration stubs for our use case.
Make sure you have:
A GCP account
gcloud
CLI set up
Make sure you setup:
An GCP Identity Starter Kit by following Get a Starter Kit
A Connection to a repo by following Connect a Repo
Grant Kits rely on your GitHub account and repository name to output access changes, which we'll set through Terraform local variables. Update the locals
block in main.tf
with your account_name
and repo_name
Workflow defines who should approve an access request.
Let's update the reviewers
block by adding yourself as the reviewer by switching replace-me@example.com
with the email address you use to sign into Abbey.
Now you'll need to link GCP with Abbey.
You can skip this step if your GCP user email address matches your Abbey email address.
Replace the value for gcp_member
in the locals block to the google email address for the user you wish to add to group.
Replace the billing_project
field in the google provider block with your project ID and correct region.
In the terminal run gcloud organizations list
, which should output something like
Update the value for gcp_customer_id
in the locals block with the DIRECTORY_CUSTOMER_ID
In this step we will
Create and use GCP resources (Project, Service Account, Workload Identity Pool & Provider)
Add Repository Secrets so Github Actions to make calls to GCP
Create a new GCP project or use an existing one. Make sure that the Cloud Identity API is enabled for your project (https://console.cloud.google.com/apis/api/cloudidentity.googleapis.com)
After that, we need to configure Workload Identity Federation to allow Github Actions to make calls from your repo when managing the group membership. This allows Github to only gain secure temporary access tokens rather than exporting long-lived JSON secrets.
Follow these instructions to set it up https://github.com/google-github-actions/auth#setting-up-workload-identity-federation. Don't worry about making any changes to the actions YAML file, just save the Service Account email and the Workload Identity Provider ID - we'll add those as repository secrets.
Next, add the following repository secrets so Github Actions can access these credentials.
GCP_SERVICE_ACCOUNT
GCP_WORKLOAD_IDENTITY_PROVIDER
ABBEY_TOKEN
- API token taken from Settings > API Tokens
You can do this via Github repo page -> Settings -> Secrets and Variables -> Actions -> New Repository Secret and create with the above names.
To deploy your Starter Kit, follow instructions from Deploy Your Grant Kit.
You can now start requesting and approving access by following the Request Access and Approve or Deny Access Requests guides.
Abbey strives to help you automate and secure access management without being intrusive.
To that end, this Pull Request contains native Terraform HCL code using normal open source Terraform Provider libraries. It represents the permissions change. In this case, it's just a simple creation of a new Terraform Resource.
After approving the request, you should be able to see that the user has been added to the google group.
Navigate to https://groups.google.com/all-groups
Select the group you are adding a member to
View members
Finally, this starter kit comes with a time-based policy by default, the user will automatically be removed after 1 hour.
To learn more about what Resources you can configure, try one of our Step-by-Step Tutorials.
For more information on how Abbey works, visit the Key Concepts or Grant Kits page.
Congratulations! Abbey is now managing permissions to your Resource for you.