Terraform- A System Provisioning Tool

Commands

  • terraform init:- The following command initializes a terraform working directory. It creates a .terraform directory in which you could see a subdirectory named providers which contains configuration files according to the provider you choose.
terraform init
  • terraform validate:- Validate the configuration files in a directory, referring only to the configuration and not accessing any remote services such as remote state, provider APIs, etc. Validate runs checks that verify whether a configuration is syntactically valid and internally consistent, regardless of any provided variables or existing state. It is thus primarily useful for general verification of reusable modules, including the correctness of attribute names and value types. It is safe to run this command automatically, for example as a post-save check in a text editor or as a test step for a re-usable module in a CI system. Validation requires an initialized working directory with any referenced plugins and modules installed. To initialize a working directory for validation without accessing any configured remote backend, use: terraform init -backend=false. If dir is not specified, then the current directory will be used. To verify the configuration in the context of a particular run (a particular
    target workspace, input variable values, etc), use the ‘terraform plan’
    command instead, which includes an implied validation check.
terraform validate
  • terraform plan:- Generates an execution plan for Terraform. This execution plan can be reviewed prior to running apply to get a
    sense of what Terraform will do. Optionally, the plan can be saved to a Terraform plan file, and applications can take this plan file to execute this plan exactly.
terraform plan
  • terraform apply:- Builds or changes infrastructure according to Terraform configuration files in DIR. By default, apply scans the current directory for the configuration and applies the changes appropriately. However, a path to another configuration or an execution plan can be provided. Execution plans can be used to only execute a pre-determined set of actions.
terraform apply to process
terraform apply done
  • terraform destroy:- Destroy Terraform-managed infrastructure.
terraform destroy done

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store