terraform-plugin-sdk: github.com/hashicorp/terraform-plugin-sdk/helper/validation Index | Files

package validation

import "github.com/hashicorp/terraform-plugin-sdk/helper/validation"

Index

Package Files

float.go int.go list.go map.go meta.go network.go strings.go testing.go time.go uuid.go web.go

func All Uses

func All(validators ...schema.SchemaValidateFunc) schema.SchemaValidateFunc

All returns a SchemaValidateFunc which tests if the provided value passes all provided SchemaValidateFunc

func Any Uses

func Any(validators ...schema.SchemaValidateFunc) schema.SchemaValidateFunc

Any returns a SchemaValidateFunc which tests if the provided value passes any of the provided SchemaValidateFunc

func FloatAtLeast Uses

func FloatAtLeast(min float64) schema.SchemaValidateFunc

FloatAtLeast returns a SchemaValidateFunc which tests if the provided value is of type float and is at least min (inclusive)

func FloatAtMost Uses

func FloatAtMost(max float64) schema.SchemaValidateFunc

FloatAtMost returns a SchemaValidateFunc which tests if the provided value is of type float and is at most max (inclusive)

func FloatBetween Uses

func FloatBetween(min, max float64) schema.SchemaValidateFunc

FloatBetween returns a SchemaValidateFunc which tests if the provided value is of type float64 and is between min and max (inclusive).

func IntAtLeast Uses

func IntAtLeast(min int) schema.SchemaValidateFunc

IntAtLeast returns a SchemaValidateFunc which tests if the provided value is of type int and is at least min (inclusive)

func IntAtMost Uses

func IntAtMost(max int) schema.SchemaValidateFunc

IntAtMost returns a SchemaValidateFunc which tests if the provided value is of type int and is at most max (inclusive)

func IntBetween Uses

func IntBetween(min, max int) schema.SchemaValidateFunc

IntBetween returns a SchemaValidateFunc which tests if the provided value is of type int and is between min and max (inclusive)

func IntDivisibleBy Uses

func IntDivisibleBy(divisor int) schema.SchemaValidateFunc

IntDivisibleBy returns a SchemaValidateFunc which tests if the provided value is of type int and is divisible by a given number

func IntInSlice Uses

func IntInSlice(valid []int) schema.SchemaValidateFunc

IntInSlice returns a SchemaValidateFunc which tests if the provided value is of type int and matches the value of an element in the valid slice

func IntNotInSlice Uses

func IntNotInSlice(valid []int) schema.SchemaValidateFunc

IntNotInSlice returns a SchemaValidateFunc which tests if the provided value is of type int and matches the value of an element in the valid slice

func IsCIDR Uses

func IsCIDR(i interface{}, k string) (warnings []string, errors []error)

IsCIDR is a SchemaValidateFunc which tests if the provided value is of type string and a valid CIDR

func IsCIDRNetwork Uses

func IsCIDRNetwork(min, max int) schema.SchemaValidateFunc

IsCIDRNetwork returns a SchemaValidateFunc which tests if the provided value is of type string, is in valid Value network notation, and has significant bits between min and max (inclusive)

func IsDayOfTheWeek Uses

func IsDayOfTheWeek(ignoreCase bool) schema.SchemaValidateFunc

IsDayOfTheWeek id a SchemaValidateFunc which tests if the provided value is of type string and a valid english day of the week

func IsIPAddress Uses

func IsIPAddress(i interface{}, k string) (warnings []string, errors []error)

IsIPAddress is a SchemaValidateFunc which tests if the provided value is of type string and is a single IP (v4 or v6)

func IsIPv4Address Uses

func IsIPv4Address(i interface{}, k string) (warnings []string, errors []error)

IsIPv4Address is a SchemaValidateFunc which tests if the provided value is of type string and a valid IPv4 address

func IsIPv4Range Uses

func IsIPv4Range(i interface{}, k string) (warnings []string, errors []error)

IsIPv4Range is a SchemaValidateFunc which tests if the provided value is of type string, and in valid IP range

func IsIPv6Address Uses

func IsIPv6Address(i interface{}, k string) (warnings []string, errors []error)

IsIPv6Address is a SchemaValidateFunc which tests if the provided value is of type string and a valid IPv6 address

func IsMACAddress Uses

func IsMACAddress(i interface{}, k string) (warnings []string, errors []error)

IsMACAddress is a SchemaValidateFunc which tests if the provided value is of type string and a valid MAC address

func IsMonth Uses

func IsMonth(ignoreCase bool) schema.SchemaValidateFunc

IsMonth id a SchemaValidateFunc which tests if the provided value is of type string and a valid english month

func IsPortNumber Uses

func IsPortNumber(i interface{}, k string) (warnings []string, errors []error)

IsPortNumber is a SchemaValidateFunc which tests if the provided value is of type string and a valid TCP Port Number

func IsPortNumberOrZero Uses

func IsPortNumberOrZero(i interface{}, k string) (warnings []string, errors []error)

IsPortNumberOrZero is a SchemaValidateFunc which tests if the provided value is of type string and a valid TCP Port Number or zero

func IsRFC3339Time Uses

func IsRFC3339Time(i interface{}, k string) (warnings []string, errors []error)

IsRFC3339Time is a SchemaValidateFunc which tests if the provided value is of type string and a valid RFC33349Time

func IsURLWithHTTPS Uses

func IsURLWithHTTPS(i interface{}, k string) (_ []string, errors []error)

IsURLWithHTTPS is a SchemaValidateFunc which tests if the provided value is of type string and a valid HTTPS URL

func IsURLWithHTTPorHTTPS Uses

