0% found this document useful (0 votes)
57 views5 pages

Terraform Commands

The document describes common commands used with Terraform to manage infrastructure. It lists commands to initialize a working directory, plan changes, build or destroy infrastructure, validate configuration files, manage state and workspaces, and upgrade to new Terraform versions. Commands include apply, destroy, plan, refresh, state, workspace, and others.

Uploaded by

Fantahun Fkadie
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
57 views5 pages

Terraform Commands

The document describes common commands used with Terraform to manage infrastructure. It lists commands to initialize a working directory, plan changes, build or destroy infrastructure, validate configuration files, manage state and workspaces, and upgrade to new Terraform versions. Commands include apply, destroy, plan, refresh, state, workspace, and others.

Uploaded by

Fantahun Fkadie
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 5

Terraform Commands

Terraform - Common Commands


● apply
○ Builds or changes infrastructure
● destroy
○ Destroy Terraform-managed infrastructure
● fmt
○ Rewrites config files to canonical format
● init
○ Initialize a Terraform working directory
● plan
○ Generate and show an execution plan
● providers
○ Prints a tree of the providers used in the configuration
● refresh
○ Update local state file against real resources
Terraform - Common Commands
● show
○ Inspect Terraform state or plan
● validate
○ Validates the Terraform files
● version
○ Prints the Terraform version
● login
○ It can be used to automatically obtain and save an API token for Terraform Cloud,
Terraform Enterprise, or any other host that offers Terraform services
● logout
○ It command is used to remove credentials stored by terraform login
Terraform - Common Commands
● state
○ It is used for advanced state management.
● state list
○ It is used to list resources within a Terraform state.
● state mv
○ It is used to move items in a Terraform state.
● 0.12upgrade
○ It applies several automatic upgrade rules to help prepare a module that was
written for Terraform v0.11 to be used with Terraform v0.12.
● 0.13upgrade
○ It will update the configuration files in the given directory to use the new provider
source features from Terraform v0.13.
Terraform - Common Commands
● Workspace
○ Workspace management
● terraform workspace new - It is used to create a new workspace.
● terraform workspace list - It is used to list all existing workspaces.
● terraform workspace select - It is used to choose a different workspace to use for
further operations.
● terraform workspace delete - It is used to delete an existing workspace.
● terraform workspace show - It is used to output the current workspace.

You might also like