IaC Bazaar
Google CloudStatic-verified

Service Accounts & IAM Bindings

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

terraformGCP#gcp
gcp-service-accounts-iamterraform v1.7

Verification

Static-verified

Passed: validated and lint-clean (provider-schema-validated for AWS/Azure/GCP; Terraform-language lint elsewhere).

Conformance

  • Static validation (fmt · validate · tflint)
  • Security scan clean (Checkov)
  • Plan tests (mocked: validation rules · outputs)

Provenance

  • SHA-256 checksum
  • Signature (pending)

Functional

  • Live test pending (no cloud run yet)

Last verified 2026-06-28 · how we verify

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.

Verification

Static-validated (fmt, validate, tflint). Live apply/destroy testing pending cloud sandbox availability — see catalog status.

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