gruntwork-io / terragrunt

Terragrunt is a flexible orchestration tool that allows Infrastructure as Code written in OpenTofu/Terraform to scale.
https://terragrunt.gruntwork.io/
MIT License
7.92k stars 966 forks source link

Clean command : Remove S3 bucket and DynamoDB table #250

Open qrevel opened 7 years ago

qrevel commented 7 years ago

Terragrunt is a really nice wrapper to automate the creation of S3 bucket and DynamoDB table. I'm actually using terragrunt to spawn demo enviroment for different development teams. So each team has access to one or multiple demos environment with similar configuration. Each demo has its own stack (S3 bucket, DynamoDB table, and Terraform configuration). Once the demo is finished, I need to clean all the stack. Unfortunately, I was unable to find any command to clean everything, even the bucket and the table.

Thanks

brikis98 commented 7 years ago

Hm, I wonder how common of a use case this would be? Usually, Terraform state and locks are important info, so I wouldn't expect it to be deleted too often. On the other hand, for experimenting, learning, and testing, it would be nice to have an easy way to clean up, so I guess I'm not against a terragrunt-clean command. PRs welcome :)

ryan-dyer-sp commented 7 years ago

Would prefer that the clean only clean specific keys from the bucket related to what was created, not the entire bucket.

qrevel commented 7 years ago

Agree with @ryan-dyer-sp for the default clean behavior. Maybe a --bucket option to also clean the bucket

tomdavidson commented 6 years ago

I want a backend destroy function. The case is for review apps - short lived stage envs that have a 1:1 relationship with a feature branch in trunk-based workflow. Each review app gets its own backend and does not share a backend with other envs.

br, tom

nilsmeyer commented 4 years ago

One possible issue with this is that you can use the same bucket and dynamodb table for multiple terraform states. You can make this safe by checking whether the bucket is empty or you just trust the user to know what they're doing - possibly with a --yes-i-know-what-i-am-doing-nuke-it-please flag.

Tensho commented 2 years ago

Have the same case for short-lived preview apps.

evya123 commented 1 year ago

Anything new about this feature? Would be very handy when experimenting

sergibarroso-datarobot commented 1 year ago

+1

mjozefcz commented 1 year ago

+1

dmytronasyrov commented 6 months ago

+1

YKolokoltsev commented 3 months ago

+1