Cloud KMS Keyring & Keys
Keyrings and rotation-enabled crypto keys with per-key IAM for CMEK across GCS, BigQuery, Cloud SQL and disks.
Compare Secrets & Key Management 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 tests (mocked: validation rules · outputs)
Provenance
- SHA-256 checksum
- Cosign signature
Functional
- Live-tested - applied, verified, destroyed
Last verified 2026-08-03 · 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-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 -cUse it from the registry
terraform · opentofumodule "kms" {
source = "www.iac-bazaar.com/iac-bazaar/gcp-kms/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-kms?utm_source=syndication&utm_medium=readme&utm_campaign=artifact)
Terraform module 1.0.0, live-tested on IaC Bazaar: [Cloud KMS Keyring & Keys](https://www.iac-bazaar.com/catalog/gcp-kms?utm_source=syndication&utm_medium=readme&utm_campaign=artifact)
```hcl
module "kms" {
source = "www.iac-bazaar.com/iac-bazaar/gcp-kms/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-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.
Key rings and keys are not deletable. This is a Cloud KMS property, not a module limitation:
destroyschedules key versions for destruction and leaves the ring in place, so anything that creates and removes these repeatedly has to randomize names. See the lifecycle note below.
Secure defaults
- Rotation on by default — symmetric
ENCRYPT_DECRYPTkeys rotate every 90 days (7776000s) unless you overriderotation_period. Rotation only applies to symmetric keys; the module auto-nullsrotation_periodfor asymmetric/MAC keys, so their minimal config applies without having to setrotation_period = nullyourself. - Least-privilege per-key IAM — grants are additive
google_kms_crypto_key_iam_memberbindings scoped to a single key, so a CMEK consumer gets exactlycryptoKeyEncrypterDecrypteron 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 hardcodelifecycle.prevent_destroy(lifecycle meta-args can't be made configurable, and a hardcodedtrueblocks 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 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.
- Lifecycle caveat (important)
- Usage
- Inputs
- Outputs
Related modules
gcp-certificate-authority
The DevOps tier does not persist the certificates it issues: no record, no CRL, no revocation - a year-long certificate from it can only answer a key compromise by the CA being distrusted whole. ENTERPRISE tier with the CRL published, a 90-day ceiling on every certificate, RSA below 2048 refused, and deletion protection on because deleting a CA invalidates everything it signed.
gcp-certificate-manager
A Certificate Manager certificate map for external HTTPS load balancers, with an optional Google-managed certificate and DNS authorization provisioned when you supply a domain you control.
gcp-secret-manager
Secrets with versions, replication policy, rotation schedules, expiry and accessor IAM.
huawei-csms-secret
A secret in Huawei Cloud Secrets Manager whose value is a sensitive variable supplied at apply time and never output, encrypted with a KMS key of yours rather than the account's default CSMS key (the default by name), with an expiry after which CSMS flags it (none by name) and event subscriptions that notice version changes and expiry.
exoscale-kms-key
A key is zonal unless multi-zone, which is the surprise at the first cross-zone restore; and the service has no automatic rotation setting and no flag that refuses deletion, so a key is deleted in one call. Multi-zone unless told otherwise, and outputs that say rotation and deletion protection are not available, so nothing downstream assumes a control that is not there.
alicloud-kms-key
automatic_rotation defaults to Disabled, so today's key material encrypts everything for the life of the account; a key scheduled for deletion is gone after its window with everything encrypted under it; and deletion_protection, the switch that refuses the schedule, defaults to off. Rotation on at your interval, deletion protection on and off by name, the maximum pending window, and an alias.