Add Linter for calling d.SetId("")
in resource Create, Delete or Update functions
#18390
Closed
2 of 3 tasks
Labels
linter
Pertains to changes to or issues with the various linters.
technical-debt
Addresses areas of the codebase that need refactoring or redesign.
Milestone
Community Note
Description
Our resource lifecycle guidelines state that
d.SetId("")
should only be called in a resource Read function.Add a linter to warn if
d.SetId("")
is called in a resource Create, Update or Delete function and correct all failing cases.For Create and Update, return any underling error (with context if necessary). For Delete, return
nil
.Suggested Semgrep Rule
Current Report
Definition Of Done
.semgrep.yml
d.SetId("")
in resource Update not currently notedBonus Points
^resourceAws\\w*Create$"
and similar for Update and DeleteThe text was updated successfully, but these errors were encountered: