IaC Bazaar
AWSLive-tested

Secrets Manager Secret

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

terraformAWS#aws

Compare Secrets & Key Management across clouds →

Part of: AWS Production Landing Zone, AWS Container Platform (EKS)

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

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

# 4. (optional) confirm the checksum too
echo "8e9c73162cde1e2bf65264fbc240872d46df80d685310a2d4ce4483e0e972ea4  aws-secrets-manager-1.0.0.tar.gz" | sha256sum -c

Use it from the registry

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

aws-secrets-manager

Secrets Manager secret with CMK-capable encryption, a TLS-only resource policy, optional cross-region replication, an optional initial version, and Lambda rotation scaffolding. Works with Terraform and OpenTofu (>= 1.6), AWS provider >= 6.0, < 7.0. The default posture creates no initial version — the value is managed out of band — and when you do seed a value the write-only path (secret_string_wo, Terraform 1.11+) keeps it out of state entirely.

Status: static-validated, live-test pending. Ships under live-test quarantine — validated with tofu fmt, tofu validate, and tflint. Real apply → read → destroy against an AWS account is pending a cloud sandbox. Live tests will set recovery_window_in_days = 0 for a clean (immediate, irrecoverable) destroy; production keeps the default 30-day recovery window. A standing secret costs ~$0.40/secret/month.

What you get:

  • aws_secretsmanager_secret — CMK or AWS-managed encryption, recovery window, cross-region replicas.
  • aws_secretsmanager_secret_version — optional initial version, with a state-stored (secret_string) or write-only (secret_string_wo) value.
  • aws_secretsmanager_secret_policy — a generated TLS-only resource policy with block_public_policy on (override with a full policy JSON string).
  • aws_secretsmanager_secret_rotation — opt-in Lambda rotation on a days or cron/rate schedule.

Secure defaults

  • Always encrypted: AWS-managed aws/secretsmanager key by default; pass a CMK via kms_key_id (recommended for cross-account or replica access).
  • Values kept out of state by default: no initial version is created (create_initial_version only seeds when you supply a value). When seeding, prefer secret_string_wo (Terraform 1.11+) so the plaintext never enters state; secret_string is the state-stored fallback and is marked sensitive.
  • TLS-only resource policy denying any secretsmanager:* call over a non-TLS connection, with block_public_policy = true so a misconfigured policy can never make the secret world-readable. Cross-account read is off unless you name reader_principal_arns.
  • 30-day recovery window by default — a deleted secret is recoverable; recovery_window_in_days = 0 (immediate, irrecoverable) is reserved for disposable test secrets.

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

Related modules