17ac9a5756
`All()` combines the outputs of multiple `SchemaValidateFunc`, to reduce the usage of custom validation functions that implement standard validation functions. Example provider usage: ```go ValidateFunc: validation.All( StringLenBetween(5, 42), StringMatch(regexp.MustCompile(`[a-zA-Z0-9]+`), "value must be alphanumeric"), ), ``` `IntInSlice()` is the `int` equivalent of `StringInSlice()` Example provider usage: ```go ValidateFunc: validation.IntInSlice([]int{30, 60, 120}) ``` Output from unit testing: ``` $ make test TEST=./helper/validation ==> Checking that code complies with gofmt requirements... go generate ./... 2018/10/17 14:16:03 Generated command/internal_plugin_list.go go list ./helper/validation | xargs -t -n4 go test -timeout=2m -parallel=4 go test -timeout=2m -parallel=4 github.com/hashicorp/terraform/helper/validation ok github.com/hashicorp/terraform/helper/validation 1.106s ``` |
||
---|---|---|
.. | ||
acctest | ||
config | ||
copy | ||
customdiff | ||
didyoumean | ||
diff | ||
encryption | ||
experiment | ||
hashcode | ||
hilmapstructure | ||
logging | ||
mutexkv | ||
pathorcontents | ||
plugin | ||
resource | ||
schema | ||
shadow | ||
signalwrapper | ||
slowmessage | ||
structure | ||
validation | ||
variables | ||
wrappedreadline | ||
wrappedstreams | ||
README.md |
README.md
Helper Libraries
This folder contains helper libraries for Terraform plugins. A running joke is that this is "Terraform standard library" for plugins. The goal of the packages in this directory are to provide high-level helpers to make it easier to implement the various aspects of writing a plugin for Terraform.