AWSLive-testedattested

KMS Key with Policy Patterns

Customer-managed KMS keys with sane key policies, aliases, rotation, and multi-region replicas.

terraformAWSaws

Compare Secrets & Key Management across clouds →

Part of: AWS Production Landing Zone

aws-kmsvizier v1.2.0

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-11 · 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 aws-kms-1.0.0.sigstore.json \
  https://www.iac-bazaar.com/api/artifacts/aws-kms/signature

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

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

Use it from the registry

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

Paste 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.

README.md, GitLab, Gitea
[![IaC Bazaar: live-tested](https://www.iac-bazaar.com/api/artifacts/aws-kms/badge)](https://www.iac-bazaar.com/catalog/aws-kms?utm_source=syndication&utm_medium=readme&utm_campaign=artifact)

Terraform module 1.0.0, live-tested on IaC Bazaar: [KMS Key with Policy Patterns](https://www.iac-bazaar.com/catalog/aws-kms?utm_source=syndication&utm_medium=readme&utm_campaign=artifact)

```hcl
module "kms" {
  source  = "www.iac-bazaar.com/iac-bazaar/aws-kms/aws"
  version = "1.0.0"
}
```

Preview:IaC Bazaar: live-tested

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

aws-kms

Customer-managed KMS key with a least-privilege, lockout-safe key policy, automatic rotation on by default, aliases, and optional multi-region replicas. Works with Terraform and OpenTofu (>= 1.6), AWS provider >= 6.0, < 7.0. The generated key policy follows the AWS reference pattern — account root keeps kms:* so the key is never orphaned, while administrators, users, and AWS service principals get only the actions they need.

KMS destroy is non-immediate by design: terraform destroy only schedules deletion (deletion_window_in_days, 7 to 30 days), and the key remains billable (about $1/month) and recoverable until the window elapses. This is an expected exception to the marketplace's instant destroyConfirmed semantics, not a teardown failure.

What you get:

  • aws_kms_key — symmetric or asymmetric/HMAC, with rotation, a deletion window, and an optional multi-region primary.
  • aws_kms_key_policy — a generated least-privilege document (override with a full policy JSON string if you need to).
  • aws_kms_alias — one or more alias/<name> aliases pointed at the key.
  • aws_kms_replica_key — cross-region replicas of a multi-region primary.

Secure defaults

  • Rotation on (enable_key_rotation = true) for symmetric encryption keys; automatically nulled for asymmetric/HMAC specs that do not support it.
  • Generated least-privilege policy: root keeps kms:* (the non-lockout safeguard), administration and cryptographic use are split into separate statements, and service principals are pinned to your account via kms:CallerAccount. Key-user grant creation is restricted to AWS resources (kms:GrantIsForAWSResource).
  • 30-day deletion window by default — the maximum recovery runway.
  • bypass_policy_lockout_safety_check defaults to false; the safety check stays on.
  • Reserved aws/* alias names and AWS-managed keys are rejected by validation.

Provider pin

aws = {
  source  = "hashicorp/aws"
  version = ">= 6.0, < 7.0"
}

License

Commercial — LicenseRef-IaCBazaar-Commercial. © 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

Static validatedLive test pending

aws-cloudhsm

Cluster and HSMs, with the parts nobody mentions: AWS holds no copy of your keys, Terraform cannot initialise the cluster, and an uninitialised cluster bills per HSM per hour while being unable to store anything.

View module
Live-tested

aws-acm

Requests a public, DNS-validated ACM TLS certificate that ACM auto-renews forever, outputting the validation records to publish - CT logging on, wildcards and SANs supported.

View module
Static validatedLive test pending

aws-private-ca

A root or subordinate CA with revocation configured, its certificate installed in the same apply, and ACM permitted to issue from it. Documents the two traps: a CA bills through its deletion window, and one without CRL or OCSP can issue certificates it can never revoke.

View module
Live-tested

aws-ssm-parameter-store

Map-driven SSM Parameter Store parameters - String, StringList, and SecureString - created from a single map, with SecureString always KMS-encrypted and the free Standard tier by default.

View module
Live-tested

aws-secrets-manager

Secrets with versioning, resource policies, replication, and optional Lambda rotation scaffolding.

View module
Live-tested

ansible-chamber

chamber on EL 10 from the GitHub release; get_url refuses it unless its SHA-256 is in the vendor's checksums file, and the live test re-checks it, then runs list with no credentials and the metadata service off, expecting 'no EC2 IMDS role found', and exercises the null backend (a list answered, a read refused). Pinned. Original role, live-tested on Rocky Linux 10.

View module