System Provisioning Management Tool(Terraform) And Its 5 Popular Commands

Firstly let’s discuss about what is Terraform?

Parth Rai
3 min readNov 25, 2020

Terraform is an open source Infrastructure as Code tool which is created by HashiCorp. It is currently the most popular automation tools available.

Use Infrastructure as Code to provision and manage any cloud, infrastructure, or service. It is a tool for building, changing, and versioning infrastructure safely and efficiently. It can manage existing and popular service providers as well as custom in-house solutions. Configuration files describe to Terraform the components needed to run a single application or your entire datacenter.

Terraform uses a Simple syntax, it can provision infrastructure across multiple cloud on premises data centers and can efficiently re-provision infrastructure in response to configuration changes.

Data source to access information about an existing Image.

TOP 5 POPULAR COMMANDS OF TERRAFORM

  1. DESTROY- This command is used to destroy the Terraform-managed infrastructure. This command accepts all the arguments and flags that the apply command accepts, with the exception of a plan file argument. This command is the reverse of terraform apply in that it terminates all the resources specified by the configuration. It does not destroy resources running elsewhere that are not described in the current configuration.

2. Graph- This command is used to generate a visual representation of either a configuration or execution plan. The output is in the DOT format, which can be used by graph viz to generate charts.

3.Terraform init: The terraform init command is used to initialize the working directory in which the terraform configuration files are present these files includes such as main.tf, variables.tf etc. This is the first command that should be run after writing a new terraform configuration or cloning an existing one from version control.

4.Terraform plan: The terraform plan command is used to create an execution plan. Terraform performs a refresh, unless explicitly disabled, and then determines what actions are necessary to achieve the desired state specified in the configuration files.

Command: terraform plan [options] [dir]

5.Terraform apply: The terraform apply command is used to apply the changes required to reach the desired state of the configuration, or the pre-determined set of actions generated by a terraform plan execution plan.

Command: terraform apply [options] [dir-or-plan]

References:

Terraform Tutorials — HashiCorp Learn

learn.hashicorp.com

--

--