Install Terraform on Amazon Linux 2023: Step-by-Step Guide
Install Terraform on Amazon Linux 2023 using the HashiCorp repository or manual binary download. Verify installation, configure autocomplete
DevOps
Install Terraform on Debian 12 Bookworm using the HashiCorp APT repository or manual binary download. Includes verification, autocomplete setup
Debian doesn't include Terraform in its default repositories. You need to add the HashiCorp APT repository or download the binary manually. Both methods work on Debian 12 (Bookworm), 11 (Bullseye), and newer.
# Install prerequisites
sudo apt-get update
sudo apt-get install -y gnupg software-properties-common curl
# Add HashiCorp GPG key
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
# Add repository
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
# Install Terraform
sudo apt-get update
sudo apt-get install -y terraform
# Verify
terraform version
# Terraform v1.10.0# Download
TERRAFORM_VERSION="1.10.0"
curl -fsSL "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip" -o terraform.zip
# Install unzip if needed
sudo apt-get install -y unzip
# Extract and install
unzip terraform.zip
sudo mv terraform /usr/local/bin/
rm terraform.zip
# Verify
terraform versionTERRAFORM_VERSION="1.10.0"
curl -fsSL "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_arm64.zip" -o terraform.zip
unzip terraform.zip
sudo mv terraform /usr/local/bin/TERRAFORM_VERSION="1.10.0"
# Download binary + SHA256 sums + signature
curl -fsSL "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip" -o terraform.zip
curl -fsSL "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_SHA256SUMS" -o SHA256SUMS
curl -fsSL "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_SHA256SUMS.sig" -o SHA256SUMS.sig
# Import HashiCorp GPG key
curl -fsSL https://www.hashicorp.com/.well-known/pgp-key.txt | gpg --import
# Verify signature
gpg --verify SHA256SUMS.sig SHA256SUMS
# Verify checksum
sha256sum -c SHA256SUMS --ignore-missing
# terraform_1.10.0_linux_amd64.zip: OKterraform -install-autocomplete
source ~/.bashrc
# Test: terraform pl<TAB> → terraform planFROM debian:bookworm-slim
RUN apt-get update && \
apt-get install -y gnupg curl lsb-release && \
curl -fsSL https://apt.releases.hashicorp.com/gpg | gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg && \
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" > /etc/apt/sources.list.d/hashicorp.list && \
apt-get update && \
apt-get install -y terraform && \
apt-get clean && rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["terraform"]# APT repository — standard apt upgrade
sudo apt-get update
sudo apt-get install --only-upgrade terraform
# Manual — download new version
TERRAFORM_VERSION="1.10.1"
curl -fsSL "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip" -o terraform.zip
unzip terraform.zip
sudo mv terraform /usr/local/bin/# APT method
sudo apt-get remove terraform
# Manual method
sudo rm /usr/local/bin/terraformmkdir ~/terraform-test && cd ~/terraform-test
cat > main.tf << 'EOF'
terraform {
required_providers {
local = {
source = "hashicorp/local"
version = "~> 2.0"
}
}
}
resource "local_file" "hello" {
content = "Hello from Terraform on Debian!"
filename = "${path.module}/hello.txt"
}
EOF
terraform init
terraform apply -auto-approve
cat hello.txt
# Hello from Terraform on Debian!sudo apt-get install -y lsb-releaseOr hardcode the codename:
# Debian 12
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com bookworm main" | sudo tee /etc/apt/sources.list.d/hashicorp.list# Re-download the key
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpgsudo mv terraform /usr/local/bin/
sudo chmod +x /usr/local/bin/terraformThe HashiCorp APT repository is the easiest way to install Terraform on Debian — one-time setup, then apt-get install terraform with automatic updates. For airgapped or minimal systems, download the binary directly. Both methods take under 2 minutes.
Install Terraform on Amazon Linux 2023 using the HashiCorp repository or manual binary download. Verify installation, configure autocomplete
Install and manage multiple Terraform versions with tfenv. Switch between versions per project, auto-detect from .terraform-version files
Install AWS CLI v2 on Ubuntu 22.04 and 24.04 using the official installer, snap, or pip. Configure credentials, test with Terraform, and set up autocomplete.
Install AWS CLI v2 on Windows using winget in one command. Configure credentials, set up PowerShell autocomplete, and verify with Terraform.