3 ms·
Where does this sit in relation with Terraform? Is Terraform not able to do everything this does? I was aware of something from AWS called CloudFormation templa
by lambdaba 4y ago
Where does this sit in relation with Terraform? Is Terraform not able to do everything this does? I was aware of something from AWS called CloudFormation templates or something but I heard that was too low-level and idiosyncratic, also JSON-based and not expressive enough. Sorry if this is a bit confused, just want some clarification, and thought that Terraform was the gold standard.
- pojzon 4y agoTerraform is using a delarative DSL. CloudFormation is similar in that regard. Using a declarative language is both a pro and con. Pros of that solution is that you are restricted in what you can do, which often results in simplier and cleaner code. Cons are that again you are restricted in what you can do. Now about CDK is just your preferred language library to write infrastructure in imperative way. For example you write java code that deploys infrastructure. When using a real programming language you have ofcourse a lot more freedom in what you do, but ofcourse that comes at the cost of complexity. If your developers are “creative” it can be very hard to understand wth is happening in code. —- So yes many ppl consider Terraform as a golden standard (me included) but after many years of working with it, like anything in IT it has own flaws and you may want to consider other solutions for specific projects.
- jen20 4y agoCDK is also declarative - it generates a CloudFormation YAML file, so cannot possibly be anything else. Declarative is a property of a programming model, not a language.
- pojzon 4y agoInbetween using CDK and generating CF Template you can be very “creative”, thats where the imperative part lies.
- 8note 4y agoI think there's a much stronger argument that cloudformation deploying your stacks gets to being imperative than the way you produce your cloudformation file. The file is still declarative regardless, and the functions you write to create that file don't per se have side effects outside that file
- Too 4y agoIt’s possible, and very easy, to generate yaml with a bunch of for-loops and side-effects in an imperative language. So without knowing anything about cdk, even if it is declarative, I don’t think your conclusion is applicable. Terraform, the language, works differently. While it has variables, you can not store state in variables and depend on side effects based on the order you read/write such variables. Every assignment and execution order of resources is purely based on dependency order and not based on the order of the lines in your code.
- jen20 4y agoTerraform is not a language. HCL could be considered a language, but really requires the additional context of the Terraform resource model and the individual schema pertaining to the resources under management to decode. It populates an internal resource model, before changes are effected by the Terraform core engine. One can configure the self same resource model using JSON, which can be trivially generated - as you correctly point out - using whatever language and paradigm you like. However, since the language doing the generation does not influence the order of operations when applying the effects, the model is declarative. This is identical to the CDK configuring the CloudFormation engine via YAML. Indeed, there is a CDK for Terraform too...
- fdgsdfogijq 4y agoI'm a huge fanboy of CDK. I think its superior, and that its power has yet to be realized by the tech community at large. You can essentially create object oriented abstractions of common infrastructure patterns. You are correct, you need to be careful about how you build things, but it can be extremely productive. Cloudformation is a nightmare.
- jen20 4y ago- CloudFormation is the native offering from AWS. Templates are submitted in the form of YAML or JSON documents. - CDK compiles Typescript and other languages down to CloudFormation Templates - Terraform uses the AWS API directly via an AWS-specific provider, and does not typically use CloudFormation stacks (though this can be useful, in some circumstances!) - Pulumi uses TypeScript and other languages to drive an engine similar to Terraform (and the Terraform AWS provider is one of the options for provisioning AWS resources). Hopefully this clears it up?
- deleted 4y ago[deleted]