Wants What It Wants
(I seem to open a lot of blog posts with variations on “I’ve written before about X.” Here’s another one).
Back in 2017 I wrote three posts in a row about the tension between giving users what they want and guiding them to what is best. They came to mind this week when I ran up against on of terraform‘s more annoying (lack of) features: the inability to apply changes on a per file basis. I absolutely understand why it’s not supported, but sometimes it’s a quick and dirty way to keep moving forward, and dang it, I needed it!
After a day of annoyingly overspecifying --target
flags in my commands, I rolled up my sleeves and built a wrapping script that would do the work for me, essentially adding a --file
flag to the CLI. I share it here as a service to the Infrastructure-as-Code community. Usage is easy:
terraform-files apply --file my-infra.tf
It’s hacky as heck, so use at your own risk, your mileage may vary, etc etc. And if you want to make it better, revisions welcomed!