resource "aws_s3_bucket" "default" { bucket = "bucket-name" } resource "null_resource" "default" { triggers = { bucket = aws_s3_bucket.default.bucket } depends_on = [ aws_s3_bucket.default ] provisioner "local-exec" { when = destroy command = "aws s3 rm s3://${self.triggers.bucket} --recursive" } }