-
Notifications
You must be signed in to change notification settings - Fork 0
GCP Service Account
udx-github edited this page Aug 25, 2026
·
2 revisions
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. - Adopt pre-existing service accounts (
create: false+service_account_email) to manage their bindings without recreating the account.
- 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. -
create: falseadopts a pre-existing SA: the module manages itsproject_rolesandiam_bindingsbut never creates, modifies, or destroys the account.service_account_emailis required whencreateis false. - 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 or adopt. Keys are stable identifiers
# used in state addressing and outputs; renaming a key recreates the account.
service_accounts:
<key>:
account_id: "" # Required when create is true. 6-30 chars.
create: true # Optional. Set false to adopt a pre-existing SA.
service_account_email: "" # Required when create is false.
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
- Elasticsearch
- GCP Cloud Run
- GCP Cloud Scheduler
- GCP Firebase Realtime Database (
gcp-firebase-rtdb) - 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 ARC Controller
- K8s ARC Runner
- 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