openskills.info
← All tool references

source-available

Terraform

Open, provenance-stamped install, usage, command, settings and footprint reference for Terraform, paired with the Terraform Fundamentals course.

Distribution
source-available
Licence
Not published
Reference version
HashiCorp Terraform documentation snapshot 2026-07-26
Current upstream version
Not published
Provenance
Captured source data

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 version

    verified 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 version

    unverified

macOS

  • brew

    set -eu
    brew tap hashicorp/tap
    brew install hashicorp/tap/terraform
    terraform version

    unverified

Windows

  • binary

    No install command is published yet.

    unverified

Docker

  • docker

    docker run --rm hashicorp/terraform@sha256:1d10ec4073f4ddbdf34a28540a3b9250852ab500cb1c53f68c8bd17d82f474d8 version

    verified 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=false
  • RPM family
    terraform -chdir=/tmp/tf-demo init -input=false
  • macOS
    terraform -chdir=/tmp/tf-demo init -input=false
  • Windows
    terraform -chdir=C:\tf-demo init -input=false
  • Docker
    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 staging
  • RPM family
    terraform -chdir=/tmp/tf-demo workspace new staging
  • macOS
    terraform -chdir=/tmp/tf-demo workspace new staging
  • Windows
    terraform -chdir=C:\tf-demo workspace new staging
  • Docker
    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 version
  • RPM family
    terraform -chdir=/tmp/tf-demo version
  • macOS
    terraform -chdir=/tmp/tf-demo version
  • Windows
    terraform -chdir=C:\tf-demo version
  • Docker
    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 validate
  • RPM family
    terraform -chdir=/tmp/tf-demo validate
  • macOS
    terraform -chdir=/tmp/tf-demo validate
  • Windows
    terraform -chdir=C:\tf-demo validate
  • Docker
    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 show
  • RPM family
    terraform -chdir=/tmp/tf-demo show
  • macOS
    terraform -chdir=/tmp/tf-demo show
  • Windows
    terraform -chdir=C:\tf-demo show
  • Docker
    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 list
  • RPM family
    terraform -chdir=/tmp/tf-demo state list
  • macOS
    terraform -chdir=/tmp/tf-demo state list
  • Windows
    terraform -chdir=C:\tf-demo state list
  • Docker
    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.demo
  • RPM family
    terraform -chdir=/tmp/tf-demo state show terraform_data.demo
  • macOS
    terraform -chdir=/tmp/tf-demo state show terraform_data.demo
  • Windows
    terraform -chdir=C:\tf-demo state show terraform_data.demo
  • Docker
    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 greeting
  • RPM family
    terraform -chdir=/tmp/tf-demo output -raw greeting
  • macOS
    terraform -chdir=/tmp/tf-demo output -raw greeting
  • Windows
    terraform -chdir=C:\tf-demo output -raw greeting
  • Docker
    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 providers
  • RPM family
    terraform -chdir=/tmp/tf-demo providers
  • macOS
    terraform -chdir=/tmp/tf-demo providers
  • Windows
    terraform -chdir=C:\tf-demo providers
  • Docker
    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 graph
  • RPM family
    terraform -chdir=/tmp/tf-demo graph
  • macOS
    terraform -chdir=/tmp/tf-demo graph
  • Windows
    terraform -chdir=C:\tf-demo graph
  • Docker
    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 list
  • RPM family
    terraform -chdir=/tmp/tf-demo workspace list
  • macOS
    terraform -chdir=/tmp/tf-demo workspace list
  • Windows
    terraform -chdir=C:\tf-demo workspace list
  • Docker
    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=tfplan
  • RPM family
    terraform -chdir=/tmp/tf-demo plan -input=false -out=tfplan
  • macOS
    terraform -chdir=/tmp/tf-demo plan -input=false -out=tfplan
  • Windows
    terraform -chdir=C:\tf-demo plan -input=false -out=tfplan
  • Docker
    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-only
  • RPM family
    terraform -chdir=/tmp/tf-demo apply -input=false -auto-approve -refresh-only
  • macOS
    terraform -chdir=/tmp/tf-demo apply -input=false -auto-approve -refresh-only
  • Windows
    terraform -chdir=C:\tf-demo apply -input=false -auto-approve -refresh-only
  • Docker
    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=true
  • RPM family
    terraform -chdir=/tmp/tf-demo fmt -list=true
  • macOS
    terraform -chdir=/tmp/tf-demo fmt -list=true
  • Windows
    terraform -chdir=C:\tf-demo fmt -list=true
  • Docker
    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 tfplan
  • RPM family
    terraform -chdir=/tmp/tf-demo apply -input=false tfplan
  • macOS
    terraform -chdir=/tmp/tf-demo apply -input=false tfplan
  • Windows
    terraform -chdir=C:\tf-demo apply -input=false tfplan
  • Docker
    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.demo
  • RPM family
    terraform -chdir=/tmp/tf-demo apply -input=false -auto-approve -replace=terraform_data.demo
  • macOS
    terraform -chdir=/tmp/tf-demo apply -input=false -auto-approve -replace=terraform_data.demo
  • Windows
    terraform -chdir=C:\tf-demo apply -input=false -auto-approve -replace=terraform_data.demo
  • Docker
    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 -json
  • RPM family
    terraform -chdir=/tmp/tf-demo validate -json
  • macOS
    terraform -chdir=/tmp/tf-demo validate -json
  • Windows
    terraform -chdir=C:\tf-demo validate -json
  • Docker
    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-exitcode
  • RPM family
    terraform -chdir=/tmp/tf-demo plan -input=false -detailed-exitcode
  • macOS
    terraform -chdir=/tmp/tf-demo plan -input=false -detailed-exitcode
  • Windows
    terraform -chdir=C:\tf-demo plan -input=false -detailed-exitcode
  • Docker
    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=false
  • RPM family
    terraform -chdir=/tmp/tf-demo init -upgrade -input=false
  • macOS
    terraform -chdir=/tmp/tf-demo init -upgrade -input=false
  • Windows
    terraform -chdir=C:\tf-demo init -upgrade -input=false
  • Docker
    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.demo
  • RPM family
    terraform -chdir=/tmp/tf-demo state rm terraform_data.demo
  • macOS
    terraform -chdir=/tmp/tf-demo state rm terraform_data.demo
  • Windows
    terraform -chdir=C:\tf-demo state rm terraform_data.demo
  • Docker
    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-approve
  • RPM family
    terraform -chdir=/tmp/tf-demo destroy -input=false -auto-approve
  • macOS
    terraform -chdir=/tmp/tf-demo destroy -input=false -auto-approve
  • Windows
    terraform -chdir=C:\tf-demo destroy -input=false -auto-approve
  • Docker
    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
    • -chdir Switch to another working directory before running the subcommand; relative paths in later arguments resolve inside it.
    • -help
    • -version
    • init Prepare 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
    • validate Check that the configuration is syntactically valid and internally consistent without contacting remote services.
      • -json
      • -no-color
      • -no-tests
      • -query
    • plan Compute 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
    • apply Create 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
    • destroy Plan and apply the removal of every object the configuration manages.
    • console Evaluate Terraform expressions interactively against the current state.
      • -state
      • -plan
      • -var-file
      • -var
    • fmt Rewrite configuration files to the canonical style.
      • -list
      • -write
      • -diff
      • -check
      • -no-color
      • -recursive
    • force-unlock Release a state lock that a crashed run left behind.
      • -force
    • get Download or update the modules a configuration declares.
      • -update
      • -no-color
    • graph Print the dependency graph of a configuration or saved plan in Graphviz DOT format.
      • -plan
      • -draw-cycles
      • -type
      • -module-depth
    • import Associate an existing real object with a resource address in state.
      • -config
      • -input
      • -lock
      • -lock-timeout
      • -no-color
      • -var-file
      • -ignore-remote-version
      • -var
    • login Obtain and store an API token for a Terraform host.
    • logout Remove a stored API token for a Terraform host.
    • metadata Print machine-readable metadata about Terraform, such as function signatures.
    • modules List the modules a working directory declares.
      • -json
    • output Print the root module output values stored in state.
      • -state
      • -no-color
      • -json
      • -raw
    • providers Report which providers the configuration and state require.
      • lock Write checksums for provider packages into the dependency lock file.
        • -fs-mirror
        • -net-mirror
        • -platform
        • -enable-plugin-cache
        • -test-directory
      • mirror Copy provider packages into a local mirror directory.
        • -platform
        • -lock-file
      • schema Print the schemas of the required providers as JSON.
    • query Search for existing infrastructure with list resources.
    • refresh Update state to match the real objects; superseded by apply -refresh-only.
      • -compact-warnings
      • -input
      • -lock
      • -lock-timeout
      • -no-color
      • -parallelism
      • -target
      • -var-file
      • -var
    • show Print the current state or a saved plan in human or JSON form.
      • -no-color
      • -json
    • stacks Manage HCP Terraform stack operations.
    • state Inspect and edit state with subcommands.
      • list List resource addresses recorded in state.
        • -state
        • -id
      • show Print the attributes of one resource in state.
        • -state
      • rm Forget resources in state without destroying the real objects.
        • -dry-run
        • -backup
        • -lock
        • -lock-timeout
        • -state
        • -ignore-remote-version
      • mv Move or rename a resource address in state.
        • -dry-run
        • -lock
        • -lock-timeout
        • -ignore-remote-version
      • pull Write the current state to standard output.
      • push Replace the remote state with a local state file.
        • -force
        • -lock
        • -lock-timeout
      • replace-provider Change the provider source address recorded in state.
        • -auto-approve
        • -lock
        • -lock-timeout
        • -ignore-remote-version
      • identities List the identities of resources recorded in state.
        • -state
        • -id
    • taint Mark a resource instance for replacement on the next apply.
      • -allow-missing
      • -lock
      • -lock-timeout
      • -ignore-remote-version
    • test Run Terraform test files against a module.
      • -cloud-run
      • -filter
      • -json
      • -junit-xml
      • -no-color
      • -parallelism
      • -var-file
      • -verbose
      • -var
    • untaint Clear the tainted mark from a resource instance.
      • -allow-missing
      • -lock
      • -lock-timeout
      • -ignore-remote-version
    • version Print the Terraform version and installed provider versions.
      • -json
    • workspace Create, list, select and delete workspaces, each with its own state.
      • list List workspaces and mark the selected one.
      • new Create a workspace and switch to it.
      • select Switch to an existing workspace.
      • show Print the name of the selected workspace.
      • delete Delete a workspace.
        • -force
        • -lock
        • -lock-timeout

