IaC Bazaar
Google CloudLive-tested

Cloud KMS Keyring & Keys

Keyrings and rotation-enabled crypto keys with per-key IAM for CMEK across GCS, BigQuery, Cloud SQL and disks.

terraformGoogle Cloud#gcp

Compare Secrets & Key Management across clouds →

Part of: GCP Production Landing Zone

gcp-kmsterraform 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 tests (mocked: validation rules · outputs)

Provenance

Functional

  • Live-tested - applied, verified, destroyed

Last verified 2026-08-03 · 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-kms-1.0.0.sigstore.json \
  https://www.iac-bazaar.com/api/artifacts/gcp-kms/signature

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

# 4. (optional) confirm the checksum too
echo "ad696276cf5cc0bc334c002d03ae6ecedb6f50b4ace4be179207ca72d665e2bd  gcp-kms-1.0.0.tar.gz" | sha256sum -c

Use it from the registry

terraform · opentofu
module "kms" {
  source  = "www.iac-bazaar.com/iac-bazaar/gcp-kms/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-kms

A Cloud KMS key ring and its crypto keys, with automatic rotation on by default for symmetric keys and least-privilege per-key IAM for CMEK across GCS, BigQuery, Cloud SQL, Compute disks, and any other service that accepts a customer-managed encryption key. Works with Terraform and OpenTofu (>= 1.6), Google provider >= 7.0, < 8.0.

Status: static-validated, live-test pending. Ships under live-test quarantine — validated with tofu fmt, tofu validate, and tflint. Real apply → verify → destroy against a GCP project is pending a cloud sandbox. KMS live-testing is special: key rings and keys are not deletable, so a live lane must randomize names and treat "destroy" as versions scheduled for destruction — see the lifecycle note below.

Secure defaults

  • Rotation on by default — symmetric ENCRYPT_DECRYPT keys rotate every 90 days (7776000s) unless you override rotation_period. Rotation only applies to symmetric keys; the module auto-nulls rotation_period for asymmetric/MAC keys, so their minimal config applies without having to set rotation_period = null yourself.
  • Least-privilege per-key IAM — grants are additive google_kms_crypto_key_iam_member bindings scoped to a single key, so a CMEK consumer gets exactly cryptoKeyEncrypterDecrypter on the one key it needs, never broad ring-wide access.
  • destroy_scheduled_duration (default 30 days) — the real deletion guard: a destroy only schedules key-version destruction, cancellable for 30 days before material is irreversibly gone. The module deliberately does NOT hardcode lifecycle.prevent_destroy (lifecycle meta-args can't be made configurable, and a hardcoded true blocks teardown in composition roots and CI) — wrap the module and add your own lifecycle block if you also want plan-time protection.
  • Regional location encouraged — keep key material within a jurisdiction; HSM protection (protection_level = "HSM", FIPS 140-2 L3) available per key.

Requirements

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

License

Commercial — LicenseRef-IaCBazaar-Commercial.

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.

  • Lifecycle caveat (important)
  • Usage
  • Inputs
  • Outputs

Related modules