Closed universam1 closed 5 years ago
Terraform has a decent support for that including to remove versions https://github.com/hashicorp/terraform/pull/2007/files
Hi! Thanks for this suggestion but this isn't something that would be included within sparkle_formation or sfn proper. This is because unlike terraform, these tools simply utilize orchestration tools (CFN, ARM, TF, etc). The best location for the support being added would be in the actual implementation itself (CFN here).
The sfn tool can be extended by plugins, however. And a plugin would be a great location to provide customized support for a feature like this. So I spun out a quick plugin that just uses the miasma library for removing objects in a bucket when non-empty before destruction. Since miasma-aws doesn't yet support batch deletions, it likely won't be ideal for very large buckets, but different plugin implementations can easily be generated.
https://github.com/sparkleformation/sfn-bucketpurge
Cheers!
That’s amazing work! Will try it ASAP
Thanks!
cc @sme
Destroying a stack in AWS will fail if any bucket is not emptied beforehand. That is an oddity on Cloudformation since other data backends are purged anyway.
For our CI this is a problem because it requires a mutation of the pipelines compared to CD with some sort of extra cleanup stages.
It would be extremely helpful if sfn would have an option to empty all buckets run before cfn destroy to successfully delete such stacks! Also for local development it would simplify processes a lot!
Thanks for considering!