DevOps/Terraform

From Wiki
< DevOps
Revision as of 03:50, 6 September 2020 by Joseph (talk | contribs) (Organize better)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Terraform is a tool for specifying your infrastructure as code. You specify the desired end state of your infrastructure and the tool Terraform will make sure that you reach there.

Why not Ansible

Ansible playbooks are better as compared to ad-hoc scripts since they provide idempotency. However, since Ansible does not remember the state of the previous deployment, you must take into account the current state of the infrastructure and calculate how to reach the end state by yourself. This makes Ansible only good for one-time operations on your infrastructure, like as a provisioning script for your Packer template.

Terraform's biggest USP is that it stores the state of the infrastructure and also checks it against the real state on each run. This allows the end user to specify the desired end state of their system without going into the details of how to get there.

HashiCorp Configuration Language

Terraform's configuration language, HCL2 is now Turing complete. Pulumi is a similar tool in this category that offers full programming languages like TypeScript, Python and others (like Chef did with Ruby). Time will tell if having a Turing complete configuration language is a good thing or a bad thing.