func IsURLWithHTTPorHTTPS(i interface{}, k string) (_ []string, errors []error)

IsURLWithHTTPorHTTPS is a SchemaValidateFunc which tests if the provided value is of type string and a valid HTTP or HTTPS URL

func IsURLWithScheme Uses

func IsURLWithScheme(validSchemes []string) schema.SchemaValidateFunc

IsURLWithScheme is a SchemaValidateFunc which tests if the provided value is of type string and a valid URL with the provided schemas

func IsUUID Uses

func IsUUID(i interface{}, k string) (warnings []string, errors []error)

IsUUID is a ValidateFunc that ensures a string can be parsed as UUID

func ListOfUniqueStrings Uses

func ListOfUniqueStrings(i interface{}, k string) (warnings []string, errors []error)

ListOfUniqueStrings is a ValidateFunc that ensures a list has no duplicate items in it. It's useful for when a list is needed over a set because order matters, yet the items still need to be unique.

func MapKeyLenBetween Uses

func MapKeyLenBetween(min, max int) schema.SchemaValidateDiagFunc

MapKeyLenBetween returns a SchemaValidateDiagFunc which tests if the provided value is of type map and the length of all keys are between min and max (inclusive)

func MapKeyMatch Uses

func MapKeyMatch(r *regexp.Regexp, message string) schema.SchemaValidateDiagFunc

MapKeyMatch returns a SchemaValidateDiagFunc which tests if the provided value is of type map and all keys match a given regexp. Optionally an error message can be provided to return something friendlier than "expected to match some globby regexp".

func MapValueLenBetween Uses

func MapValueLenBetween(min, max int) schema.SchemaValidateDiagFunc

MapValueLenBetween returns a SchemaValidateDiagFunc which tests if the provided value is of type map and the length of all values are between min and max (inclusive)

func MapValueMatch Uses

func MapValueMatch(r *regexp.Regexp, message string) schema.SchemaValidateDiagFunc

MapValueMatch returns a SchemaValidateDiagFunc which tests if the provided value is of type map and all values match a given regexp. Optionally an error message can be provided to return something friendlier than "expected to match some globby regexp".

func NoZeroValues Uses

func NoZeroValues(i interface{}, k string) (s []string, es []error)

NoZeroValues is a SchemaValidateFunc which tests if the provided value is not a zero value. It's useful in situations where you want to catch explicit zero values on things like required fields during validation.

func StringDoesNotContainAny Uses

func StringDoesNotContainAny(chars string) schema.SchemaValidateFunc

StringDoesNotContainAny returns a SchemaValidateFunc which validates that the provided value does not contain any of the specified Unicode code points in chars.

func StringDoesNotMatch Uses

func StringDoesNotMatch(r *regexp.Regexp, message string) schema.SchemaValidateFunc

StringDoesNotMatch returns a SchemaValidateFunc which tests if the provided value does not match a given regexp. Optionally an error message can be provided to return something friendlier than "must not match some globby regexp".

func StringInSlice Uses

func StringInSlice(valid []string, ignoreCase bool) schema.SchemaValidateFunc

StringInSlice returns a SchemaValidateFunc which tests if the provided value is of type string and matches the value of an element in the valid slice will test with in lower case if ignoreCase is true

func StringIsBase64 Uses

func StringIsBase64(i interface{}, k string) (warnings []string, errors []error)

StringIsBase64 is a ValidateFunc that ensures a string can be parsed as Base64

func StringIsEmpty Uses

func StringIsEmpty(i interface{}, k string) ([]string, []error)

StringIsEmpty is a ValidateFunc that ensures a string has no characters

func StringIsJSON Uses

func StringIsJSON(i interface{}, k string) (warnings []string, errors []error)

StringIsJSON is a SchemaValidateFunc which tests to make sure the supplied string is valid JSON.

func StringIsNotEmpty Uses

func StringIsNotEmpty(i interface{}, k string) ([]string, []error)

StringIsNotEmpty is a ValidateFunc that ensures a string is not empty

func StringIsNotWhiteSpace Uses

func StringIsNotWhiteSpace(i interface{}, k string) ([]string, []error)

StringIsNotWhiteSpace is a ValidateFunc that ensures a string is not empty or consisting entirely of whitespace characters

func StringIsValidRegExp Uses

func StringIsValidRegExp(i interface{}, k string) (warnings []string, errors []error)

StringIsValidRegExp returns a SchemaValidateFunc which tests to make sure the supplied string is a valid regular expression.

func StringIsWhiteSpace Uses

func StringIsWhiteSpace(i interface{}, k string) ([]string, []error)

StringIsWhiteSpace is a ValidateFunc that ensures a string is composed of entirely whitespace

func StringLenBetween Uses

func StringLenBetween(min, max int) schema.SchemaValidateFunc

StringLenBetween returns a SchemaValidateFunc which tests if the provided value is of type string and has length between min and max (inclusive)

func StringMatch Uses

func StringMatch(r *regexp.Regexp, message string) schema.SchemaValidateFunc

StringMatch returns a SchemaValidateFunc which tests if the provided value matches a given regexp. Optionally an error message can be provided to return something friendlier than "must match some globby regexp".

func StringNotInSlice Uses

func StringNotInSlice(invalid []string, ignoreCase bool) schema.SchemaValidateFunc

StringNotInSlice returns a SchemaValidateFunc which tests if the provided value is of type string and does not match the value of any element in the invalid slice will test with in lower case if ignoreCase is true

Package validation imports 17 packages (graph) and is imported by 153 packages. Updated 2020-07-29. Refresh now. Tools for package owners.