Service Accounts & IAM Bindings
Service accounts with least-privilege project/resource IAM and optional Workload Identity Federation for keyless CI/CD (GitHub Actions).
Compare Identity & Access across clouds →
Part of: GCP Production Landing Zone
Verification
Live-testedReally 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
- SHA-256 checksum
- Cosign signature
Functional
- Live-tested - applied, verified, destroyed
Last verified 2026-06-30 · how we verify
Verify this download
cosign · sha-256Don'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 -cUse it from the registry
terraform · opentofumodule "service_accounts_iam" {
source = "www.iac-bazaar.com/iac-bazaar/gcp-service-accounts-iam/gcp"
version = "1.0.0"
}Needs a registry token from /account/tokens. The module itself is free; the account is what identifies you. Full setup: registry docs.
Cite it in your README
badge · attributionPaste this beside the module in the repository that uses it. The badge is rendered from this artifact's verification record, so it reads live-tested because the record says so, and the link lands on this page.
[](https://www.iac-bazaar.com/catalog/gcp-service-accounts-iam?utm_source=syndication&utm_medium=readme&utm_campaign=artifact)
Terraform module 1.0.0, live-tested on IaC Bazaar: [Service Accounts & IAM Bindings](https://www.iac-bazaar.com/catalog/gcp-service-accounts-iam?utm_source=syndication&utm_medium=readme&utm_campaign=artifact)
```hcl
module "service_accounts_iam" {
source = "www.iac-bazaar.com/iac-bazaar/gcp-service-accounts-iam/gcp"
version = "1.0.0"
}
```Preview:
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 module in the catalogue. There is no subscription and nothing to buy - the modules are free to download, and they run under Vizier.
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_conditionis 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_principalsentries map toprincipalSet://.../<entry>members, e.g.attribute.repository/my-org/my-app(whole repo) — attributes must exist inattribute_mappingto be usable.- The default issuer is GitHub Actions; point
issuer_uri(plus your ownattribute_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_idor 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 need an account
The complete copy-paste usage, the full input/output reference, and operational notes are free with an account - shown here and bundled in the download. Sign in and this section fills in.
- Usage
- Inputs
- Outputs
Related modules
gcp-firewall-policy
A global network firewall policy exists independently of any network; an association puts it in the path, and a policy with a hundred rules and none governs nobody while rendering as fully configured. enable_logging defaults to false on every rule, so a deny that fires leaves no evidence. Refuses a policy with no network, logs every rule unless told not to, and counts the disabled ones.
gcp-service-perimeter
spec is the dry-run configuration and status is the enforced one - two blocks of the same shape, and a perimeter with only a spec is evaluated on every request, logs violations, and blocks nothing. Empty restricted_services is the other way to have none: the perimeter exists, covers the projects, and governs no API.
gcp-dlp
Sensitive Data Protection on a schedule: an inspection template naming the detectors and a weekly trigger over a bucket or a BigQuery table, sampling ten percent of each file, scanning only what changed since the last run, with findings written to your dataset without the matched values and a summary sent to Security Command Center. A full scan, billed per byte, is accepted by name.
gcp-recaptcha
A key with a testing score returns that score for every assessment, bots included - right for staging and, on a production key, a filter that filters nothing; allow_all_domains lets any site consume your assessments against your quota. Testing mode refused without acceptance, domains required on web keys, invisible scoring by default; only a backend assessment call turns a token into a decision.
gcp-secure-web-proxy
A gateway with no rules allows nothing, and a session matcher of true is an open proxy to the internet; the gateway needs a proxy-only subnet in the region that is yours to make; and without TLS inspection the proxy sees the SNI hostname and nothing inside. Rules built from a URL list of your hosts, allow-all accepted by name only, outputs that say what is allowed and that TLS is not inspected.
gcp-cloud-ids
Creating the endpoint creates no packet mirroring policy, so an endpoint with nothing mirrored is provisioned, billed by the hour, shown with a green check and has never seen a packet. The mirroring policy is created with it and refused when it mirrors nothing. Cloud IDS detects and never blocks; blocks_traffic is an output that is always false.