openstack_objectstorage_container_v1

Manages a V1 container resource within OpenStack.

Example Usage

Basic Container

resource "openstack_objectstorage_container_v1" "container_1" {
  region = "RegionOne"
  name   = "tf-test-container-1"

  metadata = {
    test = "true"
  }

  content_type = "application/json"
  versioning   = true
}

Basic Container with legacy versioning

resource "openstack_objectstorage_container_v1" "container_1" {
  region = "RegionOne"
  name   = "tf-test-container-1"

  metadata = {
    test = "true"
  }

  content_type = "application/json"

  versioning_legacy {
    type     = "versions"
    location = "tf-test-container-versions"
  }
}

Global Read Access

# Requires that a user know the object name they are attempting to download

resource "openstack_objectstorage_container_v1" "container_1" {
  region = "RegionOne"
  name   = "tf-test-container-1"

  container_read = ".r:*"
}

Global Read and List Access

# Any user can read any object, and list all objects in the container

resource "openstack_objectstorage_container_v1" "container_1" {
  region = "RegionOne"
  name   = "tf-test-container-1"

  container_read = ".r:*,.rlistings"
}

Write-Only Access for a User

data "openstack_identity_auth_scope_v3" "current" {
  name = "current"
}

# The named user can only upload objects, not read objects or list the container

resource "openstack_objectstorage_container_v1" "container_1" {
  region = "RegionOne"
  name   = "tf-test-container-1"

  container_read  = ".r:-${var.username}"
  container_write = "${data.openstack_identity_auth_scope_v3.current.project_id}:${var.username}"
}

Argument Reference

The following arguments are supported:

The versioning_legacy block supports:

Attributes Reference

The following attributes are exported:

Import

This resource can be imported by specifying the name of the container:

Some attributes can't be imported :

So you'll have to terraform plan and terraform apply after the import to fix those missing attributes.

$ terraform import openstack_objectstorage_container_v1.container_1 container_name