Skip to content

GCP Storage

udx-github edited this page Oct 3, 2026 · 5 revisions

Creates a Google Cloud Storage bucket with configurable lifecycle rules, CORS, website hosting, autoclass, and versioning.

Use this module when a Rabbit service needs a GCS bucket for media storage, backups, static site hosting, or other object storage needs.

Supported Features

  • GCS bucket creation.
  • Object versioning.
  • Multiple lifecycle rules per bucket, with Delete and SetStorageClass actions and the full GCS condition set (age, noncurrent versions, storage class matches, and more).
  • CORS configuration.
  • Static website hosting configuration.
  • Autoclass automatic storage class management.
  • Uniform bucket-level access and public access prevention.
  • Custom labels.

Prerequisites

  • GCP credentials with permission to manage Cloud Storage buckets.

Important Notes

  • bucket_name must be globally unique across all GCP projects.
  • Buckets get no lifecycle rule unless one is declared.
  • autoclass cannot be enabled together with SetStorageClass lifecycle rules, and it requires the STANDARD default storage class; the plan fails on either combination.
  • A Delete lifecycle action must not set storage_class; a SetStorageClass action requires it. The plan fails fast on either mistake.
  • The 6.9.x singular lifecycle_rule key is still accepted when lifecycle_rules is absent; new manifests should use the lifecycle_rules list.
  • Public Rabbit service YAML inputs are provided under configurations:.

Minimal Example

services:
  - name: "GCP Storage"
    module: "gcp-storage"
    id: "storage-bucket"
    deployment_order: 14
    configurations:
      bucket_name: "my-project-media"
      region: "US"

Lifecycle Example

services:
  - name: "GCP Storage"
    module: "gcp-storage"
    id: "storage-bucket"
    deployment_order: 14
    configurations:
      bucket_name: "my-project-media"
      region: "US"
      storage_class: "STANDARD"
      lifecycle_rules:
        - action:
            type: "SetStorageClass"
            storage_class: "NEARLINE"
          condition:
            age: 90
            matches_storage_class: ["STANDARD"]
        - action:
            type: "Delete"
          condition:
            num_newer_versions: 3
            with_state: "ARCHIVED"

Outputs

Output Description
bucket_name The name of the created bucket.
bucket_url The gs:// URL of the created bucket.

Full Configuration Schema

The fields below are public module inputs under configurations:.

Field Type Required Description
bucket_name string No Bucket name. Defaults to rabbit-automation-action-bucket.
region string No Bucket location. Defaults to US.
storage_class string No Storage class. Defaults to NEARLINE, or STANDARD when autoclass is enabled.
versioning boolean No Enables object versioning. Defaults to true.
lifecycle_rules list[object] No Lifecycle rules. Defaults to no rules.
lifecycle_rules[].action.type string Yes Delete or SetStorageClass.
lifecycle_rules[].action.storage_class string No Target class. Required for SetStorageClass, rejected for Delete.
lifecycle_rules[].condition.age number No Object age in days.
lifecycle_rules[].condition.created_before string No Date (YYYY-MM-DD).
lifecycle_rules[].condition.with_state string No LIVE, ARCHIVED, or ANY.
lifecycle_rules[].condition.matches_storage_class list[string] No Storage classes the rule applies to.
lifecycle_rules[].condition.matches_prefix list[string] No Object name prefix filters.
lifecycle_rules[].condition.matches_suffix list[string] No Object name suffix filters.
lifecycle_rules[].condition.num_newer_versions number No Noncurrent version count.
lifecycle_rules[].condition.custom_time_before string No Date (YYYY-MM-DD).
lifecycle_rules[].condition.days_since_custom_time number No Days since a custom timestamp.
lifecycle_rules[].condition.days_since_noncurrent_time number No Days since an object became noncurrent.
lifecycle_rules[].condition.noncurrent_time_before string No Date (YYYY-MM-DD) cutoff for when an object became noncurrent.
cors list[object] No CORS entries.
cors[].origin list[string] No Allowed origins.
cors[].method list[string] No Allowed HTTP methods.
cors[].response_header list[string] No Allowed response headers.
cors[].max_age_seconds number No Preflight cache duration.
website object No Static website hosting configuration.
website.main_page_suffix string No Index document.
website.not_found_page string No 404 document.
autoclass object No Autoclass configuration. Conflicts with SetStorageClass rules.
autoclass.enabled boolean No Enables autoclass.
autoclass.terminal_storage_class string No Terminal class (NEARLINE or ARCHIVE).
uniform_bucket_level_access boolean No Enables uniform bucket-level access. Defaults to false.
public_access_prevention string No inherited or enforced. Defaults to the GCP project setting.
requester_pays boolean No Enables requester pays. Defaults to false.
force_destroy boolean No Deletes contained objects when the bucket is destroyed. Defaults to false.
labels map[string] No Labels applied to the bucket.

Clone this wiki locally