config

package
v0.11.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2017 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(target interface{}, raws ...interface{}) (*mapstructure.Metadata, error)

Types

type Validator

type Validator struct {
	Required []string
	Optional []string
}

Validator is a helper that helps you validate the configuration of your resource, resource provider, etc.

At the most basic level, set the Required and Optional lists to be specifiers of keys that are required or optional. If a key shows up that isn't in one of these two lists, then an error is generated.

The "specifiers" allowed in this is a fairly rich syntax to help describe the format of your configuration:

  • Basic keys are just strings. For example: "foo" will match the "foo" key.

  • Nested structure keys can be matched by doing "listener.*.foo". This will verify that there is at least one listener element that has the "foo" key set.

  • The existence of a nested structure can be checked by simply doing "listener.*" which will verify that there is at least one element in the "listener" structure. This is NOT validating that "listener" is an array. It is validating that it is a nested structure in the configuration.

func (*Validator) Validate

func (v *Validator) Validate(
	c *terraform.ResourceConfig) (ws []string, es []error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL