S013¶
SchemasStandard
check for map[string]*Schema that one of Computed, Optional, or Required is configured
The S013 analyzer reports cases of schemas which one of Computed,
Optional, or Required is not configured, which will fail provider
schema validation.
Examples¶
Resource Identity Schemas¶
Resource identity schemas are declared as an ordinary map[string]*schema.Schema
but configure RequiredForImport or OptionalForImport in place of Computed,
Optional, or Required. S013 skips any attribute declaring either field, so
identity schemas are not reported:
&schema.ResourceIdentity{
Version: 0,
SchemaFunc: func() map[string]*schema.Schema {
return map[string]*schema.Schema{
"id": {
Type: schema.TypeString,
RequiredForImport: true,
},
}
},
}
Ignoring reports¶
Singular reports can be ignored by adding a //lintignore:S013 Go code comment at the end of the offending line or on the line immediately preceding, e.g.
This page is generated from passes/S013/README.md, which lives beside the analyzer.