config

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2020 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultDecodeHookFuncs = []mapstructure.DecodeHookFunc{
	uint8ToStringHook,
	stringToTrilean,
	mapstructure.StringToSliceHookFunc(","),
	mapstructure.StringToTimeDurationHookFunc(),
}
View Source
var DeprecatedOptions = map[string][]string{
	"*":                                   []string{"iso_md5", "ssh_key_path", "ssh_disable_agent", "ssh_host_port_min", "ssh_host_port_max", "ssh_skip_nat_mapping", "ssh_wait_timeout", "iso_checksum_url", "iso_checksum_type"},
	"*amazon*":                            []string{"shutdown_behaviour", "enhanced_networking", "ssh_private_ip", "temporary_security_group_source_cidr", "clean_ami_name", "spot_price_auto_product"},
	"Azure*":                              []string{"clean_image_name", "exlude_from_latest"},
	"MSOpenTech.hyperv":                   []string{"vhd_temp_path", "clone_from_vmxc_path", "cpu", "ram_size"},
	"ansible":                             []string{"galaxycommand"},
	"hashicorp.scaleway":                  []string{"access_key"},
	"jetbrains.vsphere":                   []string{"network_card", "network", "networkCard", "disk_size", "disk_thin_provisioned", "disk_eagerly_scrub"},
	"mitchellh.virtualbox":                []string{"guest_additions_attach"},
	"packer.docker":                       []string{"login_email"},
	"packer.googlecompute":                []string{"clean_image_name"},
	"packer.parallels":                    []string{"headless", "parallels_tools_host_path", "guest_os_distribution"},
	"packer.post-processor.docker-import": []string{"login_email"},
	"packer.post-processor.docker-tag":    []string{"tag"},
	"packer.post-processor.manifest":      []string{"filename"},
	"transcend.qemu":                      []string{"ssh_host_port_max", "ssh_host_port_min"},
}

Functions

func Decode

func Decode(target interface{}, config *DecodeOpts, raws ...interface{}) error

Decode decodes the configuration into the target and optionally automatically interpolates all the configuration as it goes.

func DetectContext

func DetectContext(raws ...interface{}) (*interpolate.Context, error)

DetectContext builds a base interpolate.Context, automatically detecting things like user variables from the raw configuration params.

func DetectContextData added in v1.5.0

func DetectContextData(raws ...interface{}) (map[interface{}]interface{}, []interface{})

Types

type DecodeOpts

type DecodeOpts struct {
	// Metadata, if non-nil, will be set to the metadata post-decode
	Metadata *mapstructure.Metadata

	// Interpolate, if true, will automatically interpolate the
	// configuration with the given InterpolateContext. User variables
	// will be automatically detected and added in-place to the given
	// context.
	Interpolate        bool
	InterpolateContext *interpolate.Context
	InterpolateFilter  *interpolate.RenderFilter

	// PluginType is the BuilderID, etc of the plugin -- it is used to
	// determine whether to tell the user to "fix" their template if an
	// unknown option is a deprecated one for this plugin type.
	PluginType string

	DecodeHooks []mapstructure.DecodeHookFunc
}

DecodeOpts are the options for decoding configuration.

type Trilean added in v1.4.4

type Trilean uint8
const (
	// This will assign unset to 0, which is the default value in interpolation
	TriUnset Trilean = iota
	TriTrue
	TriFalse
)

func TrileanFromBool added in v1.4.4

func TrileanFromBool(b bool) Trilean

func TrileanFromString added in v1.4.4

func TrileanFromString(s string) (Trilean, error)

func (Trilean) False added in v1.4.4

func (t Trilean) False() bool

func (Trilean) ToBoolPointer added in v1.4.4

func (t Trilean) ToBoolPointer() *bool

func (Trilean) ToString added in v1.4.4

func (t Trilean) ToString() string

func (Trilean) True added in v1.4.4

func (t Trilean) True() bool

Jump to

Keyboard shortcuts

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