Re:Using Actual Code for IaC
by naserbvqtery on Friday April 29, 2022 @05:17PM
(#31210671)
> as soon as you need to something higher (usually some sort of looping over a complex data structure and populating fields from those values) it gets real painful
I'd argue this is one such guardrail. Way more than once I've seen infrastructure resources exhausted (frequently cloud provider limits), because a hard line wasn't maintained between infrastructure code and application code. Frequently in the form of "It just makes sense for us to create one %s infrastructure resource for each %s in our application!" followed by a series of midnight conference calls weeks-months later.
I mean, Terraform wasn’t even really an MVP for your typical large cloud deployments before 0.12, IMHO.
I think those days of magic-HCL-generators are more-or-less behind us.
All we need now is variables in backend config and delayed provider initialisation and we’re laughing !
Terraform is getting better at the loops and stuff but I still have a bunch of code from older versions of terraform that are erb templates that output terraform files, thus allowing to use Ruby functions. That was/is probably the least evil solution I've seen. The worst is when the infrastructure or devops team (or someone else) decides, "we need to abstract this away with our own tool."