Comment on page

Google Cloud: Managing Access to Groups

In this tutorial, you'll learn how to configure Grant Kits 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.

Before you start

  1. 1.
    Make sure you have:
  2. 2.
    Make sure you setup:
    1. 2.
      A Connection to a repo by following Connect a Repo

Step 1: Configure Your Grant Kit

We only need to replace 3 stubs in the Grant Kit: reviewers, policies, and location.
resource "abbey_grant_kit" "abbey_gcp_quickstart" {
workflow = {
steps = [
reviewers = {
- one_of = ["[email protected]"] # CHANGEME
+ one_of = ["[email protected]"] # Use your own Abbey account [1].
output = {
- location = "github://replace-me-with-organization/replace-me-with-repo/" # CHANGEME
+ location = "github://example-org/example-repo/" # Use your own organization and repo.
[1] To find your Primary Identity, visit the Abbey App and click on your Profile Icon on the top right ->
Manage Account -> Look under Email addresses.
Find your Primary Identity on the Abbey App.

Step 2: Configure GCP for Terraform

All the following changes take place in
Configure GCP User
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
locals {
- gcp_member = "{{ }}"
+ gcp_member = [email protected]
Note: We'll pull this kind of data automatically in the future, but we're keeping it simple for the sake of this demo.
Configure GCP Billing Project
Replace the billing_project field in the google provider block with your project ID and correct region.
provider "google" {
- billing_project = "replace-me"
+ billing_project = "your-project-id"
- region = "replace-me"
+ region = "your-region"
Configure GCP Customer ID
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
locals {
- gcp_customer_id = "$replace-me-with-gcp-customer-id"
+ gcp_customer_id = "C1111111"

Step 3: Configure Time-Based Policy

Most of the time we don't want access to last forever. We can configure Abbey to revoke access after a specified time. Navigate to policies/common/common.rego and you'll find a file like such:
package common
import data.abbey.functions
allow[msg] {
- functions.expire_after("0m")
+ functions.expire_after("10m")
msg := "granting access for 0 minutes"
We can set this policy to automatically revoke access to a resource after 10 minutes. Once the time has passed, Abbey will automatically revert the PR that granted resource access in the first place and the user will be removed from the group.

Step 4: Configure GCP Permissions

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 (
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 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.
  1. 1.
  2. 2.
  3. 3.
    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.
What should it look like?

Step 5: Deploy Your Starter Kit

To deploy your Starter Kit, follow instructions from Deploy Your Grant Kit.

Step 6: Automate Access Management

Congratulations! Abbey is now managing permissions to your Resource for you.
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.
  1. 2.
    Select the group you are adding a member to
  2. 3.
    View members
Note: if it's been more than the time-expiry you set in the policy, the member will automatically be removed from the group.\

Next Steps

To learn more about what Resources you can configure, try one of our Tutorials.
For more information on how Abbey works, visit the Key Concepts or Grant Kits page.