# ionoscloud\_s3\_bucket\_lifecycle\_configuration

Manages Lifecycle Configuration for Buckets on IONOS CLOUD.

## Example Usage

```hcl
resource "ionoscloud_s3_bucket" "example" {
  name = "example"
}

resource "ionoscloud_s3_bucket_lifecycle_configuration" "example" {
  bucket = ionoscloud_s3_bucket.example.name
  rule {
    id     = "1"
    status = "Enabled"
    filter {
      prefix = "/logs"
    }
    expiration {
      days = 90
    }
  }

  rule {
    id     = "2"
    status = "Enabled"
    filter {
      prefix = "/logs"
    }
    noncurrent_version_expiration {
      noncurrent_days = 90
    }
  }

  rule {
    id     = "3"
    status = "Enabled"
    filter {
      prefix = "/logs"
    }
    abort_incomplete_multipart_upload {
      days_after_initiation = 90
    }
  }
}
```

## Argument Reference

The following arguments are supported:

* `bucket` - (Required)\[string] The name of the bucket where the object will be stored.
* `lifecycle_rule` - (Required)\[block] A block of lifecycle\_rule as defined below.
  * `id` - (Optional)\[int] Container for the Contract Number of the owner
  * `prefix` - (Required)\[string] DEPRECATED! This field does not do anything! Will be removed in a future version, use `filter` instead. Prefix identifying one or more objects to which the rule applies.
  * `filter - (Optional)[block] A filter identifying one or more objects to which the rule applies.`
    * `prefix` - (Optional)\[string] Prefix identifying one or more objects to which the rule applies. Cannot be used at the same time as `prefix` in the lifecycle rule.
  * `status` - (Required)\[string] The lifecycle rule status. Valid values are `Enabled` or `Disabled`.
  * `expiration` - (Optional)\[block] A lifecycle rule for when an object expires.
    * `days` - (Optional)\[int] Specifies the number of days after object creation when the object expires. Required if 'date' is not specified.
    * `date` - (Optional)\[string] Specifies the date after which you want the specific rule action to take effect.
    * `expired_object_delete_marker` - (Optional)\[bool] Indicates whether IONOS Object Storage will remove a delete marker with no noncurrent versions. If set to true, the delete marker will be expired; if set to false the policy takes no operation. This cannot be specified with Days or Date in a Lifecycle Expiration Policy.
  * `noncurrent_version_expiration` - (Optional)\[block] A lifecycle rule for when non-current object versions expire.
    * `noncurrent_days` - (Optional)\[int] Specifies the number of days an object is noncurrent before the associated action can be performed.
  * `abort_incomplete_multipart_upload` - (Optional)\[block] Specifies the days since the initiation of an incomplete multipart upload that IONOS Object Storage will wait before permanently removing all parts of the upload.
    * `days_after_initiation` - (Optional)\[int] Specifies the number of days after which IONOS Object Storage aborts an incomplete multipart upload.

## Import

IONOS Object Storage Bucket lifecycle configuration can be imported using the `bucket` name.

```shell
terraform import ionoscloud_s3_bucket_lifecycle_configuration.example example
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ionos.com/terraform-provider/resources/s3_bucket_lifecycle_configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
