πŸ”¬
Terraform
Install terraform autocomplete - `terraform -install-autocomplete`

  • terraform fmt - Format code as per HCL standard
  • terraform validate - validate code syntax
  • terraform validate -backend=false - Validate code, skip backend validation

  • terraform state list - List resource in the state file
  • terraform state show [resource] - Show properties of a resource
  • terraform show - Show everything in state file
  • terraform state list - List resource
  • terraform refresh - Reads the current settings from all managed remote objects and updates the Terraform state file

  • terraform apply -replace [resource] - replace a resource on next run.
  • terraform apply -refresh-only - Presents interactive prompt for you to confirm the detected changes to the state file
Useful when we need to execute provisioners because terraform doesn't detect changes in provisionders. terraform taint was the command in old version

  • terraform providers - Get a list of currently installed providers
Use alternate provider by setting an alias & refer the provider with provider = alias

  • terraform graph | dot -Tsvg > graph.svg - Output visual execution graph of terraform resources in svg format
Last modified 5mo ago
Copy link
Edit on GitHub
On this page
format, validate & Init
State File
Applying changes
Terraform Providers
Visualization & Graph