You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
New Checks for common unstable d.SetId() values and introduce standard library package helpers (#193)
* Introduce standard library helpers and pass for fmt.Sprintf() calls
Functionality to replace current Terraform AWS Provider handling and generally will be useful in the future.
* passes: New Checks for common unstable d.SetId() values
Reference: #191
Reference: #192
Copy file name to clipboardExpand all lines: README.md
+3
Original file line number
Diff line number
Diff line change
@@ -109,6 +109,9 @@ Standard lint checks are enabled by default in the `tfproviderlint` tool. Opt-in
109
109
|[R012](passes/R012/README.md)| check for data source `Resource` that configure `CustomizeDiff`| AST |
110
110
|[R013](passes/R013/README.md)| check for `map[string]*Resource` that resource names contain at least one underscore | AST |
111
111
|[R014](passes/R014/README.md)| check for `CreateFunc`, `DeleteFunc`, `ReadFunc`, and `UpdateFunc` parameter naming | AST |
112
+
|[R015](passes/R015/README.md)| check for `(*schema.ResourceData).SetId()` receiver method usage with unstable `resource.UniqueId()` value | AST |
113
+
|[R016](passes/R016/README.md)| check for `(*schema.ResourceData).SetId()` receiver method usage with unstable `resource.PrefixedUniqueId()` value | AST |
114
+
|[R017](passes/R017/README.md)| check for `(*schema.ResourceData).SetId()` receiver method usage with unstable `time.Now()` value | AST |
The R015 analyzer reports [`(*schema.ResourceData).SetId()`](https://godoc.org/github.com/hashicorp/terraform-plugin-sdk/helper/schema#ResourceData.Set) usage with unstable `resource.UniqueId()` value. Schema attributes should be stable across Terraform runs.
4
+
5
+
## Flagged Code
6
+
7
+
```go
8
+
d.SetId(resource.UniqueId())
9
+
```
10
+
11
+
## Passing Code
12
+
13
+
```go
14
+
d.SetId("stablestring")
15
+
```
16
+
17
+
## Ignoring Reports
18
+
19
+
Singular reports can be ignored by adding the a `//lintignore:R015` Go code comment at the end of the offending line or on the line immediately proceding, e.g.
0 commit comments