IaC Bazaar
Google CloudLive-tested

Service Accounts & IAM Bindings

Service accounts with least-privilege project/resource IAM and optional Workload Identity Federation for keyless CI/CD (GitHub Actions).

terraformGoogle Cloud#gcp

Part of: GCP Production Landing Zone

gcp-service-accounts-iamterraform v1.7

Verification

Live-tested

Really deployed to a cloud sandbox, verified against its outputs and assertions, then destroyed - with the teardown confirmed.

Conformance

  • Static validation (fmt · validate · tflint)
  • Security scan clean (Checkov)
  • Plan test superseded by live test

Provenance

Functional

  • Live-tested - applied, verified, destroyed

Last verified 2026-06-30 · how we verify

Verify this download

cosign · sha-256

Don't take our word for it. Every release is signed with cosign - check the bytes against our pinned public key before you trust them.

# 1. Our pinned public key - fetch once, trust out-of-band
curl -O https://www.iac-bazaar.com/cosign.pub

# 2. This module's Sigstore bundle
curl -o gcp-service-accounts-iam-1.0.0.sigstore.json \
  https://www.iac-bazaar.com/api/artifacts/gcp-service-accounts-iam/signature

# 3. Verify the tarball you downloaded
cosign verify-blob \
  --key cosign.pub \
  --bundle gcp-service-accounts-iam-1.0.0.sigstore.json \
  gcp-service-accounts-iam-1.0.0.tar.gz
# → Verified OK

# 4. (optional) confirm the checksum too
echo "d7369ead6f94e3a64a55b8d0fed29be2f1fc7ed22d4ebe23a4b4319fba475850  gcp-service-accounts-iam-1.0.0.tar.gz" | sha256sum -c

Use it from the registry

terraform · opentofu
module "service_accounts_iam" {
  source  = "www.iac-bazaar.com/iac-bazaar/gcp-service-accounts-iam/gcp"
  version = "1.0.0"
}

Paid module — needs a purchase (or a subscription that covers it) plus a registry token from /account/tokens. Full setup: registry docs.

Inputs & outputs

Create a free account to read this module's contract

The declared contract — every input name, type, default and description, plus every output — is shown to signed-in accounts, not to anonymous visitors.

A free account sees the contract of every Free module. This one is Basic, so its contract unlocks when you buy it.

Documentation

gcp-service-accounts-iam

Service accounts with least-privilege project/resource IAM and optional Workload Identity Federation for keyless CI/CD (GitHub Actions). Works with Terraform and OpenTofu (>= 1.6), Google provider >= 7.0, < 8.0.

Secure defaults:

  • No service-account keys, ever — external workloads federate via OIDC (WIF) and impersonate, instead of holding exportable credentials
  • Basic roles (roles/owner, roles/editor) are rejected at plan time
  • Project grants are additive (google_project_iam_member) — safe to compose with IAM managed elsewhere, no authoritative stomping
  • WIF attribute_condition is required: multi-tenant issuers like GitHub would otherwise accept tokens from any org/repo on the platform
  • Sensible GitHub Actions attribute mapping out of the box (subject, repository, repository_owner, ref)

Requirements

  • Terraform or OpenTofu >= 1.6
  • hashicorp/google >= 7.0, < 8.0

Notes for integrators:

  • wif_principals entries map to principalSet://.../<entry> members, e.g. attribute.repository/my-org/my-app (whole repo) — attributes must exist in attribute_mapping to be usable.
  • The default issuer is GitHub Actions; point issuer_uri (plus your own attribute_mapping/attribute_condition) at GitLab, Bitbucket, etc.
  • Deleted WIF pools/providers are soft-deleted for 30 days; re-creating with the same ID within that window fails — use a fresh pool_id or undelete.
  • Granting roles on other resources (buckets, repos, …) belongs to those modules; feed them service_account_members.

License

Commercial — IaC Bazaar EULA. © IaC Bazaar. Original work (not derived from a third-party module).

Usage code & full reference unlock after purchase

The complete copy-paste usage, the full input/output reference, and operational notes ship with your licence - shown here and bundled in the download.

  • Usage
  • Inputs
  • Outputs

Related modules