A few days back, I stumbled upon an interesting post (unfortunately I couldn’t find the original source) about deliberately destroying random Terraform resources, or so called chaos engineering if you will.

the command

terraform destroy -auto-approve -target "$(terraform state list | shuf -n 1)"

You can add this command to a cron job and schedule it to run every Friday evening for some weekend excitement.

For a more sophisticated approach, there’s Chaos Monkey - the chaos engineering tool developed by Netflix. But if you’re just getting started with chaos engineering, this scuffed one-liner might be a better (not safer for sure) entry point.

bottom line

If you’re experimenting with chaos engineering and want to see how resilient your infrastructure really is, this command will definitely help you find out. Just maybe don’t run it in production without a good backup plan.

Shameless plug: Check out justanotheruptime.com if you’re looking for a monitoring solution to catch when things inevitably break.