Terraform and why you might think twice about CDK or Cloudformation.
Multi-Cloud
Go try using Cloudformation outside of AWS, go on, in the words of every school teacher "it's your own time you're wasting".
Declarative code.
Terraform's declarative approach is straightforward and easy to understand. You describe what you want, not how to do it. CDK, being imperative, can get a little unwieldy.
State Management
Terraform's state management has been a core feature since the early days. If you've ever used Cloudformation's version of state management, sometimes you feel like you are constantly playing catch up.
EcoSystem
Terraform has been around since 28 July 2014. It has grown a lot, with modules for a lot of features. CDK is growing for sure but is a long way behind in this department.
领英推荐
Language Agnostic
Terraform is based on the HCL language, it is simple to learn and does not try and be more complex than needed (even if some of the modules have got this way). CDK ties you to one language.
Using a programming language for Infrastructure as Code can lead to engineers making solutions to their problems far more complex than needed.
The other aspect is recruitment, not everyone has spent their time around functional programming languages, I was a SysAdmin for many years before entering the world of DevOps.
Lastly, Pulumi. It isn't a good option anywhere, remember folks, just say no.
What about Ansible?
Go back and look at the purpose of what these tools do. Terraform (forget the others) is used as an Infrastructure as Code orchestration tool, meaning it should be used to build infrastructure. The slight caveat to this would be adding something like UserData to EC2 but that should be limited, don't try and do complex tasks this way.
Ansible is a configuration management tool, other comparative tools are Puppet or Chef (both Ruby based).