Terraform Commands
This command will initialize the working directory containing Terraform configuration files and install any required plugins.
terraform init
This command lets you preview the actions Terraform would take to modify your infrastructure or save a speculative plan which you can apply later.
terraform plan
This command executes the actions proposed in a terraform plan. It is used to deploy your infrastructure. Typically apply should be run after terraform init and terraform plan. Enter yes when prompted "Enter a value:".
terraform apply
This command will show whether the syntax used is correct or not
terraform validate
This command scans the configuration files in the current working directory and formats the code. It is used to improve the readability of files.
terraform fmt
This command will list all the providers used in the configuration file
terraform providers
This command will mirror the provider configuration in a new path.
terraform providers mirror /<file_path>
This command will print all the output variables in the configuration files
terraform output
This command is used to sync the terraform with real-world resources
terraform refresh
This command will show the resources we have created.
terraform show
To destroy the infrastructure
terraform destroy
Last updated