Updated: October 2026 | Windows 10/11 | PowerShell 5.1 / 7
This guide covers installing, verifying, and running the first commands for five Terraform development tools.
| Tool | Purpose | First command |
|---|---|---|
| TFLint | Terraform linting and best practices | tflint |
| terraform-docs | Generate Terraform documentation | terraform-docs markdown table . |
| Trivy | Security and IaC scanning | trivy config . |
| tenv | Manage Terraform/OpenTofu versions | tenv tf install latest |
| pre-commit | Automatically run checks before commits | pre-commit run --all-files |
1. Prerequisites
Open Windows PowerShell or Windows Terminal.
Check your Windows package manager and development tools:
winget --version
git --version
py --version
terraform version
If Git and Python are missing, install them:
winget install -e --id Git.Git
winget install -e --id Python.Python.3.13
Restart PowerShell after installing software so the updated PATH is loaded.
2. TFLint
TFLint checks Terraform code for potential errors, deprecated syntax, unused declarations, and provider-specific issues.
Install (WinGet):
winget install -e --id TerraformLinters.tflint
Verify:
tflint --version
Get-Command tflint
First execution in your Terraform project:
cd C:\terraform-project
# Initialize configured TFLint plugins
tflint --init
# Scan Terraform files in the current directory
tflint
# Scan Terraform directories recursively
tflint --recursive
# Show available options
tflint --help
--init installs any configured external ruleset plugins; the built-in Terraform ruleset is already included.
Official source: TFLint installation and usage.
3. Terraform Docs
terraform-docs automatically generates documentation for Terraform providers, resources, variables, outputs, and modules.
Install using Scoop:
If Scoop is not installed, run the following in a regular (non-administrator) PowerShell session:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
Now install terraform-docs:
scoop bucket add terraform-docs https://github.com/terraform-docs/scoop-bucket
scoop install terraform-docs
Verify:
terraform-docs --version
Get-Command terraform-docs
First execution:
cd C:\terraform-project
# Generate Markdown documentation in the terminal
terraform-docs markdown table .
# Generate README.md automatically
terraform-docs markdown table --output-file README.md --output-mode inject .
# View the generated documentation
Get-Content README.md
# Help
terraform-docs --help
The inject option updates the generated documentation section without replacing the rest of an existing README.
Official source: Terraform Docs installation.
4. Trivy
Trivy scans Terraform configurations for security misconfigurations and can also scan container images, dependencies, and secrets.
Install (WinGet):
winget install -e --id AquaSecurity.Trivy
Verify:
trivy --version
Get-Command trivy
First execution:
cd C:\terraform-project
# Scan Terraform code for security misconfigurations
trivy config .
# Show only high and critical findings
trivy config --severity HIGH,CRITICAL .
# Scan vulnerabilities, secrets, and misconfigurations
trivy fs --scanners vuln,misconfig,secret .
# Scan a container image
trivy image alpine:3.21
# Show command help
trivy --help
The first scan may download Trivy’s security databases and checks, so internet connectivity is required.
Official source: Trivy installation and Terraform scanning.
5. tenv
tenv is a version manager for Terraform, OpenTofu, Terragrunt, and related tools. It is useful when different projects require different Terraform versions.
Install (WinGet):
winget install -e --id Tofuutils.Tenv
Verify:
tenv version
Get-Command tenv
First execution:
# Install the latest stable Terraform version
tenv tf install latest
# Select the latest installed Terraform version
tenv tf use latest
# Verify Terraform
terraform version
# List locally installed Terraform versions
tenv tf list
# Detect the version selected for the current directory
tenv tf detect
# List available remote Terraform versions
tenv tf list-remote
Optional: Install OpenTofu
tenv tofu install latest
tenv tofu use latest
tofu version
If Terraform was previously installed separately, check which executable PowerShell is using:
Get-Command terraform -All
The tenv-managed executable should take precedence in PATH for tenv version switching to work correctly.
Official source: tenv documentation.
6. pre-commit
pre-commit runs automated checks before Git commits to help catch problems early.
Install using Python and pipx:
# Install pipx
py -m pip install --user pipx
# Add pipx executables to PATH
py -m pipx ensurepath
Restart PowerShell, then run:
pipx install pre-commit
Verify:
pre-commit --version
Get-Command pre-commit
First execution inside a Git repository:
cd C:\terraform-project
# Initialize Git only if this is not already a repository
git init
# Generate a sample hook configuration
pre-commit sample-config | Out-File -Encoding utf8 .pre-commit-config.yaml
# Install Git hooks
pre-commit install
# Stage files for the initial test
git add .
# Run hooks against all tracked files
pre-commit run --all-files
# View available commands
pre-commit --help
Once installed, configured checks run automatically when you execute git commit.
Official source: pre-commit documentation and pipx installation.
7. Verify all five installations together
After completing the installations and reopening PowerShell, run:
Write-Host "=== TFLint ==="
tflint --version
Write-Host "=== Terraform Docs ==="
terraform-docs --version
Write-Host "=== Trivy ==="
trivy --version
Write-Host "=== tenv ==="
tenv version
Write-Host "=== pre-commit ==="
pre-commit --version
Write-Host "=== Terraform ==="
terraform version
8. Quick hands-on Terraform lab
If you don’t have an existing Terraform project, create a sample project first.
# Create a demo directory
New-Item -ItemType Directory -Force "$HOME\terraform-tools-demo" | Out-Null
Set-Location "$HOME\terraform-tools-demo"
# Create example Terraform code
@'
terraform {
required_version = ">= 1.5.0"
}
variable "project_name" {
description = "Name of the demo project"
type = string
default = "terraform-demo"
}
output "project_name" {
description = "Selected project name"
value = var.project_name
}
'@ | Set-Content -Encoding utf8 main.tf
# Run checks
terraform fmt
terraform validate
tflint --init
tflint
terraform-docs markdown table .
trivy config .
These commands allow you to test Terraform formatting, validation, linting, documentation generation, and security scanning on Windows without creating cloud infrastructure.
9. Quick command reference
| Tool | Install | Verify | First run |
|---|---|---|---|
| TFLint | winget install -e --id TerraformLinters.tflint | tflint --version | tflint --init; tflint |
| Terraform Docs | scoop install terraform-docs | terraform-docs --version | terraform-docs markdown table . |
| Trivy | winget install -e --id AquaSecurity.Trivy | trivy --version | trivy config . |
| tenv | winget install -e --id Tofuutils.Tenv | tenv version | tenv tf install latest |
| pre-commit | pipx install pre-commit | pre-commit --version | pre-commit run --all-files |
The installation commands were checked against current documentation and package listings. They have not been executed on your Windows computer. The terraform-docs Scoop command assumes its bucket was added in Section 3.