Resource

dcloud_bucket_lifecycle

A bucket's lifecycle rules: objects, old versions and unfinished uploads expire by age, applied by object storage once a day. Destroying it removes every rule.

Example Usage

resource "dcloud_bucket_lifecycle" "uploads" {
  bucket = dcloud_bucket.uploads.id

  rules = jsonencode([
    {
      id                                 = "tmp"
      prefix                             = "tmp/"
      expirationDays                     = 7
      abortIncompleteMultipartUploadDays = 1
    },
    {
      id                              = "old-versions"
      prefix                          = ""
      noncurrentVersionExpirationDays = 30
    },
  ])
}

Schema

Required

  • bucket (String) The id of the parent resource ({name} in the path). Changing it replaces the resource.
  • rules (String) The rules, [{ id, prefix, expirationDays, noncurrentVersionExpirationDays, abortIncompleteMultipartUploadDays }]; use jsonencode.

Read-Only

  • id (String) The resource's id.

Import

Import is supported using the following syntax:

The terraform import command can be used, for example:

terraform import dcloud_bucket_lifecycle.uploads <bucket-name>

Generated from the provider's schema.