Cloud agnostic tool that is compatible with any cloud infrastructure and can be moved to and from different cloud environments without any operational issues - Terraform by HashiCorp is an infrastructure as code (IaC) open-source software
.
Terraform is built on top of Go
language. Terraform files are written using Hashicorp Configuration Language (HCL)
which is similar to YAML
.
Using Terraform language has following main components
Providers
- plugin that enables interaction with an API, e.g. Azure Cloud providerVariables
- Just like code, parameters for a Terraform moduleResources
- Infrastructure objectsState
- stores metadata about the managed infrastructure & configuration
init
- download dependencies (modules and providers)module
- think of it as function in terms of code i.e. reuse resource configurations with Terraform. It consists ofinput variables
,output variables
&resources
. As a standard best practice, modules are created under a separate directorymodules/
plan
- show expected outcome of the codeapply
- execute the instructions, create the infrastructure resourcesdestroy
- remove all the resources associated with this deployment