-
Notifications
You must be signed in to change notification settings - Fork 0
GCP Service Account
udx-github edited this page Jul 26, 2026
·
1 revision
Creates GCP service accounts with role bindings and custom roles.
Use this module when a Rabbit service needs dedicated identities - runtime service accounts for Cloud Run or GKE workloads, caller accounts for cross-service auth, or custom least-privilege roles.
- Multiple service accounts per module instance via the
service_accountsmap. - Project role bindings per account, including custom role references (
custom:prefix). - Custom role definitions with explicit permission lists.
- IAM bindings on the service account itself, such as
workloadIdentityUserfor GitHub Actions WIF.
- GCP credentials with permission to manage service accounts, custom roles, and project IAM policy (
roles/iam.serviceAccountAdmin,roles/iam.roleAdmin,roles/resourcemanager.projectIamAdmin). - The
iam.googleapis.comAPI enabled on the project (enabled automatically viagoogle_api_name).
- Service account keys are intentionally not supported; use Workload Identity Federation for external authentication.
-
project_rolesentries prefixed withcustom:reference a key in thecustom_rolesmap and resolve toprojects/<project>/roles/<role_id>. Custom roles are created before any bindings that reference them. - Deleted service account names cannot be reused for 30 days; deleted custom role IDs cannot be reused for 7 days.
- Bindings use
google_project_iam_member(additive, non-authoritative) - existing bindings on the same role are not disturbed.
services:
- name: "Service Accounts"
module: "gcp-service-account"
id: "my-service-accounts"
configurations:
service_accounts:
api-service:
account_id: "sa-api-service"
project_roles:
- "roles/pubsub.publisher"| Output | Description |
|---|---|
service_account_emails |
Map of service account keys to email addresses. |
service_account_ids |
Map of service account keys to fully-qualified resource names. |
custom_role_ids |
Map of custom role keys to fully-qualified role IDs. |
configurations:
# Map of service accounts to create. Keys are stable identifiers used
# in state addressing and outputs; renaming a key recreates the account.
service_accounts:
<key>:
account_id: "" # Required. 6-30 chars, becomes <account_id>@<project>.iam.gserviceaccount.com
display_name: "" # Optional. Defaults to account_id.
description: "" # Optional. Defaults to "Managed by Rabbit".
disabled: false # Optional. Disable the account without deleting it.
project_roles: [] # Optional. Roles granted to this SA on the project.
# - "roles/pubsub.publisher" (predefined role)
# - "custom:<custom_roles key>" (custom role below)
iam_bindings: [] # Optional. IAM bindings ON this service account.
# - role: "roles/iam.workloadIdentityUser"
# member: "principalSet://iam.googleapis.com/projects/<num>/locations/global/workloadIdentityPools/<pool>/attribute.repository/<org>/<repo>"
# Map of custom project roles to create.
custom_roles:
<key>:
role_id: "" # Required. CamelCase role ID, unique per project.
title: "" # Required. Human-readable title.
description: "" # Optional. Defaults to "Managed by Rabbit".
permissions: [] # Required. Explicit permission list.- AWS ACM Certificate
- AWS CloudFormation Stack
- AWS CloudFront Distribution
- AWS CloudFront Response Headers Policy
- AWS Route53 DNS
- AWS WAF
- GCP Cloud Run
- GCP Firestore Database (
gcp-firestore) - GCP GKE Cluster
- GCP GKE Node Pool
- GCP IAM
- GCP Monitoring
- GCP Networking
- GCP PostgreSQL Instance
- GCP Pub/Sub
- GCP Secret Manager
- GCP Service Account
- GCP SQL Instance
- GCP Static IP
- GCP Storage
- Ghost Inspector Sync
- K8s Access
- K8s ConfigMap
- K8s Deployment
- K8s HPA
- K8s HTTP Gateway Route
- K8s HTTP Health Check Policy
- K8s Memcached
- K8s Namespace
- K8s PDB
- K8s Secret
- K8s Service
- K8s Shared HTTP Gateway
- NewRelic APM Browser
- NewRelic Synthetic Monitors