Skip to content

rso_bucket (Resource)

An S3-compatible object storage bucket. Its name on the S3 endpoint is bucket, not name: use bucket, endpoint and region with any S3 client, with path-style addressing and an rso_bucket_key. Buckets are created and destroyed only through this resource or the console, not with an S3 client. A bucket must be empty before it can be destroyed.

Example Usage

# An S3-compatible bucket and an access key for it.
resource "rso_bucket" "assets" {
  name = "tf-example-assets"
}

resource "rso_bucket_key" "ci" {
  name = "tf-example-ci"
}

# Point any S3 client at these, with path-style addressing. `bucket` is the
# real name on the endpoint (the name above with your tenant's prefix):
#   AWS_DEFAULT_REGION=<region> aws --endpoint-url <endpoint> s3 ls s3://<bucket>/
output "bucket" {
  value = rso_bucket.assets.bucket
}

output "region" {
  value = rso_bucket.assets.region
}

output "endpoint" {
  value = rso_bucket.assets.endpoint
}

output "access_key_id" {
  value = rso_bucket_key.ci.access_key_id
}

output "secret_access_key" {
  value     = rso_bucket_key.ci.secret_access_key
  sensitive = true
}

Schema

Required

  • name (String) Display name, unique within the tenant: 3-40 lowercase letters, digits and dashes. S3 clients do not know this name; see bucket. Changing it creates a new bucket.

Read-Only

  • bucket (String) The real bucket name on the S3 endpoint: name with the tenant's prefix. Use this with S3 clients.
  • endpoint (String) S3 endpoint URL.
  • id (String) The ID of this resource.
  • region (String) Region to configure in S3 clients. It names where the storage is; the endpoint has a single region.

Import

Import is supported using the following syntax:

# Import an existing bucket by its short name.
terraform import rso_bucket.assets assets