resource "aws_s3_bucket" "cdn_logs_bucket" {
bucket = "cdn.logs.${local.fqdn}"
acl = "private"
force_destroy = "true"
tags = "${var.tags}"
server_side_encryption_configuration {
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}
}
S3 bucket destroyed in a timely manner (e.g., within minutes)
S3 bucket takes multiple hours to destroy
terraform apply
terraform destroy
seem to work as expected.@mratoms Of what order of magnitude is the number of objects (including all versions) in the bucket?
Internally the provider ends up listing all the object versions in a bucket and deleting them one at a time when the bucket is deleted.
We could look at deleting objects in batches via the DeleteObjects
API.
@ewbankkit If I recall, the buckets that were destroyed had hundreds of thousands of objects in them.
We're encountering this as well
aws_s3_bucket.account_logging_s3_pr[0]: Still destroying... [id=bucketname, 402h21m30s elapsed]
I'm seeing this issue in 0.12.21. The order of magnitude of the objects in the bucket is hundreds of thousands. Deleting the bucket through the web console works just fine, but Terraform just says "Still destroying..." forever.
In my case the issue can be replicated with just 5000 objects in bucket without versioning enabled. Took around 30 minutes. Used 0.12.21 terraform and AWS terraform provider v2.49.0
I have had this happen with ~100 items ina bucket.
module.aws_s3_bucket_NAME.aws_s3_bucket.this[0]: Still destroying... [id=NAME, 58m51s elapsed]
source = "terraform-aws-modules/s3-bucket/aws"
version = "1.9.0"
The performance is terrible especially when deleting a bucket geographically located across the world with a higher latency. It's deleting about 40 objects per minute if deleting a Sydney bucket from London.
Same problem here. While deleting in UI, we can see progress. So, would be great to see some sort of progress indicator here as well.
Terraform v0.12.29
Hi,
Was there any update on this? I haven't tried the new version of the provider but this is really blocking us to migrate to new version and try out the AWS features released in newer versions.
Most helpful comment
In my case the issue can be replicated with just 5000 objects in bucket without versioning enabled. Took around 30 minutes. Used 0.12.21 terraform and AWS terraform provider v2.49.0