Install by Target
Official or upstream install sources only. Third-party sources are labelled with their publisher.
Linux Debian family
apt
set -eu printf '#!/bin/sh\nexit 101\n' > /usr/sbin/policy-rc.d chmod 755 /usr/sbin/policy-rc.d apt-get update DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates curl gpg curl -fsSL https://apt.releases.hashicorp.com/gpg -o /tmp/hashicorp-signing-key.asc gpg --batch --yes --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg /tmp/hashicorp-signing-key.asc printf 'deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com noble main\n' > /etc/apt/sources.list.d/hashicorp.list apt-get update DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends terraform=1.14.9-1 printf 'disable_checkpoint = true\n' > "$HOME/.terraformrc" terraform versionverified on linux-amd64-proxmox, 2026-10-24
RPM family
yum
set -eu yum install -y yum-utils yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo yum -y install terraform-1.14.9-1 terraform versionunverified
macOS
brew
set -eu brew tap hashicorp/tap brew install hashicorp/tap/terraform terraform versionunverified
Windows
binary
No install command is published yet.
unverified
Docker
docker
docker run --rm hashicorp/terraform@sha256:1d10ec4073f4ddbdf34a28540a3b9250852ab500cb1c53f68c8bd17d82f474d8 versionverified on linux-amd64-proxmox, 2026-10-24
Kubernetes
Terraform is a command-line tool that runs on a workstation or a CI runner; HashiCorp publishes no Terraform package, image or chart meant to be deployed into a cluster. Its Kubernetes integration is the HCP Terraform Operator for Kubernetes (https://developer.hashicorp.com/terraform/cloud-docs/integrations/kubernetes), which drives HCP Terraform from the cluster and is a different product from the CLI taught here.
Quickstart Lab
Open Lab variants from Scenarios. Commands are what ran; never retyped.
Linux
sh -c "$(cat <<'OPENSKILLS_LAB_STEP_0'
set -eu
printf '#!/bin/sh\nexit 101\n' > /usr/sbin/policy-rc.d
chmod 755 /usr/sbin/policy-rc.d
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates curl gpg
curl -fsSL https://apt.releases.hashicorp.com/gpg -o /tmp/hashicorp-signing-key.asc
gpg --batch --yes --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg /tmp/hashicorp-signing-key.asc
printf 'deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com noble main\n' > /etc/apt/sources.list.d/hashicorp.list
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends terraform=1.14.9-1
printf 'disable_checkpoint = true\n' > "$HOME/.terraformrc"
terraform version
OPENSKILLS_LAB_STEP_0
)"
sh -c "$(cat <<'OPENSKILLS_LAB_STEP_1'
set -eu
mkdir -p /tmp/tf-demo
cat > /tmp/tf-demo/main.tf <<'EOF'
terraform {
required_version = ">= 1.4.0"
}
variable "greeting" {
type = string
default = "hello"
}
resource "terraform_data" "demo" {
input = var.greeting
}
output "greeting" {
value = terraform_data.demo.output
}
EOF
printf 'Fixture ready\n'
OPENSKILLS_LAB_STEP_1
)"
sh -c "$(cat <<'OPENSKILLS_LAB_STEP_2'
terraform -chdir=/tmp/tf-demo init -input=false
OPENSKILLS_LAB_STEP_2
)"
sh -c "$(cat <<'OPENSKILLS_LAB_STEP_3'
terraform -chdir=/tmp/tf-demo validate
OPENSKILLS_LAB_STEP_3
)"
sh -c "$(cat <<'OPENSKILLS_LAB_STEP_4'
terraform -chdir=/tmp/tf-demo plan -input=false -out=tfplan
OPENSKILLS_LAB_STEP_4
)"
sh -c "$(cat <<'OPENSKILLS_LAB_STEP_5'
terraform -chdir=/tmp/tf-demo apply -input=false tfplan
OPENSKILLS_LAB_STEP_5
)"
sh -c "$(cat <<'OPENSKILLS_LAB_STEP_6'
terraform -chdir=/tmp/tf-demo output -raw greeting
OPENSKILLS_LAB_STEP_6
)"
sh -c "$(cat <<'OPENSKILLS_LAB_STEP_7'
terraform -chdir=/tmp/tf-demo destroy -input=false -auto-approve
OPENSKILLS_LAB_STEP_7
)"
sh -c "$(cat <<'OPENSKILLS_LAB_STEP_8'
rm -rf /tmp/tf-demo "$HOME/.terraformrc"
printf 'Sandbox removed\n'
OPENSKILLS_LAB_STEP_8
)"verified on linux-amd64-proxmox, 2026-10-24
Docker
sh -c "$(cat <<'OPENSKILLS_LAB_STEP_0'
docker run --rm hashicorp/terraform@sha256:1d10ec4073f4ddbdf34a28540a3b9250852ab500cb1c53f68c8bd17d82f474d8 version
OPENSKILLS_LAB_STEP_0
)"
sh -c "$(cat <<'OPENSKILLS_LAB_STEP_1'
set -eu
mkdir -p /tmp/tf-demo
cat > /tmp/tf-demo/main.tf <<'EOF'
terraform {
required_version = ">= 1.4.0"
}
variable "greeting" {
type = string
default = "hello"
}
resource "terraform_data" "demo" {
input = var.greeting
}
output "greeting" {
value = terraform_data.demo.output
}
EOF
printf 'disable_checkpoint = true\n' > /tmp/tf-demo/tfrc
printf 'Fixture ready\n'
OPENSKILLS_LAB_STEP_1
)"
sh -c "$(cat <<'OPENSKILLS_LAB_STEP_2'
docker run --rm -u "$(id -u):$(id -g)" -e TF_CLI_CONFIG_FILE=/work/tfrc -v /tmp/tf-demo:/work -w /work hashicorp/terraform@sha256:1d10ec4073f4ddbdf34a28540a3b9250852ab500cb1c53f68c8bd17d82f474d8 init -input=false
OPENSKILLS_LAB_STEP_2
)"
sh -c "$(cat <<'OPENSKILLS_LAB_STEP_3'
docker run --rm -u "$(id -u):$(id -g)" -e TF_CLI_CONFIG_FILE=/work/tfrc -v /tmp/tf-demo:/work -w /work hashicorp/terraform@sha256:1d10ec4073f4ddbdf34a28540a3b9250852ab500cb1c53f68c8bd17d82f474d8 validate
OPENSKILLS_LAB_STEP_3
)"
sh -c "$(cat <<'OPENSKILLS_LAB_STEP_4'
docker run --rm -u "$(id -u):$(id -g)" -e TF_CLI_CONFIG_FILE=/work/tfrc -v /tmp/tf-demo:/work -w /work hashicorp/terraform@sha256:1d10ec4073f4ddbdf34a28540a3b9250852ab500cb1c53f68c8bd17d82f474d8 plan -input=false -out=tfplan
OPENSKILLS_LAB_STEP_4
)"
sh -c "$(cat <<'OPENSKILLS_LAB_STEP_5'
docker run --rm -u "$(id -u):$(id -g)" -e TF_CLI_CONFIG_FILE=/work/tfrc -v /tmp/tf-demo:/work -w /work hashicorp/terraform@sha256:1d10ec4073f4ddbdf34a28540a3b9250852ab500cb1c53f68c8bd17d82f474d8 apply -input=false tfplan
OPENSKILLS_LAB_STEP_5
)"
sh -c "$(cat <<'OPENSKILLS_LAB_STEP_6'
docker run --rm -u "$(id -u):$(id -g)" -e TF_CLI_CONFIG_FILE=/work/tfrc -v /tmp/tf-demo:/work -w /work hashicorp/terraform@sha256:1d10ec4073f4ddbdf34a28540a3b9250852ab500cb1c53f68c8bd17d82f474d8 output -raw greeting
OPENSKILLS_LAB_STEP_6
)"
sh -c "$(cat <<'OPENSKILLS_LAB_STEP_7'
docker run --rm -u "$(id -u):$(id -g)" -e TF_CLI_CONFIG_FILE=/work/tfrc -v /tmp/tf-demo:/work -w /work hashicorp/terraform@sha256:1d10ec4073f4ddbdf34a28540a3b9250852ab500cb1c53f68c8bd17d82f474d8 destroy -input=false -auto-approve
OPENSKILLS_LAB_STEP_7
)"
sh -c "$(cat <<'OPENSKILLS_LAB_STEP_8'
rm -rf /tmp/tf-demo
printf 'Sandbox removed\n'
OPENSKILLS_LAB_STEP_8
)"verified on linux-amd64-proxmox, 2026-10-24
Helm
Terraform is a command-line tool that runs on a workstation or a CI runner; HashiCorp publishes no Terraform package, image or chart meant to be deployed into a cluster. Its Kubernetes integration is the HCP Terraform Operator for Kubernetes (https://developer.hashicorp.com/terraform/cloud-docs/integrations/kubernetes), which drives HCP Terraform from the cluster and is a different product from the CLI taught here.
Usage recipes
Lifecycle recipes with a Target access preamble. Choose a Target to see the command that runs there.
Configure
Initialise the working directory: set up the backend and install the providers the configuration needs.
verified on linux-amd64-proxmox, 2026-10-24
Linux Debian familyRPM familymacOSWindowsDocker
Linux Debian family
terraform -chdir=/tmp/tf-demo init -input=falseRPM family
terraform -chdir=/tmp/tf-demo init -input=falsemacOS
terraform -chdir=/tmp/tf-demo init -input=falseWindows
terraform -chdir=C:\tf-demo init -input=falseDocker
docker run --rm -u "$(id -u):$(id -g)" -e TF_CLI_CONFIG_FILE=/work/tfrc -v /tmp/tf-demo:/work -w /work hashicorp/terraform@sha256:1d10ec4073f4ddbdf34a28540a3b9250852ab500cb1c53f68c8bd17d82f474d8 init -input=false
Create a workspace with its own empty state and switch to it.
verified on linux-amd64-proxmox, 2026-10-24
Linux Debian familyRPM familymacOSWindowsDocker
Linux Debian family
terraform -chdir=/tmp/tf-demo workspace new stagingRPM family
terraform -chdir=/tmp/tf-demo workspace new stagingmacOS
terraform -chdir=/tmp/tf-demo workspace new stagingWindows
terraform -chdir=C:\tf-demo workspace new stagingDocker
docker run --rm -u "$(id -u):$(id -g)" -e TF_CLI_CONFIG_FILE=/work/tfrc -v /tmp/tf-demo:/work -w /work hashicorp/terraform@sha256:1d10ec4073f4ddbdf34a28540a3b9250852ab500cb1c53f68c8bd17d82f474d8 workspace new staging
Inspect
Print the installed Terraform version and platform.
verified on linux-amd64-proxmox, 2026-10-24
Linux Debian familyRPM familymacOSWindowsDocker
Linux Debian family
terraform -chdir=/tmp/tf-demo versionRPM family
terraform -chdir=/tmp/tf-demo versionmacOS
terraform -chdir=/tmp/tf-demo versionWindows
terraform -chdir=C:\tf-demo versionDocker
docker run --rm -u "$(id -u):$(id -g)" -e TF_CLI_CONFIG_FILE=/work/tfrc -v /tmp/tf-demo:/work -w /work hashicorp/terraform@sha256:1d10ec4073f4ddbdf34a28540a3b9250852ab500cb1c53f68c8bd17d82f474d8 version
Check that the configuration is valid without contacting any remote service.
verified on linux-amd64-proxmox, 2026-10-24
Linux Debian familyRPM familymacOSWindowsDocker
Linux Debian family
terraform -chdir=/tmp/tf-demo validateRPM family
terraform -chdir=/tmp/tf-demo validatemacOS
terraform -chdir=/tmp/tf-demo validateWindows
terraform -chdir=C:\tf-demo validateDocker
docker run --rm -u "$(id -u):$(id -g)" -e TF_CLI_CONFIG_FILE=/work/tfrc -v /tmp/tf-demo:/work -w /work hashicorp/terraform@sha256:1d10ec4073f4ddbdf34a28540a3b9250852ab500cb1c53f68c8bd17d82f474d8 validate
Print every resource and output recorded in the current state.
verified on linux-amd64-proxmox, 2026-10-24
Linux Debian familyRPM familymacOSWindowsDocker
Linux Debian family
terraform -chdir=/tmp/tf-demo showRPM family
terraform -chdir=/tmp/tf-demo showmacOS
terraform -chdir=/tmp/tf-demo showWindows
terraform -chdir=C:\tf-demo showDocker
docker run --rm -u "$(id -u):$(id -g)" -e TF_CLI_CONFIG_FILE=/work/tfrc -v /tmp/tf-demo:/work -w /work hashicorp/terraform@sha256:1d10ec4073f4ddbdf34a28540a3b9250852ab500cb1c53f68c8bd17d82f474d8 show
List the resource addresses recorded in state.
verified on linux-amd64-proxmox, 2026-10-24
Linux Debian familyRPM familymacOSWindowsDocker
Linux Debian family
terraform -chdir=/tmp/tf-demo state listRPM family
terraform -chdir=/tmp/tf-demo state listmacOS
terraform -chdir=/tmp/tf-demo state listWindows
terraform -chdir=C:\tf-demo state listDocker
docker run --rm -u "$(id -u):$(id -g)" -e TF_CLI_CONFIG_FILE=/work/tfrc -v /tmp/tf-demo:/work -w /work hashicorp/terraform@sha256:1d10ec4073f4ddbdf34a28540a3b9250852ab500cb1c53f68c8bd17d82f474d8 state list
Print the recorded attributes of one resource.
verified on linux-amd64-proxmox, 2026-10-24
Linux Debian familyRPM familymacOSWindowsDocker
Linux Debian family
terraform -chdir=/tmp/tf-demo state show terraform_data.demoRPM family
terraform -chdir=/tmp/tf-demo state show terraform_data.demomacOS
terraform -chdir=/tmp/tf-demo state show terraform_data.demoWindows
terraform -chdir=C:\tf-demo state show terraform_data.demoDocker
docker run --rm -u "$(id -u):$(id -g)" -e TF_CLI_CONFIG_FILE=/work/tfrc -v /tmp/tf-demo:/work -w /work hashicorp/terraform@sha256:1d10ec4073f4ddbdf34a28540a3b9250852ab500cb1c53f68c8bd17d82f474d8 state show terraform_data.demo
Print one output value without quotes or decoration.
verified on linux-amd64-proxmox, 2026-10-24
Linux Debian familyRPM familymacOSWindowsDocker
Linux Debian family
terraform -chdir=/tmp/tf-demo output -raw greetingRPM family
terraform -chdir=/tmp/tf-demo output -raw greetingmacOS
terraform -chdir=/tmp/tf-demo output -raw greetingWindows
terraform -chdir=C:\tf-demo output -raw greetingDocker
docker run --rm -u "$(id -u):$(id -g)" -e TF_CLI_CONFIG_FILE=/work/tfrc -v /tmp/tf-demo:/work -w /work hashicorp/terraform@sha256:1d10ec4073f4ddbdf34a28540a3b9250852ab500cb1c53f68c8bd17d82f474d8 output -raw greeting
Show which providers the configuration and the state require.
verified on linux-amd64-proxmox, 2026-10-24
Linux Debian familyRPM familymacOSWindowsDocker
Linux Debian family
terraform -chdir=/tmp/tf-demo providersRPM family
terraform -chdir=/tmp/tf-demo providersmacOS
terraform -chdir=/tmp/tf-demo providersWindows
terraform -chdir=C:\tf-demo providersDocker
docker run --rm -u "$(id -u):$(id -g)" -e TF_CLI_CONFIG_FILE=/work/tfrc -v /tmp/tf-demo:/work -w /work hashicorp/terraform@sha256:1d10ec4073f4ddbdf34a28540a3b9250852ab500cb1c53f68c8bd17d82f474d8 providers
Print the dependency graph in Graphviz DOT format.
verified on linux-amd64-proxmox, 2026-10-24
Linux Debian familyRPM familymacOSWindowsDocker
Linux Debian family
terraform -chdir=/tmp/tf-demo graphRPM family
terraform -chdir=/tmp/tf-demo graphmacOS
terraform -chdir=/tmp/tf-demo graphWindows
terraform -chdir=C:\tf-demo graphDocker
docker run --rm -u "$(id -u):$(id -g)" -e TF_CLI_CONFIG_FILE=/work/tfrc -v /tmp/tf-demo:/work -w /work hashicorp/terraform@sha256:1d10ec4073f4ddbdf34a28540a3b9250852ab500cb1c53f68c8bd17d82f474d8 graph
List workspaces; the selected one is marked with an asterisk.
verified on linux-amd64-proxmox, 2026-10-24
Linux Debian familyRPM familymacOSWindowsDocker
Linux Debian family
terraform -chdir=/tmp/tf-demo workspace listRPM family
terraform -chdir=/tmp/tf-demo workspace listmacOS
terraform -chdir=/tmp/tf-demo workspace listWindows
terraform -chdir=C:\tf-demo workspace listDocker
docker run --rm -u "$(id -u):$(id -g)" -e TF_CLI_CONFIG_FILE=/work/tfrc -v /tmp/tf-demo:/work -w /work hashicorp/terraform@sha256:1d10ec4073f4ddbdf34a28540a3b9250852ab500cb1c53f68c8bd17d82f474d8 workspace list
Operate
Compute the change set and save it to a plan file for a later apply.
verified on linux-amd64-proxmox, 2026-10-24
Linux Debian familyRPM familymacOSWindowsDocker
Linux Debian family
terraform -chdir=/tmp/tf-demo plan -input=false -out=tfplanRPM family
terraform -chdir=/tmp/tf-demo plan -input=false -out=tfplanmacOS
terraform -chdir=/tmp/tf-demo plan -input=false -out=tfplanWindows
terraform -chdir=C:\tf-demo plan -input=false -out=tfplanDocker
docker run --rm -u "$(id -u):$(id -g)" -e TF_CLI_CONFIG_FILE=/work/tfrc -v /tmp/tf-demo:/work -w /work hashicorp/terraform@sha256:1d10ec4073f4ddbdf34a28540a3b9250852ab500cb1c53f68c8bd17d82f474d8 plan -input=false -out=tfplan
Re-read real objects and record the result in state without proposing configuration changes.
verified on linux-amd64-proxmox, 2026-10-24
Linux Debian familyRPM familymacOSWindowsDocker
Linux Debian family
terraform -chdir=/tmp/tf-demo apply -input=false -auto-approve -refresh-onlyRPM family
terraform -chdir=/tmp/tf-demo apply -input=false -auto-approve -refresh-onlymacOS
terraform -chdir=/tmp/tf-demo apply -input=false -auto-approve -refresh-onlyWindows
terraform -chdir=C:\tf-demo apply -input=false -auto-approve -refresh-onlyDocker
docker run --rm -u "$(id -u):$(id -g)" -e TF_CLI_CONFIG_FILE=/work/tfrc -v /tmp/tf-demo:/work -w /work hashicorp/terraform@sha256:1d10ec4073f4ddbdf34a28540a3b9250852ab500cb1c53f68c8bd17d82f474d8 apply -input=false -auto-approve -refresh-only
Change
Rewrite configuration files to canonical style and list the files that changed.
verified on linux-amd64-proxmox, 2026-10-24
Linux Debian familyRPM familymacOSWindowsDocker
Linux Debian family
terraform -chdir=/tmp/tf-demo fmt -list=trueRPM family
terraform -chdir=/tmp/tf-demo fmt -list=truemacOS
terraform -chdir=/tmp/tf-demo fmt -list=trueWindows
terraform -chdir=C:\tf-demo fmt -list=trueDocker
docker run --rm -u "$(id -u):$(id -g)" -e TF_CLI_CONFIG_FILE=/work/tfrc -v /tmp/tf-demo:/work -w /work hashicorp/terraform@sha256:1d10ec4073f4ddbdf34a28540a3b9250852ab500cb1c53f68c8bd17d82f474d8 fmt -list=true
Apply exactly the changes recorded in a saved plan file.
verified on linux-amd64-proxmox, 2026-10-24
Linux Debian familyRPM familymacOSWindowsDocker
Linux Debian family
terraform -chdir=/tmp/tf-demo apply -input=false tfplanRPM family
terraform -chdir=/tmp/tf-demo apply -input=false tfplanmacOS
terraform -chdir=/tmp/tf-demo apply -input=false tfplanWindows
terraform -chdir=C:\tf-demo apply -input=false tfplanDocker
docker run --rm -u "$(id -u):$(id -g)" -e TF_CLI_CONFIG_FILE=/work/tfrc -v /tmp/tf-demo:/work -w /work hashicorp/terraform@sha256:1d10ec4073f4ddbdf34a28540a3b9250852ab500cb1c53f68c8bd17d82f474d8 apply -input=false tfplan
Force one resource to be destroyed and created again in a single apply.
verified on linux-amd64-proxmox, 2026-10-24
Linux Debian familyRPM familymacOSWindowsDocker
Linux Debian family
terraform -chdir=/tmp/tf-demo apply -input=false -auto-approve -replace=terraform_data.demoRPM family
terraform -chdir=/tmp/tf-demo apply -input=false -auto-approve -replace=terraform_data.demomacOS
terraform -chdir=/tmp/tf-demo apply -input=false -auto-approve -replace=terraform_data.demoWindows
terraform -chdir=C:\tf-demo apply -input=false -auto-approve -replace=terraform_data.demoDocker
docker run --rm -u "$(id -u):$(id -g)" -e TF_CLI_CONFIG_FILE=/work/tfrc -v /tmp/tf-demo:/work -w /work hashicorp/terraform@sha256:1d10ec4073f4ddbdf34a28540a3b9250852ab500cb1c53f68c8bd17d82f474d8 apply -input=false -auto-approve -replace=terraform_data.demo
Troubleshoot
Print validation results as JSON so a pipeline can read the diagnostics.
verified on linux-amd64-proxmox, 2026-10-24
Linux Debian familyRPM familymacOSWindowsDocker
Linux Debian family
terraform -chdir=/tmp/tf-demo validate -jsonRPM family
terraform -chdir=/tmp/tf-demo validate -jsonmacOS
terraform -chdir=/tmp/tf-demo validate -jsonWindows
terraform -chdir=C:\tf-demo validate -jsonDocker
docker run --rm -u "$(id -u):$(id -g)" -e TF_CLI_CONFIG_FILE=/work/tfrc -v /tmp/tf-demo:/work -w /work hashicorp/terraform@sha256:1d10ec4073f4ddbdf34a28540a3b9250852ab500cb1c53f68c8bd17d82f474d8 validate -json
Plan with a detailed exit code: 0 means no changes, 2 means the configuration and state differ.
verified on linux-amd64-proxmox, 2026-10-24
Linux Debian familyRPM familymacOSWindowsDocker
Linux Debian family
terraform -chdir=/tmp/tf-demo plan -input=false -detailed-exitcodeRPM family
terraform -chdir=/tmp/tf-demo plan -input=false -detailed-exitcodemacOS
terraform -chdir=/tmp/tf-demo plan -input=false -detailed-exitcodeWindows
terraform -chdir=C:\tf-demo plan -input=false -detailed-exitcodeDocker
docker run --rm -u "$(id -u):$(id -g)" -e TF_CLI_CONFIG_FILE=/work/tfrc -v /tmp/tf-demo:/work -w /work hashicorp/terraform@sha256:1d10ec4073f4ddbdf34a28540a3b9250852ab500cb1c53f68c8bd17d82f474d8 plan -input=false -detailed-exitcode
Upgrade
Re-run init and move providers to the newest versions the constraints allow, updating the lock file.
verified on linux-amd64-proxmox, 2026-10-24
Linux Debian familyRPM familymacOSWindowsDocker
Linux Debian family
terraform -chdir=/tmp/tf-demo init -upgrade -input=falseRPM family
terraform -chdir=/tmp/tf-demo init -upgrade -input=falsemacOS
terraform -chdir=/tmp/tf-demo init -upgrade -input=falseWindows
terraform -chdir=C:\tf-demo init -upgrade -input=falseDocker
docker run --rm -u "$(id -u):$(id -g)" -e TF_CLI_CONFIG_FILE=/work/tfrc -v /tmp/tf-demo:/work -w /work hashicorp/terraform@sha256:1d10ec4073f4ddbdf34a28540a3b9250852ab500cb1c53f68c8bd17d82f474d8 init -upgrade -input=false
Remove
Remove a resource from state without destroying the real object.
verified on linux-amd64-proxmox, 2026-10-24
Linux Debian familyRPM familymacOSWindowsDocker
Linux Debian family
terraform -chdir=/tmp/tf-demo state rm terraform_data.demoRPM family
terraform -chdir=/tmp/tf-demo state rm terraform_data.demomacOS
terraform -chdir=/tmp/tf-demo state rm terraform_data.demoWindows
terraform -chdir=C:\tf-demo state rm terraform_data.demoDocker
docker run --rm -u "$(id -u):$(id -g)" -e TF_CLI_CONFIG_FILE=/work/tfrc -v /tmp/tf-demo:/work -w /work hashicorp/terraform@sha256:1d10ec4073f4ddbdf34a28540a3b9250852ab500cb1c53f68c8bd17d82f474d8 state rm terraform_data.demo
Destroy every object the configuration manages.
verified on linux-amd64-proxmox, 2026-10-24
Linux Debian familyRPM familymacOSWindowsDocker
Linux Debian family
terraform -chdir=/tmp/tf-demo destroy -input=false -auto-approveRPM family
terraform -chdir=/tmp/tf-demo destroy -input=false -auto-approvemacOS
terraform -chdir=/tmp/tf-demo destroy -input=false -auto-approveWindows
terraform -chdir=C:\tf-demo destroy -input=false -auto-approveDocker
docker run --rm -u "$(id -u):$(id -g)" -e TF_CLI_CONFIG_FILE=/work/tfrc -v /tmp/tf-demo:/work -w /work hashicorp/terraform@sha256:1d10ec4073f4ddbdf34a28540a3b9250852ab500cb1c53f68c8bd17d82f474d8 destroy -input=false -auto-approve
Commands
terraform-chdirSwitch to another working directory before running the subcommand; relative paths in later arguments resolve inside it.-help-version
initPrepare a working directory: configure the backend, install providers and modules, write the dependency lock file.-backend-backend-config-force-copy-from-module-get-input-lock-lock-timeout-no-color-json-plugin-dir-reconfigure-migrate-state-upgrade-lockfile-ignore-remote-version-test-directory
validateCheck that the configuration is syntactically valid and internally consistent without contacting remote services.-json-no-color-no-tests-query
planCompute the changes needed to make real objects match the configuration, optionally saving them to a plan file.-destroy-refresh-only-refresh-replace-target-var-file-compact-warnings-detailed-exitcode-generate-config-out-input-lock-lock-timeout-no-color-out-parallelism-state-var
applyCreate or update infrastructure, either from a saved plan file or after planning and confirming in one step.-auto-approve-backup-compact-warnings-destroy-lock-lock-timeout-input-no-color-parallelism-replace-state-state-out-var-file-var
destroyPlan and apply the removal of every object the configuration manages.consoleEvaluate Terraform expressions interactively against the current state.-state-plan-var-file-var
fmtRewrite configuration files to the canonical style.-list-write-diff-check-no-color-recursive
force-unlockRelease a state lock that a crashed run left behind.-force
getDownload or update the modules a configuration declares.-update-no-color
graphPrint the dependency graph of a configuration or saved plan in Graphviz DOT format.-plan-draw-cycles-type-module-depth
importAssociate an existing real object with a resource address in state.-config-input-lock-lock-timeout-no-color-var-file-ignore-remote-version-var
loginObtain and store an API token for a Terraform host.logoutRemove a stored API token for a Terraform host.metadataPrint machine-readable metadata about Terraform, such as function signatures.modulesList the modules a working directory declares.-json
outputPrint the root module output values stored in state.-state-no-color-json-raw
providersReport which providers the configuration and state require.lockWrite checksums for provider packages into the dependency lock file.-fs-mirror-net-mirror-platform-enable-plugin-cache-test-directory
mirrorCopy provider packages into a local mirror directory.-platform-lock-file
schemaPrint the schemas of the required providers as JSON.
querySearch for existing infrastructure with list resources.refreshUpdate state to match the real objects; superseded by apply -refresh-only.-compact-warnings-input-lock-lock-timeout-no-color-parallelism-target-var-file-var
showPrint the current state or a saved plan in human or JSON form.-no-color-json
stacksManage HCP Terraform stack operations.stateInspect and edit state with subcommands.listList resource addresses recorded in state.-state-id
showPrint the attributes of one resource in state.-state
rmForget resources in state without destroying the real objects.-dry-run-backup-lock-lock-timeout-state-ignore-remote-version
mvMove or rename a resource address in state.-dry-run-lock-lock-timeout-ignore-remote-version
pullWrite the current state to standard output.pushReplace the remote state with a local state file.-force-lock-lock-timeout
replace-providerChange the provider source address recorded in state.-auto-approve-lock-lock-timeout-ignore-remote-version
identitiesList the identities of resources recorded in state.-state-id
taintMark a resource instance for replacement on the next apply.-allow-missing-lock-lock-timeout-ignore-remote-version
testRun Terraform test files against a module.-cloud-run-filter-json-junit-xml-no-color-parallelism-var-file-verbose-var
untaintClear the tainted mark from a resource instance.-allow-missing-lock-lock-timeout-ignore-remote-version
versionPrint the Terraform version and installed provider versions.-json
workspaceCreate, list, select and delete workspaces, each with its own state.listList workspaces and mark the selected one.newCreate a workspace and switch to it.selectSwitch to an existing workspace.showPrint the name of the selected workspace.deleteDelete a workspace.-force-lock-lock-timeout
Settings
Configuration keys grouped by file or scope. Defaults carry the version they were recorded against.
environment
| Key | Type | Default | Change effect | Source |
|---|---|---|---|---|
| TF_LOG | string | runtime | source | |
| TF_LOG_PATH | string | runtime | source | |
| TF_INPUT | boolean | runtime | source | |
| TF_CLI_ARGS | string | runtime | source | |
| TF_DATA_DIR | string | runtime | source | |
| TF_WORKSPACE | string | runtime | source | |
| TF_IN_AUTOMATION | string | runtime | source | |
| TF_CLI_CONFIG_FILE | string | runtime | source | |
| TF_PLUGIN_CACHE_DIR | string | runtime | source | |
| TF_VAR_name | string | runtime | source |
cli-config-unix
| Key | Type | Default | Change effect | Source |
|---|---|---|---|---|
| plugin_cache_dir | string | runtime | source | |
| disable_checkpoint | boolean | runtime | source | |
| disable_checkpoint_signature | boolean | runtime | source | |
| credentials_helper | string | runtime | source |
Footprint
Files, directories, services and ports on each OS or provider. Paths are as recorded; unverified nodes stay labelled until Evidence backs them.
Default
Files
Feeds
OSV
As of , cached live. Status: current.
OSV returned 4 records.
These are source records, not a verdict on whether the taught version is affected. Inspect the full OSV record before acting.
- CVE-2018-9057
Published
Severity as published: CVSS_V3: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- Affected package: GIT; introduced: 0; last_affected: f9e9a59d7b5b48acf343e07fab768464bcdde4d7
- Affected package: GIT; introduced: 0; last_affected: a11f675898dba55ee8ef4538e4a30aca43ecee14
- CVE-2019-19316
Published
Severity as published: CVSS_V3: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
- Affected package: GIT; introduced: 0; fixed: f0ae01e605e0666038c22644aeb21bbeb2625005
- CVE-2023-4782
Terraform Allows Arbitrary File Write During Init Operation
Published
Severity as published: CVSS_V3: CVSS:3.1/AV:L/AC:L/PR:H/UI:R/S:C/C:L/I:H/A:N
- Affected package: GIT; introduced: f5e8851e5e81493a759b4e313e7d8738cc9968e2; fixed: ee58ac1851c8a433005df9863ed47796a9f6b5e7
- CVE-2025-13432
Terraform Enterprise state versions can be created by users with specific permissions without sufficient write access
Published
Severity as published: CVSS_V3: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N
- Affected package: GIT; introduced: b99f7beaad41a3290330621897e244030d020504; fixed: 676e5c4355e9fd8bf29009576781d4adf6dc5e80; introduced: 213488637fdb75828e4b5729bab95c489241a9aa; last_affected: 213488637fdb75828e4b5729bab95c489241a9aa
- Affected package: GIT; introduced: 0baded96c0ffe4b823c0a6c3db4b0b16bbc4ed8a; last_affected: 0baded96c0ffe4b823c0a6c3db4b0b16bbc4ed8a
endoflife.date
As of , cached live. Status: current.
endoflife.date returned 18 cycles.
Cycle 1.17
Released: 2026-10-21
Latest: 1.17.2
End of life: false
Cycle 1.16
Released: 2026-08-26
Latest: 1.16.7
End of life: false
Cycle 1.15
Released: 2026-04-29
Latest: 1.15.9
End of life: 2026-10-21
Cycle 1.14
Released: 2025-11-19
Latest: 1.14.9
End of life: 2026-08-26
Cycle 1.13
Released: 2025-08-20
Latest: 1.13.5
End of life: 2026-04-29
Cycle 1.12
Released: 2025-05-14
Latest: 1.12.2
End of life: 2025-11-19
Cycle 1.11
Released: 2025-02-27
Latest: 1.11.4
End of life: 2025-08-20
Cycle 1.10
Released: 2024-11-26
Latest: 1.10.5
End of life: 2025-05-14
Cycle 1.9
Released: 2024-06-26
Latest: 1.9.8
End of life: 2025-02-27
Cycle 1.8
Released: 2024-04-10
Latest: 1.8.5
End of life: 2024-11-26
Cycle 1.7
Released: 2024-01-17
Latest: 1.7.5
End of life: 2024-06-26
Cycle 1.6
Released: 2023-10-04
Latest: 1.6.6
End of life: 2024-04-10
Cycle 1.5
Released: 2023-06-12
Latest: 1.5.7
End of life: 2024-01-17
Cycle 1.4
Released: 2023-03-08
Latest: 1.4.7
End of life: 2023-10-04
Cycle 1.3
Released: 2022-09-21
Latest: 1.3.10
End of life: 2023-06-12
Cycle 1.2
Released: 2022-05-18
Latest: 1.2.9
End of life: 2023-03-08
Cycle 1.1
Released: 2021-12-08
Latest: 1.1.9
End of life: 2022-09-21
Cycle 1.0
Released: 2021-06-08
Latest: 1.0.11
End of life: 2022-05-18
Project activity
As of , collected daily. Status: snapshot.
RepositoryGitHub InsightsOSS Insight
Commit cadence (last 90 days)
- 2026-08-25: 2 commits
- 2026-08-26: 1 commits
- 2026-08-27: 12 commits
- 2026-08-28: 3 commits
- 2026-08-31: 4 commits
- 2026-09-01: 8 commits
- 2026-09-02: 6 commits
- 2026-09-03: 3 commits
- 2026-09-04: 8 commits
- 2026-09-07: 3 commits
- 2026-09-08: 1 commits
- 2026-09-09: 15 commits
- 2026-09-10: 5 commits
- 2026-09-11: 5 commits
- 2026-09-14: 1 commits
- 2026-09-15: 16 commits
- 2026-09-16: 1 commits
- 2026-09-17: 3 commits
- 2026-09-18: 2 commits
- 2026-09-21: 3 commits
- 2026-09-22: 5 commits
- 2026-09-23: 8 commits
- 2026-09-24: 7 commits
- 2026-09-25: 10 commits
- 2026-09-28: 1 commits
- 2026-09-29: 6 commits
- 2026-10-01: 9 commits
- 2026-10-02: 25 commits
- 2026-10-05: 42 commits
- 2026-10-06: 1 commits
- 2026-10-07: 7 commits
- 2026-10-08: 15 commits
- 2026-10-09: 4 commits
- 2026-10-12: 8 commits
- 2026-10-13: 7 commits
- 2026-10-16: 7 commits
- 2026-10-19: 3 commits
- 2026-10-20: 2 commits
- 2026-10-21: 7 commits
- 2026-10-22: 1 commits
- 2026-10-23: 2 commits
- 2026-10-27: 4 commits
- 2026-10-28: 4 commits
- 2026-10-29: 3 commits
- 2026-10-30: 4 commits
- 2026-10-31: 1 commits
- 2026-11-02: 2 commits
- 2026-11-03: 2 commits
- 2026-11-04: 11 commits
- 2026-11-05: 4 commits
- 2026-11-06: 11 commits
- 2026-11-09: 7 commits
- 2026-11-10: 7 commits
- 2026-11-11: 7 commits
- 2026-11-12: 2 commits
- 2026-11-13: 2 commits
- 2026-11-16: 5 commits
- 2026-11-17: 3 commits
- 2026-11-19: 6 commits
- 2026-11-20: 1 commits
Taught version HashiCorp Terraform documentation snapshot 2026-07-26 is not present in this release snapshot.
Contributor spread (top 12 in snapshot)
- jbardin: 4326 contributions
- mitchellh: 4025 contributions
- apparentlymart: 2966 contributions
- stack72: 2121 contributions
- catsby: 1728 contributions
- radeksimko: 1327 contributions
- phinze: 1245 contributions
- jen20: 1116 contributions
- alisdair: 842 contributions
- laurapacilio: 634 contributions
Tags: v1.17.2, v1.17.1, v1.16.7, v1.17.0, v1.17.0-rc2, v1.16.6, v1.17.0-rc1, v1.16.5, v1.17.0-beta2, v1.16.4, v1.16.3, v1.17.0-beta1, v1.16.2, v1.16.1, v1.17.0-alpha20260827, v1.16.0, v1.16.0-rc2, v1.15.9, v1.17.0-alpha20260812, v1.16.0-rc1
Pull requests: 420 opened, 364 closed in the snapshot window.
Issues: 94 opened, 71 closed in the snapshot window.
Relations
OpenTofu
fork (course-scoped), fork
Source basisHCP Terraform
managed-service (course-scoped), managed-offering
Source basisTerraform Enterprise
integration (course-scoped), integration-listing
Source basisSpacelift
managed-service (course-scoped), managed-offering
Source basisenv zero
managed-service (course-scoped), managed-offering
Source basisScalr
drop-in-compatible (course-scoped), compatibility
Source basisAtlantis
integration (course-scoped), integration-listing
Source basis
Course guides
No public HOWTO titles are available yet.
Learn Terraform in the owner course →