IaC¶
Lifecycle Management
terraform init
Initializes a working directory containing Terraform configuration files.
terraform plan
Creates an execution1 plan, showing what changes Terraform will make.
terraform apply
Executes the actions proposed in a Terraform plan.
terraform destroy
Destroys Terraform-managed infrastructure.
State Management
terraform state list
Lists resources currently tracked in the Terraform state.
terraform state show
Shows the attributes of a specific resource in the state.
terraform state mv
Moves an item in the state to a new address.
terraform state rm
Removes an item from the state.
terraform state pull
Downloads the state file from the remote backend.
terraform state push
Uploads a local state file to the remote backend.
Formatting and Validation
terraform fmt
Reformats Terraform configuration files to a canonical style.
terraform validate
Validates the syntax of Terraform configuration files.
Module Management
terraform get
Downloads and updates modules defined in the configuration.
terraform providers
Displays information about the providers used in the current configuration.
Workspace Management
terraform workspace list
Lists existing Terraform workspaces.
terraform workspace show
Shows the currently selected workspace.
terraform workspace select
Selects an existing workspace.
terraform workspace new
Creates a new workspace.
terraform workspace delete
Deletes a workspace.
Output and Import
terraform output
Shows the output values from the Terraform state.
terraform import
Imports an existing resource into Terraform management.
Other Useful Commands
terraform version
Shows the installed Terraform version.
terraform console
Opens an interactive console for evaluating Terraform expressions.
terraform taint
Marks a resource as tainted, forcing its replacement on the next apply.
terraform untaint
Removes the tainted status from a resource.
terraform debug
Enables debug logging.