Google Cloud: Managing Access to Groups

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. Make sure you have:

  2. Make sure you setup:

    1. A Connection to a repo by following Connect a Repo

Step 1: Configure Your Grant Kit

Configure Output

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 with your account_name and repo_name
 locals {
  account_name = "" #CHANGEME
  repo_name = "" #CHANGEME

Configure Reviewers

Workflow defines who should approve an access request.

Let's update the reviewers block by adding yourself as the reviewer by switching with the email address you use to sign into Abbey.
 resource "abbey_grant_kit" "..." {
   workflow = {
     steps = [
         reviewers = {
-          one_of = [""] # CHANGEME
+          one_of = [""]

Now you'll need to link GCP with Abbey.

curl -X POST \
  -H "Authorization: Bearer $ABBEY_API_TOKEN" \
  -H 'Content-Type: application/json' \<user_id>/apps \
  -d '{"type": "google", "data": {"id": "<your GCP id>"}}'

Step 3: Configure GCP for Terraform

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 =

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

DISPLAY_NAME            ID  DIRECTORY_CUSTOMER_ID      00000000              C1111111

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 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.



  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. Select the group you are adding a member to

  2. View members

Finally, this starter kit comes with a time-based policy by default, the user will automatically be removed after 1 hour.

Next Steps

To learn more about what Privacy Policy 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.

Last updated