# terraform-linters/tflint-ruleset-terraform architecture

> Architecture diagram of the GitHub repository terraform-linters/tflint-ruleset-terraform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/terraform-linters/tflint-ruleset-terraform
- Repository: https://github.com/terraform-linters/tflint-ruleset-terraform

## Overview

This repository is a TFLint plugin ruleset for Terraform: TFLint starts the plugin, which serves a ruleset of checks that inspect Terraform modules and report issues, sometimes with fixes. The rule families cover syntax and deprecated constructs, naming and module conventions, provider/version requirements, unused declarations, and module sources and workspaces. The README documents plugin use and the broad purpose; source excerpts show the plugin entry point and several rule implementations. Some internal dispatch details are not shown, so those links are marked unverified.

Main entry points: [`terraform/runner.go`](https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/terraform/runner.go) (Terraform runner), [`main.go`](https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/main.go) (Plugin entry), [`terraform/ruleset.go`](https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/terraform/ruleset.go) (Terraform ruleset), [`rules/preset.go`](https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/rules/preset.go) (Rule presets)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_plugin["Plugin runtime"]
  node_entry["Plugin entry<br/>[main.go]"]
  node_ruleset["Terraform ruleset<br/>[ruleset.go]"]
  node_preset["Rule presets<br/>[preset.go]"]
  node_runner["Terraform runner<br/>[runner.go]"]
  node_config["Plugin configuration<br/>[config.go]"]
end

subgraph group_syntax["Syntax and declarations"]
  node_syntaxrules["Syntax checks"]
  node_deprecated["Deprecated syntax"]
  node_declarations["Declaration checks"]
  node_documented["Documented variables and outputs"]
end

subgraph group_conventions["Module conventions"]
  node_naming["Naming conventions"]
  node_structure["Module structure"]
  node_workspace["Workspace backend check"]
end

subgraph group_dependencies["Providers and modules"]
  node_providers["Provider requirements"]
  node_moduleversion["Module versions"]
  node_pinned["Pinned module sources"]
  node_shallow["Shallow cloning"]
end

node_host(("TFLint host"))

node_host -->|"starts plugin"| node_entry
node_entry -->|"serves ruleset"| node_ruleset
node_entry -->|"sets presets"| node_preset
node_ruleset -.->|"dispatches checks"| node_runner
node_runner -.->|"loads configuration"| node_config
node_runner -.->|"runs checks"| node_syntaxrules
node_runner -.->|"runs checks"| node_deprecated
node_runner -.->|"runs checks"| node_declarations
node_runner -.->|"runs checks"| node_documented
node_runner -.->|"runs checks"| node_naming
node_runner -.->|"runs checks"| node_structure
node_runner -.->|"runs checks"| node_workspace
node_runner -.->|"runs checks"| node_providers
node_runner -.->|"runs checks"| node_moduleversion
node_runner -.->|"runs checks"| node_pinned
node_runner -.->|"runs checks"| node_shallow

click node_entry "https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/main.go"
click node_ruleset "https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/terraform/ruleset.go"
click node_preset "https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/rules/preset.go"
click node_runner "https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/terraform/runner.go"
click node_config "https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/terraform/config.go"
click node_syntaxrules "https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/rules/terraform_json_syntax.go"
click node_deprecated "https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/rules/terraform_deprecated_interpolation.go"
click node_declarations "https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/rules/terraform_unused_declarations.go"
click node_documented "https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/rules/terraform_documented.go"
click node_naming "https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/rules/terraform_naming_convention.go"
click node_structure "https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/rules/terraform_standard_module_structure.go"
click node_workspace "https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/rules/terraform_workspace_remote.go"
click node_providers "https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/rules/terraform_required_providers.go"
click node_moduleversion "https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/rules/terraform_module_version.go"
click node_pinned "https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/rules/terraform_module_pinned_source.go"
click node_shallow "https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/rules/terraform_module_shallow_clone.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_ruleset,node_preset,node_runner,node_config toneBlue
class node_syntaxrules,node_deprecated,node_declarations,node_documented toneAmber
class node_naming,node_structure,node_workspace toneMint
class node_providers,node_moduleversion,node_pinned,node_shallow toneRose
class node_host toneIndigo
```

## Components

### Plugin runtime

- [Plugin entry](https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/main.go): `main.go`
- [Terraform ruleset](https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/terraform/ruleset.go): `terraform/ruleset.go`
- [Rule presets](https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/rules/preset.go): `rules/preset.go`
- [Terraform runner](https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/terraform/runner.go): `terraform/runner.go`
- [Plugin configuration](https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/terraform/config.go): `terraform/config.go`

### Syntax and declarations

- [Syntax checks](https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/rules/terraform_json_syntax.go): `rules/terraform_json_syntax.go`
- [Deprecated syntax](https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/rules/terraform_deprecated_interpolation.go): `rules/terraform_deprecated_interpolation.go`
- [Declaration checks](https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/rules/terraform_unused_declarations.go): `rules/terraform_unused_declarations.go`
- [Documented variables and outputs](https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/rules/terraform_documented.go): `rules/terraform_documented.go`

### Module conventions

- [Naming conventions](https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/rules/terraform_naming_convention.go): `rules/terraform_naming_convention.go`
- [Module structure](https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/rules/terraform_standard_module_structure.go): `rules/terraform_standard_module_structure.go`
- [Workspace backend check](https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/rules/terraform_workspace_remote.go): `rules/terraform_workspace_remote.go`

### Providers and modules

- [Provider requirements](https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/rules/terraform_required_providers.go): `rules/terraform_required_providers.go`
- [Module versions](https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/rules/terraform_module_version.go): `rules/terraform_module_version.go`
- [Pinned module sources](https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/rules/terraform_module_pinned_source.go): `rules/terraform_module_pinned_source.go`
- [Shallow cloning](https://github.com/terraform-linters/tflint-ruleset-terraform/blob/main/rules/terraform_module_shallow_clone.go): `rules/terraform_module_shallow_clone.go`

### Other components

- **TFLint host**

## Connections

- TFLint host → Plugin entry: starts plugin (evidence: `README.md`)
- Plugin entry → Terraform ruleset: serves ruleset (evidence: `main.go`)
- Plugin entry → Rule presets: sets presets (evidence: `main.go`)
- Terraform ruleset → Terraform runner: dispatches checks
- Terraform runner → Plugin configuration: loads configuration
- Terraform runner → Syntax checks: runs checks
- Terraform runner → Deprecated syntax: runs checks
- Terraform runner → Declaration checks: runs checks
- Terraform runner → Documented variables and outputs: runs checks
- Terraform runner → Naming conventions: runs checks
- Terraform runner → Module structure: runs checks
- Terraform runner → Workspace backend check: runs checks
- Terraform runner → Provider requirements: runs checks
- Terraform runner → Module versions: runs checks
- Terraform runner → Pinned module sources: runs checks
- Terraform runner → Shallow cloning: runs checks
