News for hackers. Stuff that matters.
Re:Using Actual Code for IaC by freedomben on Friday April 29, 2022 @05:01PM (#31210552)
Exactly. I've used Terraform, Ansible, Chef, and a couple of hybrids extensively and my current opinion is that for simple use cases a strict DSL is great, but 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.

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."

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.

Re:Using Actual Code for IaC by danw1979 on Saturday April 30, 2022 @02:28AM (#31213853)
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 !