IaC Bazaar
Google CloudLive-tested

Cloud Storage Bucket

Hardened GCS bucket with uniform access, versioning, lifecycle/soft-delete policies, CMEK and least-privilege IAM.

terraformGoogle Cloud#gcp

Compare Object Storage across clouds →

Part of: GCP Production Landing Zone

gcp-gcs-bucketterraform 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 pending (Checkov)
  • Plan test superseded by live test

Provenance

Functional

  • Live-tested - applied, verified, destroyed

Last verified 2026-06-30 · 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-gcs-bucket-1.0.1.sigstore.json \
  https://www.iac-bazaar.com/api/artifacts/gcp-gcs-bucket/signature

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

# 4. (optional) confirm the checksum too
echo "9c4ae906094c95cc52fe636847fa33ba8eb3d7b5a2fd5338355b49301ab09034  gcp-gcs-bucket-1.0.1.tar.gz" | sha256sum -c

Use it from the registry

terraform · opentofu
module "gcs_bucket" {
  source  = "www.iac-bazaar.com/iac-bazaar/gcp-gcs-bucket/gcp"
  version = "1.0.1"
}

Free module — Terraform/OpenTofu downloads it with no token or setup. 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.

This module is in the Free band, and a free account sees the contract of every Free module — no subscription needed.

Documentation

gcp-gcs-bucket

Hardened GCS bucket with uniform access, versioning, lifecycle/soft-delete policies, CMEK and least-privilege IAM. Works with Terraform and OpenTofu (>= 1.6), Google provider >= 7.0, < 8.0.

Secure defaults:

  • Uniform bucket-level access always on (no object ACLs to drift)
  • public_access_prevention = "enforced" — and the module rejects allUsers / allAuthenticatedUsers IAM members at plan time
  • Object versioning on, paired with a default lifecycle rule keeping the 10 newest noncurrent versions and aborting stale multipart uploads after 7 days
  • Soft delete at GCP's 7-day default (tunable 7-90 days, or 0 to disable)
  • Optional CMEK, Autoclass, WORM retention and access logging

Requirements

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

Notes for integrators:

  • CMEK: grant the Cloud Storage service agent (service-PROJECT_NUMBER@gs-project-accounts.iam.gserviceaccount.com) roles/cloudkms.cryptoKeyEncrypterDecrypter on the key before enabling, or bucket creation fails.
  • Retention lock: retention_policy.is_locked = true is irreversible — the bucket cannot be deleted until every object exceeds the retention period.
  • Autoclass requires storage_class = "STANDARD"; the module enforces this at plan time.
  • The IAM map uses static keys, so member values may be unknown at plan time (e.g. another module's service-account output).

License

Commercial — IaC Bazaar EULA. © 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