Terraform tflint terraform-docs trivy tenv pre-commit Tools — Installation Guide for Windows PowerShell

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.

ToolPurposeFirst command
TFLintTerraform linting and best practicestflint
terraform-docsGenerate Terraform documentationterraform-docs markdown table .
TrivySecurity and IaC scanningtrivy config .
tenvManage Terraform/OpenTofu versionstenv tf install latest
pre-commitAutomatically run checks before commitspre-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

ToolInstallVerifyFirst run
TFLintwinget install -e --id TerraformLinters.tflinttflint --versiontflint --init; tflint
Terraform Docsscoop install terraform-docsterraform-docs --versionterraform-docs markdown table .
Trivywinget install -e --id AquaSecurity.Trivytrivy --versiontrivy config .
tenvwinget install -e --id Tofuutils.Tenvtenv versiontenv tf install latest
pre-commitpipx install pre-commitpre-commit --versionpre-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.

Related Posts

HCP Terraform Cloud CLI — Master Command Summary Table

Organization: motoshare | Project: proezi | Workspaces: proezi_dev, proezi_stage, proezi_prod 1. Terraform CLI — Complete Command Reference Category Command Purpose / Usage Installation terraform version Check installed…

Read More

HCP Terraform Cloud CLI — Complete Master Tutorial

HCP Terraform Cloud — CLI Command Summary Organization: motoshare | Project: proezi # Cloud operation Command / Example Usage 1 Login to Terraform Cloud terraform login Authenticate…

Read More

Terraform Lab – Azure Hands-On – Terraform Functions

Beginner to Intermediate · 8 modules · 22 progressively designed labs · 20 local-only labs + 2 optional cloud labs · Updated 14 October 2026 Purpose: learn Terraform…

Read More

Terraform Lab – Azure Hands-On – Terraform Template

Level: Beginner to IntermediateFormat: Tutorial + concept guide + practical lab workbookModules: 6 | Labs: 12 | Cloud emphasis: Azure Linux VM, AWS EC2 comparisonBaseline: Terraform 1.15.9+ (within 1.x); AzureRM 5.9.x; AWS provider 6.xUpdated: 14 October…

Read More

Terraform Lab – Azure Hands-On – Terraform Modules

Course level: Beginner → IntermediateCourse type: Tutorial + runnable hands-on exercises + instructor checkpointsUpdated: 14 October 2026Terraform: >= 1.15.0, < 2.0.0 (lab baseline: 1.15.9)AzureRM provider: ~> 5.9.0 (root; child modules declare >= 5.9.0)Azure baseline: eastus, Ubuntu…

Read More

Terraform Lab – Azure Hands-On – Conditional Expressions and Logic

This workbook teaches the complete set of Terraform conditionals, filtering, validation, null handling, and related functions from the requested syllabus. Every numbered concept includes one standalone AWS EC2…

Read More