Skip to content

frostmoln_bucket (Data Source) ​

Look up an object storage bucket by name. The bucket's name IS its id — the /buckets surface addresses a bucket by name — so name is the one identity and id mirrors it.

This is how a configuration reaches a bucket that Terraform did not create: a bucket provisioned in the portal or with fm can today be referenced only by a hardcoded name plumbed through terraform_remote_state — look it up by name here and the reference survives re-provisioning elsewhere. The resolver is one direct GET of the bucket, never a list search: a name the path can carry directly needs no search, and a flat 404 fails the read (a nested unrouted-path 404 is not a verdict about the bucket and surfaces as a generic failure).

The CORS rules, lifecycle rules and website configuration are deliberately NOT exported here: those collections are owned by frostmoln_bucket_cors_configuration and frostmoln_bucket_lifecycle_configuration (the website surface has no dedicated resource today), and one collection must have one owner and one shape — read them through those resources, never thirst for a second rendering of them here.

Example Usage ​

terraform
# Resolve an object-storage bucket that Terraform did not create
# (provisioned in the portal or with `fm`). A bucket's name IS its id, so
# there is nothing to resolve but the name.
data "frostmoln_bucket" "billing_backups" {
  name = "billing-backups"
}

# The resolved bucket feeds references elsewhere — e.g. an S3 credential
# scoped to it, or a check block pinning its exposure.
check "billing_backups_stays_private" {
  assert {
    condition     = data.frostmoln_bucket.billing_backups.acl == "private"
    error_message = "the billing-backups bucket must stay private"
  }
}

# object_count and total_size (bytes) are measured answers: an empty bucket
# renders 0, not null. quota_bytes is null when the bucket is unlimited.
output "billing_backups_usage" {
  value = {
    objects = data.frostmoln_bucket.billing_backups.object_count
    bytes   = data.frostmoln_bucket.billing_backups.total_size
  }
}

# The CORS rules and lifecycle rules are deliberately NOT exported here: they
# belong to the dedicated configuration resources.
#   frostmoln_bucket_cors_configuration
#   frostmoln_bucket_lifecycle_configuration

Schema ​

Required ​

  • name (String) The name of the bucket. Also serves as the unique identifier — a bucket's name IS its id, exactly as frostmoln_bucket's import addresses a bucket by name.

Read-Only ​

  • acl (String) The access control setting of the bucket (private, public-read, public-read-write, or authenticated-read).
  • created_at (String) The timestamp when the bucket was created.
  • default_storage_class (String) The default storage class for new objects in the bucket (STANDARD, STANDARD_IA, REDUCED_REDUNDANCY, or GLACIER).
  • id (String) The identifier of the bucket — the same string as name, deliberately mirrored rather than distinct: the object-storage surface has no server-side id beyond the name.
  • object_count (Number) The number of objects in the bucket. Zero renders as 0 — an empty bucket is a measured answer, not an absence.
  • quota_bytes (Number) The maximum size quota of the bucket in bytes, null when the bucket is unlimited (the wire omits the quota, which IS "no limit").
  • region (String) The region where the bucket is located, null when the platform has not recorded one.
  • tags (Map of String) The user-defined tags on the bucket, null when it carries none. The platform stores its own control-plane metadata in the same tag set and strips those keys from this map; what renders here is the customer's tags only.
  • tenant_id (String) The tenant ID that owns this bucket.
  • total_size (Number) The total size of all objects in the bucket, in bytes. Zero renders as 0 — an empty bucket is a measured answer, not an absence.
  • updated_at (String) The timestamp when the bucket was last updated.
  • versioning (String) The versioning state of the bucket (disabled, enabled, or suspended).