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

AWS CodeCommit – Complete Step-by-Step Tutorial

Beginner to Advanced | macOS, Linux, Git, SSH, IAM, CodeBuild This master tutorial covers the complete AWS CodeCommit workflow, from creating your first repository to managing source…

Read More

AWS Developer Services: Console Lab Guide

title AWS Developer Services: Gold-Standard Console Lab Guide subtitle CodeCommit • CodeArtifact • CodeBuild • CodeDeploy • CodePipeline author Instructor Edition | Browser-Only Labs date 10 November…

Read More

Oracle Cloud Always Free VPS — Complete Step-by-Step Tutorial

Beginner to Advanced | Updated: November 2, 2026 | Verified against official Oracle Cloud Infrastructure documentation This guide walks you through logging in to Oracle Cloud, configuring…

Read More

Microsoft Sentinel Intermediate: One Complete End-to-End Hands-On Lab – Part – 3

Module 2: Intermediate | Day 3 only | Complete instructor-and-learner manual Edition: 1 November 2026Course: Microsoft Sentinel Technical Training — 5-day progressive curriculumThis document: Day 3 only; prerequisite: successful completion of Foundations…

Read More

Microsoft Sentinel Advance: One Complete End-to-End Hands-On Lab – Part – 4

Module 3: Advanced | Day 4 only | Detection Engineering, Threat Hunting and SOAR Curriculum version: 1 November 2026Course: Five-day progressive Microsoft Sentinel technical trainingThis manual: Day 4 only — syllabus competencies A01–A14Prerequisite: Demonstrated…

Read More

Microsoft Sentinel Advance: One Complete End-to-End Hands-On Lab – Part – 5

Module 3: Advanced | Day 5 only | Enterprise Architecture, Data Lake, DevSecOps and SOC Governance Edition: 1 November 2026Training path: Day 5 of the five-day progressive Microsoft Sentinel programThis manual: Day…

Read More