S014

SchemasStandard

check for Schema within Elem that Computed, Optional, and Required are not configured

The S014 analyzer reports cases of schemas which the Elem has Computed, Optional, or Required configured, which will fail provider schema validation.

Examples

map[string]*schema.Schema{
    "attribute_name": {
        Elem:     &schema.Schema{
            Required: true,
            Type:     schema.TypeString,
        },
        Required: true,
        Type:     schema.TypeList,
    },
}
map[string]*schema.Schema{
    "attribute_name": {
        Elem:     &schema.Schema{
            Type: schema.TypeString,
        },
        Required: true,
        Type:     schema.TypeList,
    },
}

Ignoring reports

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

//lintignore:S014
map[string]*schema.Schema{
    "attribute_name": {
        Elem:     &schema.Schema{
            Required: true,
            Type:     schema.TypeString,
        },
        Required: true,
        Type:     schema.TypeList,
    },
}

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