oracle / terraform-provider-oci

Terraform Oracle Cloud Infrastructure provider
https://www.terraform.io/docs/providers/oci/
Mozilla Public License 2.0
758 stars 680 forks source link

oci_objectstorage_bucket allow force_delete #2071

Open gotsysdba opened 7 months ago

gotsysdba commented 7 months ago

Community Note

Description

When deleting an object storage bucket, with objects, it fails with:

Error: 409-BucketNotEmpty, Bucket named '<bucket_name>' is not empty. Delete all object versions first.

to workaround, manual deletion of objects is required; which is not ideal for automation. Alternatively, it is required to implement a local-exec Provisioner to call the OCI API which does support the force delete option:

oci os object bulk-delete -ns <oci_object_storage.namespace> -bn <bucket_name> --force

New or Affected Resource(s)

oci_objectstorage_bucket

Potential Terraform Configuration

resource "oci_objectstorage_bucket" "test_bucket" {
    #Required
    compartment_id = var.compartment_id
    name = var.bucket_name
    namespace = var.bucket_namespace

    #Optional
    force_delete = var.bucket_force_delete
}

References

documentation

shivinvijai commented 3 months ago

When will "force_delete" option come in OCI terraform module for deleting buckets having objects?