Skip to content
Sarj Code Standards

no-terraform-comments

Express Terraform intent through names and descriptions, with optional concise module summaries.

Why

Names and descriptions carry executable intent. An optional short entrypoint summary exposes module purpose without a separate catalog.

Fix

Use clear names and native descriptions. Opt into module_summaries for one short main.tf header; keep other context in the owning declaration or change review.

Examples

Before — flagged A Terraform comment duplicates executable intent
main.tf
# Keep this bucket private.
resource "example_bucket" "private" {}
After — preferred A resource name and description express intent
main.tf
resource "example_bucket" "private" {
description = "Private application storage"
}
Before — flagged Keep operators separated when removing an empty block comment
main.tf
locals { value = 1 /**/ + 2 }
After — preferred Whitespace preserves the original Terraform operators
main.tf
locals { value = 1 + 2 }
Autofix output
main.tf
locals { value = 1 + 2 }
Before — flagged Remove an empty Terraform line comment
main.tf
#
locals { value = 1 }
After — preferred The executable Terraform remains unchanged
main.tf
locals { value = 1 }
Autofix output
main.tf
locals { value = 1 }