Skip to main content

Terraform CLI (Command Line Interface)

docs

Setup

First installation

  • Follow the procedure given in the Downloads page (will depend on the operating system)

Upgrade

  • Read the information given in the Upgrade Guides page (will depend on the version numbers)

Getting started

commands

Generic commands

CommandAction
terraform --versionPrints the Terraform version
terraform [command] --helpPrints help message (general or specific to a command)
terraform applyBuilds or changes infrastructure
terraform destroyDestroys Terraform-managed infrastructure
terraform fmtFormats Terraform code
terraform initInitializes a Terraform working directory
terraform planGenerates and shows an execution plan
terraform showDisplays human-readable output from a state or plan file
terraform stateUses state to display resources
terraform validateValidates the Terraform files

Examples

# displays the list of resources managed in the workspace
terraform state list