conf

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VariantFileExt = ".variant"
)

Variables

View Source
var JSONPathFunc = function.New(&function.Spec{
	Params: []function.Parameter{
		{
			Name: "data",
			Type: cty.String,
		},
		{
			Name: "query",
			Type: cty.String,
		},
	},
	VarParam: &function.Parameter{
		Name: "file",
		Type: cty.String,
	},
	Type: func(args []cty.Value) (cty.Type, error) {
		data := args[0].AsString()
		query := args[1].AsString()

		v, err := getValueAtJSONPath(data, query)

		return v.Type(), err
	},
	Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) {
		data := args[0].AsString()
		query := args[1].AsString()

		v, err := getValueAtJSONPath(data, query)

		return v, err
	},
})

JSONPathFunc takes JSON and a query to fetch the value for the query.

Functions

func FindVariantFiles

func FindVariantFiles(fs *fs.FileSystem, path string) ([]string, error)

FindVariantFiles walks the given path and returns the files ending whose ext is .variant Also, it returns the path if the path is just a file and a HCL file.

func Functions

func Functions(baseDir string) map[string]function.Function

Functions is a set of functions that are available in .variant files. This set should cover all the functions available in moderately up-to-date version of Terraform, so that the experience of using functions should be easier for users who are used with Terraform.

Types

This section is empty.

Jump to

Keyboard shortcuts

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