Custom tflint Plugin for trusty_terraform Linting¶
- Date: 2026-03-16
- Status: Accepted
- Tags:
toolingtflintterraform
Context¶
The trusty_terraform repository relies on tflint-ruleset-sheldon (v0.0.6)
for key-attribute ordering enforcement across 121 resource types. Sheldon is a
third-party plugin that is not actively maintained for our specific needs, and
we want the ability to add trusty-specific rules (e.g., AWS resource types not
covered by sheldon, custom naming conventions, module structure checks).
Forking sheldon was considered but rejected in favour of building an in-house plugin that ports the existing functionality and extends it.
Decision¶
We will create phazeight/tflint-ruleset-trusty — a custom Go-based tflint
plugin built on the tflint-plugin-sdk. The plugin:
- Ports sheldon's
key_attributesordering rule with all 121 default resource type definitions - Adds 21 AWS resource type key-attribute definitions not present in sheldon
- Uses the same custom
RuleSet/Runnerarchitecture as sheldon to support per-resource configuration via.tflint.hcl - Ships with GoReleaser + PGP-signed GitHub releases for
tflint --initsupport - Replaces the
sheldonplugin reference intrusty_terraform/.tflint.hcl
The scaffolded source code lives in claude/patterns/tflint-ruleset-trusty/
and should be copied into the new phazeight/tflint-ruleset-trusty repository.
Alternatives Considered¶
| Option | Why Rejected |
|---|---|
| Continue using sheldon | No AWS resource support, no control over release cadence or rule additions |
| Fork sheldon | Carries dead code (sorting/spacing rules not needed), harder to maintain divergent Go module path |
| Use tflint built-in rules only | No key-attribute ordering enforcement available in core tflint |
Consequences¶
Positive:
- Full control over rule definitions and release schedule
- AWS resource coverage added (21 new resource types)
- Single plugin covers all providers used in trusty_terraform
- User-configurable via
.tflint.hclresource blocks
Negative / Trade-offs:
- Must maintain Go plugin code and publish releases
- Sheldon updates (if any) must be manually back-ported
Ongoing obligations:
- Add new resource type key-attribute definitions as trusty_terraform adopts new providers/resources
- Keep
tflint-plugin-sdkdependency up to date with tflint CLI releases - Publish signed releases when rules change
ADRs are immutable. If this decision changes, create a new ADR with status "Superseded by" pointing here, and update this record's status.