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:
google_cloud_identity_group
google_cloud_identity_group_membership
We will be using the GCP Identity Starter Kit as a base and replace configuration stubs for our use case.
- 1.Make sure you have:
- A GCP account
- 2.Make sure you setup:
- 1.
- 2.
We only need to replace 3 stubs in the Grant Kit:
reviewers
, policies
, and location
.main.tf
1
resource "abbey_grant_kit" "abbey_gcp_quickstart" {
2
...
3
4
workflow = {
5
steps = [
6
{
7
reviewers = {
8
- one_of = ["[email protected]"] # CHANGEME
9
+ one_of = ["[email protected]"] # Use your own Abbey account [1].
10
}
11
}
12
]
13
}
14
15
output = {
16
- location = "github://replace-me-with-organization/replace-me-with-repo/access.tf" # CHANGEME
17
+ location = "github://example-org/example-repo/access.tf" # Use your own organization and repo.
18
...
19
}
20
}
21
22
...
[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.
All the following changes take place in
main.tf
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 grouplocals {
- gcp_member = "{{ .data.system.abbey.identities.abbey.email }}"
+ 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 likeDISPLAY_NAME ID DIRECTORY_CUSTOMER_ID
abbey.io 00000000 C1111111
Update the value for
gcp_customer_id
in the locals block with the DIRECTORY_CUSTOMER_ID```terraform
locals {
...
- gcp_customer_id = "$replace-me-with-gcp-customer-id"
+ gcp_customer_id = "C1111111"
}
```
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.
Example:

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.
- 1.
GCP_SERVICE_ACCOUNT
- 2.
GCP_WORKLOAD_IDENTITY_PROVIDER
- 3.
You can do this via Github repo page -> Settings -> Secrets and Variables -> Actions -> New Repository Secret and create with the above names.
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
- 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.\