R016

ResourcesStandard

check for (*schema.ResourceData).SetId() receiver method usage with unstable resource.PrefixedUniqueId() value

The R016 analyzer reports (*schema.ResourceData).SetId() usage with unstable resource.PrefixedUniqueId() value. Schema attributes should be stable across Terraform runs.

Examples

d.SetId(resource.PrefixedUniqueId("example"))
d.SetId("stablestring")

Ignoring reports

Singular reports can be ignored by adding a //lintignore:R016 Go code comment at the end of the offending line or on the line immediately preceding, e.g.

//lintignore:R016
d.SetId(resource.PrefixedUniqueId("example"))

This page is generated from passes/R016/README.md, which lives beside the analyzer.