Introduction to Terraform
Table of contents
Terraform is an open-source infrastructure as code (IaC) software tool that can be used to provision the infrastructure of a cloud platform. It helps automate the infrastructure.
Terraform works with automation software like Ansible after infrastructure is ready and set up.
It is a simple file having .tf as an extension, no programming language is required to write the file, its own syntax is similar to JSON.
Terraform Commands
1) Terraform init: It initializes a working directory containing Terraform configuration files. This is the first command that should be run after writing a new Terraform configuration or cloning an existing one from version control.
2) Terraform validate: This command will verify whether the Terraform file is syntactically correct or not.
3) Terraform fmt: This will correctly format the file.
4) Terraform plan: This will show what steps will be taken to execute the file. If any error occurs it will appear here.
5) Terraform apply: This will execute the file and will create the resource for e.g - instance
6) Terraform destroy: This will destroy the instance.