Terraform is an open source infrastructure as a code solution that allows infrastructure engineers to have the ability to codify the stack. Cloudformaiton is the AWS version of the solution, being the largest cloud provider, AWS Cloudformation aims to build a fully managed solution for automating the infrastructure as code deployment.
- Cloud Agnostic: It is sometimes very difficult to choose which cloud to use, there are often different strengths and weaknesses for different cloud providers, cloudformation is built solely for AWS but if you want to leverage different cloud platform at the same time, terraform is definitely a better option. If your team currently has the initiative to build a solution that can be implemented on multiple cloud computing platform or you are a DevOps shop, having Terraform under your belt is definitely a good look.
2. Language verbosity: Cloudformation uses YAML or JSON whereas the Terraform uses HCL(Hashicorp Configuration Language). YAML is the hipster template language, it allows developer to write Python-Like syntax when creating templates and not have to worry about brackets. Unlike CloudFormation, Terraform uses Hashicorp Configuraiton Language which is the reason why Cloudformation seems to be the better tool as it allows you to use the YAML syntax.
3. State management: Terraform DIY, CFN fully managed. In order to ensure accuracy and reliability of your system, the infrastructure as code needs to be maintained with high integrity. This will be difficult for Terraform as you would have to maintain the template with a separate computer(local or remote), and store the current state in a durable storage solution. Whereas cloudformation is fully managed and hassle free.
4. Parameters: Cloudformation Template has 60 parameter limit, in order to include more parameters, the DevOps engineer needs to use nested stacks, which enforces best practice architecture wise.Whereas the terraform gives you a lot of freedom on what how you structure your parameters based on datasource files.
5.Community and Support: Terraform is born in the open source community, which is significantly more active than AWS forum, if you are a startup, being able to find answers quickly from other talented developers is very valuable. Whereas if you are on later stage of a startup or you are a part of a big enterprise, you might have enough money to afford AWS Support which allows you to leverage Cloudformation to the fullest.