StringValidator
String validator are used to validate the plan of a string attribute.
It will be used into the Validators
field of the schema.StringAttribute
struct.
How to use it
import (
fstringvalidator "github.com/FrangipaneTeam/terraform-plugin-framework-validators/stringvalidator"
)
List of Validators
RequireIfAttributeIsOneOf
- This validator is used to require the attribute if another attribute is one of the given values.RequireIfAttributeIsSet
- This validator is used to require the attribute if another attribute is set.NullIfAttributeIsOneOf
- This validator is used to verify the attribute value is null if another attribute is one of the given values.NullIfAttributeIsSet
- This validator is used to verify the attribute value is null if another attribute is set.OneOfWithDescription
- This validator is used to check if the string is one of the given values and format the description and the markdown description.
Network
IsNetwork
- This validator is a generic validator for checking if the string is a valid network format.IsIP
- (DEPRECATED) This validator is used to check if the string is a valid IP address.IsNetmask
- This validator is used to check if the string is a valid netmask.IsMacAddress
- This validator is used to check if the string is a valid MAC address.
String
IsURN
- This validator is used to check if the string is a valid URN.IsUUID
- This validator is used to check if the string is a valid UUID.PrefixContains
- This validator is used to check if the string contains prefix in the given value.
Special
Not
- This validator is used to negate the result of another validator.