Skip to content

Quick Start

Get started with TerraTidy in under 5 minutes.

Initialize Configuration

Create a .terratidy.yaml configuration file in your project:

terratidy init

This creates a default configuration:

# TerraTidy Configuration
# Documentation: https://github.com/santosr2/TerraTidy
version: 1

# Global settings
severity_threshold: warning
fail_fast: false
parallel: true

# Engine configurations
engines:
  fmt:
    enabled: true

  style:
    enabled: true

  lint:
    enabled: true

  policy:
    enabled: false
    # policy_dirs:
    #   - ./policies

# Per-engine rule configuration
# engines:
#   style:
#     rules:
#       style.blank-line-between-blocks:
#         enabled: true
#         severity: warning
#   lint:
#     rules:
#       lint.terraform-required-version:
#         enabled: true
#         severity: error

Run Checks

Check All Files

terratidy check

Check Specific Files or Directories

terratidy check ./modules/
terratidy check main.tf variables.tf

Check Only Changed Files (Git)

terratidy check --changed

Exclude Files or Directories

terratidy check --exclude "test/**,**/*.generated.tf"

Run Individual Engines

# Format only
terratidy fmt

# Style checks only
terratidy style

# Lint only
terratidy lint

# Policy checks only
terratidy policy

Fix Issues

Auto-fix All Fixable Issues

terratidy fix

Fix Formatting Only

terratidy fmt

Fix Style Issues

terratidy style --fix

Output Formats

# Default text output
terratidy check

# JSON output
terratidy check --format json

# SARIF for GitHub Code Scanning
terratidy check --format sarif

# HTML report
terratidy check --format html > report.html

Common Workflows

CI/CD Check

terratidy check --format sarif --severity-threshold error

Pre-commit Hook

terratidy check --changed

Development Workflow

# Format and fix issues
terratidy fix

# Verify all checks pass
terratidy check

Next Steps