v0.2.0¶
NOTES
- Write-only attributes (
WriteOnly, Terraform 1.11+,terraform-plugin-sdkv2.36.0+) are now covered byS041,S042, andS043. Providers adopting them had no lint coverage before this release. - This release changes which findings are reported. A provider that ran clean on v0.1.1 may report new findings without any change to its own code, and
tfsproutexits3when it does. Plan to re-baseline CI when upgrading.
FEATURES
- New Check:
S038: check forSchemawith bothValidateFuncandValidateDiagFuncconfigured. The two are mutually exclusive and configuring both fails provider schema validation withValidateFunc and ValidateDiagFunc cannot both be set. - New Check:
S039: check forSchemawith invalid resource identity configuration. An identity attribute may only configureType,Description,Elem, and exactly one ofRequiredForImportorOptionalForImport; anything else fails provider schema validation via(*schema.ResourceIdentity).InternalIdentityValidate. Because the SDK rejects the import fields outside an identity schema, this also catches the inverse mistake of settingRequiredForImporton an ordinary resource attribute. - New Check:
S040: check forSchemawith onlyComputedenabled andValidateDiagFuncconfigured. TheValidateDiagFunccounterpart toS010, and the last of the threeValidateDiagFuncfailures in(schemaMap).internalValidate. - New Check:
S041: check forSchemawithWriteOnlyand an incompatible field configured.Computed,ForceNew,Default, andDefaultFuncare each rejected alongsideWriteOnly; one report is emitted per offending field. - New Check:
S042: check forSchemaofTypeList,TypeMap, orTypeSetwithWriteOnlyenabled. Write-only values are only supported on primitive types. - New Check:
S043: check forSchemaofTypeSetorComputedblock containingWriteOnlyattributes at any depth, mirroring the SDK's own(schemaMap).hasWriteOnlyrecursion.
BUG FIXES
S013: no longer reports resource identity schema attributes. Identity schemas are declared as an ordinarymap[string]*schema.Schemabut configureRequiredForImport/OptionalForImportin place ofComputed,Optional, orRequired, so every attribute of every identity schema was reported. The bug is inherited fromtfproviderlint(see bflad/tfproviderlint#340) and affects any provider adopting Terraform 1.12 resource identity. Verified againstterraform-provider-scaleway, where it accounted for 21 of the 22 findings tfsprout reported. Identity schemas are now validated on their own terms by the newS039.
ENHANCEMENTS
S009: now also reportsValidateDiagFuncconfigured on aTypeListorTypeSetschema, not justValidateFunc. The Terraform Plugin SDK rejects both identically (ValidateFunc and ValidateDiagFunc are not yet supported on lists or sets), so they are one rule and share theS009ID. Existing//lintignore:S009comments continue to suppress both, and no previously reported finding has changed position — only the report message, which now names both fields.
v0.1.1¶
BUG FIXES
- Fix
internal error: package "context" without types was imported from ...crash when analyzing providers under Go 1.27. Upgradedgolang.org/x/toolsfromv0.30.0tov0.49.0, whose reworkedgo/packagesloader falls back to export data instead of a hardlog.Fatalfwhen a dependency package arrives without complete type information. The minimum Go version (godirective) is now1.25.0, as required by the newergolang.org/x/tools. - Fix checks silently failing to match types referenced through a Go type alias (e.g.
type RetryError = resource.RetryError) under Go 1.23+. With materialized type aliases now the default (gotypesalias=1),go/typesreports a*types.Aliaswhere a*types.Namedwas previously seen, so theIsType*matchers fell through and stopped firing. The type-matching switches inhelper/terraformtypeandhelper/astutils, plusR004, now resolve aliases withtypes.Unaliasbefore matching.
v0.1.0¶
NOTES
- tfsprout is a fork of
tfproviderlint, a static analysis tool for Terraform Providers. This release renames the project and its commands (tfproviderlint->tfsprout,tfproviderlintx->tfsproutx) and updates the Go module path togithub.com/jfrappier/tfsprout. No lint check functionality has changed. For the history prior to the fork, see the upstreamtfproviderlintCHANGELOG. - v0.1.0 is intended as a drop-in replacement for the last
tfproviderlintrelease: the lint checks and their behavior are identical, and there are no new features. Only the project name, command names, and module path have changed. Migrating is a matter of swapping the binary/command names (tfproviderlint->tfsprout,tfproviderlintx->tfsproutx).