Settings

Configuration keys grouped by file or scope. Defaults carry the version they were recorded against.

environment

KeyTypeDefaultChange effectSource
TF_LOGstringruntimesource
TF_LOG_PATHstringruntimesource
TF_INPUTbooleanruntimesource
TF_CLI_ARGSstringruntimesource
TF_DATA_DIRstringruntimesource
TF_WORKSPACEstringruntimesource
TF_IN_AUTOMATIONstringruntimesource
TF_CLI_CONFIG_FILEstringruntimesource
TF_PLUGIN_CACHE_DIRstringruntimesource
TF_VAR_namestringruntimesource

cli-config-unix

KeyTypeDefaultChange effectSource
plugin_cache_dirstringruntimesource
disable_checkpointbooleanruntimesource
disable_checkpoint_signaturebooleanruntimesource
credentials_helperstringruntimesource

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

  • cli-config-unix

    ~/.terraformrc

    Source

  • cli-config-windows

    %APPDATA%\terraform.rc

    Source

  • dependency-lock

    .terraform.lock.hcl

    Source

  • local-state

    terraform.tfstate

    Source

Directories

  • working-data

    .terraform

    Source

  • user-plugins-unix

    ~/.terraform.d/plugins

    Source

  • user-plugins-windows

    %APPDATA%\terraform.d\plugins

    Source

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)

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
Release timeline

Taught version HashiCorp Terraform documentation snapshot 2026-07-26 is not present in this release snapshot.

Contributor spread (top 12 in 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 basis
  • HCP Terraform

    managed-service (course-scoped), managed-offering

    Source basis
  • Terraform Enterprise

    integration (course-scoped), integration-listing

    Source basis
  • Spacelift

    managed-service (course-scoped), managed-offering

    Source basis
  • env zero

    managed-service (course-scoped), managed-offering

    Source basis
  • Scalr

    drop-in-compatible (course-scoped), compatibility

    Source basis
  • Atlantis

    integration (course-scoped), integration-listing

    Source basis

Course guides

No public HOWTO titles are available yet.

Learn Terraform in the owner course →