News for hackers. Stuff that matters.
Re:Terraform vs. AWS CloudFormation by WatchDog on Wednesday October 06, 2021 @07:52PM (#28779973)
The state of things as I see it:

Terraform

- (bad) HCL sucks, not a programming language.

- (good) One tool for multiple service providers is nice.

- (good) Fully open source.

- (good) directly calling service API's makes it more debuggable, and greater control over performance/time of deployments

- (bad) directly calling service API's makes the agent running the tool a SPOF

Cloudformation

- (bad) YAML sucks, not a programming language.

- (good) managed service, doesn't require an agent to run the deployment

- (bad) often slow, no visibility into what it's doing under the hood

- (bad) AWS specific(yes I know about public registry, but it still requires AWS)

Pulumi

- (good) can use an actual real programming language!!

- (bad) directly calling service API's makes the agent running the tool a SPOF

- (bad) need to be connected to, and have credentials for your environment to develop

- (bad) running your code requires bi-directional communication with the pulumi GRPC api

CDK

- (good) can use an actual real programming language!!

- (good) produces a declarative output

- (bad) dependent on cloudformation

- (unknown) CDK for terraform(I haven't tried this, but it sounds promising)

I don't think we yet have the tool we need, but CDK is pretty close, having a real programming language, that produces a declarative intermediate format, that is then ran by another system, I think is the right approach.

Re:Terraform vs. AWS CloudFormation by jen20 on Wednesday October 06, 2021 @08:23PM (#28780197)
You're not seeing them strictly correctly, then:

All the tools described are declarative.

If "directly calling service API's makes the agent running the tool a SPOF" is a "bad" for Terraform, it also must be for Pulumi.

The idea that one "need[s] to be connected to, and have credentials for your environment to develop" to use Pulumi is equally true of Terraform, assuming by "credentials" you mean "credentials for the target provisioning platform".

The idea that "running your code requires bi-directional communication with the pulumi GRPC api" is also untrue.

It's important to be accurate when making these kinds of comparisons, lest you fuel memes instead of providing insight.

Re:Terraform vs. AWS CloudFormation by WatchDog on Wednesday October 06, 2021 @08:55PM (#28780427)
CDK nor Pulumi are declarative.

I've added the "agent SPOF", and "credentials" concern to Pulumi as well, it was an oversight.

Admittedly, my experience with Pulumi is pretty small, but I don't think I'm wrong about it needing a connection the pulumi parent process.

In-fact I opened an issue with Pulumi about problems with this in 2019, and they still haven't closed it.

https://github.com/pulumi/pulumi/issues/3590

Re:Terraform vs. AWS CloudFormation by jen20 on Wednesday October 06, 2021 @09:19PM (#28780613)
Both CDK and Pulumi are declarative. The program declares resource desires to an engine, which evaluates a diff and effects change. You cannot instruct the engine what to do, only the desired outcome, which makes it declarative.

You are correct there is an engine - I mistakenly mistook that as criticism of the default state back end, which is not required.

Re:Terraform vs. AWS CloudFormation by WatchDog on Wednesday October 06, 2021 @11:24PM (#28781482)
Well yeah, I mentioned that at the end, CDK just produces a declarative cloudformation output. I think this is a good thing, but I wouldn't say that CDK is declarative, as you don't write declarative code.
Re:Terraform vs. AWS CloudFormation by jen20 on Thursday October 07, 2021 @12:20AM (#28781850)
You write code that specifies an outcome, and not steps to get there. That is declarative code, like it or not.
Re:Terraform vs. AWS CloudFormation by WatchDog on Thursday October 07, 2021 @04:45AM (#28783750)
You can write literally anything you want in a CDK/Pulumi program. Depending on how you write it, the outcome could be different every time. The generated outcome, ie a cloudformation template, is absolutely declarative, but the CDK code is not.
Re:Terraform vs. AWS CloudFormation by bleepblooop on Thursday October 07, 2021 @02:26PM (#28790276)
I think this discussion is going on circles because you are both discussing different parts of the problem as if they are the same part.

A system could be said to have a declarative execution model if its input is a description of a desired result and that system then decides for itself what sequence of side-effects to perform to achieve that result. Terraform, CloudFormation, and Pulumi are all declarative by this definition.

However, there's also the question of how you tell the system how to build that data structure in the first place. CloudFormation and Terraform both do so with some form of DSL, with the effect that the source program perhaps more directly corresponds with the data structure it produces. Pulumi instead uses general-purpose languages to generate the data structure, and so the source code that produces it can, if desired, bare very little direct resemblance to the resulting data structure.

The tradeoff here then seems to be more about how far removed the input shape is from the resulting declarative data structure, rather than about "declarative or not". Some folks prefer the input to more directly match the underlying model, while others prefer to intentionally abstract away those details behind a higher level API.

I don't think either is right or wrong... I actually wish these two approaches were complementary inside the same product rather than two companies trying to kick each other in the shins, but that's capitalism for you, I guess.

Re:Terraform vs. AWS CloudFormation by jen20 on Thursday October 07, 2021 @11:07AM (#28787291)
You can do exactly that in Terraform too. Declarative and deterministic do not mean the same thing. Again, you cannot instruct the Pulumi engine.
Re:Terraform vs. AWS CloudFormation by jchanimal on Wednesday October 06, 2021 @07:56PM (#28780003)
The TypeScript CDK is the best use of TypeScript I've experienced. Just having all the documentation inline is hugely helpful, but the type checking also makes development faster by catching errors before you deploy (or even validate.)