Hacker News new | ask | show | jobs
by fulafel 594 days ago
Why's everyone going away from declarative? Terraform, CloudFormation, AWS Copilot etc have a lot of virtues and are programming language agnostic.

Using a complex programming language (C++ of the browser world) just for this has a big switching cost. Unless you're all in on TS. And/or have already built a huge complex IaC tower of babel where programming-in-the-large virtues justify it.

8 comments

> Why's everyone going away from declarative?

If I had to guess it's because

- more imperative background developers need to work with infrastructure and they bring over their mindset and ways of working

- infrastructure is more and more available through API's and it saves a lot of effort to dynamically iterate over cattle than declaratively deal with pets

- things like conditionals, loops and abstractions are very useful for a reason

- in essence the declarative tools are not flexible enough for many use cases or ways of working, using a programming language brings infinite flexibility

Personally I am more in the declarative camp and see the benefits of it, but there is certain amount of banging ones head against it's rigidity.

Complex programming languages for infrastructure code get used when people who are more comfortable using complex programming languages to solve their problems are given the problem of infrastructure and ops.

It is classic "every problem is a nail to the person with a hammer". Complex languages - by definition - can solve a wider variety of problems than a simple declarative language but - by definition - are less simple.

Complex languages for infra - IMO - are the wrong tool for the wrong job because of the wrong skills and the wrong person. The only reason why inefficiencies like this are ever allowed to happen is money.

"Why hire a dev and an ops when we can hire a single devops for fractionally less?" - some excited business person or some broken dev manager, probably.

Declarative has in-practice meant “programming, but in YAML” more often than not, which is hell. YAML’s not even a good format for static data, and it’s even worse when you try to program in it.
Terraform isn't really declarative. It's declarative right up until the point at which it isn't, where it falls apart. I need a declarative deployment right up to the application layer, which is where terraform fails.
Because they like to spend endless hours debugging infrastructure builds.
A small CDK project is a lot more readable in my opinion. It doesn’t have a ton of yml files where your config is spread out
It seems to me that there's not a big difference in nr of files. You can have a single template in CF or Terraform files and similarly you can split your CDK code in many files, or not.

(For bigger stuff apparently CF has some limits relating to resoures per single stack)

Because sometimes you just need a for loop in a way that terraform's for_each/other DSL doesn't support
declarative does not equate to config files

the property that equates to config files is "being static", which modern deployments are not.