Documentation
¶
Overview ¶
Package hcl2template defines code to parse hcl2 template files correctly.
In order to configure a packer builder,provisioner,communicator and post processor.
Checkout the files in testdata/complete/ to see what a packer config could look like.
Code generated by "mapstructure-to-hcl2 -type MockConfig,NestedMockConfig"; DO NOT EDIT.
Index ¶
- type BuildBlock
- type Builds
- type Decodable
- type FlatMockConfig
- type FlatNestedMockConfig
- type HCL2Ref
- type MockBuilder
- type MockCommunicator
- type MockConfig
- type MockPostProcessor
- type MockProvisioner
- type NestedMockConfig
- type PackerConfig
- type PackerV1Variables
- type Parser
- func (p *Parser) CoreBuildPostProcessors(blocks []*PostProcessorBlock) ([]packer.CoreBuildPostProcessor, hcl.Diagnostics)
- func (p *Parser) CoreBuildProvisioners(blocks []*ProvisionerBlock, generatedVars []string) ([]packer.CoreBuildProvisioner, hcl.Diagnostics)
- func (p *Parser) Parse(path string) ([]packer.Build, hcl.Diagnostics)
- func (p *Parser) StartBuilder(source *Source) (packer.Builder, hcl.Diagnostics, []string)
- func (p *Parser) StartPostProcessor(pp *PostProcessorBlock) (packer.PostProcessor, hcl.Diagnostics)
- func (p *Parser) StartProvisioner(pb *ProvisionerBlock, generatedVars []string) (packer.Provisioner, hcl.Diagnostics)
- type PostProcessorBlock
- type ProvisionerBlock
- type Source
- type SourceRef
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuildBlock ¶ added in v1.5.0
type BuildBlock struct {
ProvisionerBlocks []*ProvisionerBlock
PostProcessors []*PostProcessorBlock
Froms []SourceRef
HCL2Ref HCL2Ref
}
type Builds ¶
type Builds []*BuildBlock
type Decodable ¶
type Decodable interface {
ConfigSpec() hcldec.ObjectSpec
}
type FlatMockConfig ¶ added in v1.5.0
type FlatMockConfig struct {
String *string `mapstructure:"string" cty:"string"`
Int *int `mapstructure:"int" cty:"int"`
Int64 *int64 `mapstructure:"int64" cty:"int64"`
Bool *bool `mapstructure:"bool" cty:"bool"`
Trilean *bool `mapstructure:"trilean" cty:"trilean"`
Duration *string `mapstructure:"duration" cty:"duration"`
MapStringString map[string]string `mapstructure:"map_string_string" cty:"map_string_string"`
SliceString []string `mapstructure:"slice_string" cty:"slice_string"`
Nested *FlatNestedMockConfig `mapstructure:"nested" cty:"nested"`
NestedSlice []FlatNestedMockConfig `mapstructure:"nested_slice" cty:"nested_slice"`
}
FlatMockConfig is an auto-generated flat version of MockConfig. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
type FlatNestedMockConfig ¶ added in v1.5.0
type FlatNestedMockConfig struct {
String *string `mapstructure:"string" cty:"string"`
Int *int `mapstructure:"int" cty:"int"`
Int64 *int64 `mapstructure:"int64" cty:"int64"`
Bool *bool `mapstructure:"bool" cty:"bool"`
Trilean *bool `mapstructure:"trilean" cty:"trilean"`
Duration *string `mapstructure:"duration" cty:"duration"`
MapStringString map[string]string `mapstructure:"map_string_string" cty:"map_string_string"`
SliceString []string `mapstructure:"slice_string" cty:"slice_string"`
}
FlatNestedMockConfig is an auto-generated flat version of NestedMockConfig. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
func (*FlatNestedMockConfig) HCL2Spec ¶ added in v1.5.0
func (*FlatNestedMockConfig) HCL2Spec() map[string]hcldec.Spec
HCL2Spec returns the hcl spec of a NestedMockConfig. This spec is used by HCL to read the fields of NestedMockConfig. The decoded values from this spec will then be applied to a FlatNestedMockConfig.
type HCL2Ref ¶
type HCL2Ref struct {
// reference to the source definition in configuration text file
DeclRange hcl.Range
// remainder of unparsed body
Remain hcl.Body
}
reference to the source definition in configuration text file
type MockBuilder ¶ added in v1.5.0
type MockBuilder struct {
Config MockConfig
}
func (*MockBuilder) ConfigSpec ¶ added in v1.5.0
func (b *MockBuilder) ConfigSpec() hcldec.ObjectSpec
type MockCommunicator ¶ added in v1.5.0
type MockCommunicator struct {
Config MockConfig
packer.Communicator
}
func (*MockCommunicator) ConfigSpec ¶ added in v1.5.0
func (b *MockCommunicator) ConfigSpec() hcldec.ObjectSpec
func (*MockCommunicator) Configure ¶ added in v1.5.0
func (b *MockCommunicator) Configure(raws ...interface{}) ([]string, error)
type MockConfig ¶ added in v1.5.0
type MockConfig struct {
NestedMockConfig `mapstructure:",squash"`
Nested NestedMockConfig `mapstructure:"nested"`
NestedSlice []NestedMockConfig `mapstructure:"nested_slice"`
}
func (*MockConfig) FlatMapstructure ¶ added in v1.5.0
func (*MockConfig) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }
FlatMapstructure returns a new FlatMockConfig. FlatMockConfig is an auto-generated flat version of MockConfig. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
type MockPostProcessor ¶ added in v1.5.0
type MockPostProcessor struct {
Config MockConfig
}
func (*MockPostProcessor) ConfigSpec ¶ added in v1.5.0
func (b *MockPostProcessor) ConfigSpec() hcldec.ObjectSpec
func (*MockPostProcessor) Configure ¶ added in v1.5.0
func (b *MockPostProcessor) Configure(raws ...interface{}) error
type MockProvisioner ¶ added in v1.5.0
type MockProvisioner struct {
Config MockConfig
}
func (*MockProvisioner) ConfigSpec ¶ added in v1.5.0
func (b *MockProvisioner) ConfigSpec() hcldec.ObjectSpec
func (*MockProvisioner) Prepare ¶ added in v1.5.0
func (b *MockProvisioner) Prepare(raws ...interface{}) error
type NestedMockConfig ¶ added in v1.5.0
type NestedMockConfig struct {
String string `mapstructure:"string"`
Int int `mapstructure:"int"`
Int64 int64 `mapstructure:"int64"`
Bool bool `mapstructure:"bool"`
Trilean config.Trilean `mapstructure:"trilean"`
Duration time.Duration `mapstructure:"duration"`
MapStringString map[string]string `mapstructure:"map_string_string"`
SliceString []string `mapstructure:"slice_string"`
}
func (*NestedMockConfig) FlatMapstructure ¶ added in v1.5.0
func (*NestedMockConfig) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }
FlatMapstructure returns a new FlatNestedMockConfig. FlatNestedMockConfig is an auto-generated flat version of NestedMockConfig. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
type PackerConfig ¶
type PackerConfig struct {
Sources map[SourceRef]*Source
Variables PackerV1Variables
Builds Builds
}
PackerConfig represents a loaded packer config
type PackerV1Variables ¶
type Parser ¶
type Parser struct {
*hclparse.Parser
BuilderSchemas packer.BuilderStore
ProvisionersSchemas packer.ProvisionerStore
PostProcessorsSchemas packer.PostProcessorStore
}
func (*Parser) CoreBuildPostProcessors ¶ added in v1.5.0
func (p *Parser) CoreBuildPostProcessors(blocks []*PostProcessorBlock) ([]packer.CoreBuildPostProcessor, hcl.Diagnostics)
func (*Parser) CoreBuildProvisioners ¶ added in v1.5.0
func (p *Parser) CoreBuildProvisioners(blocks []*ProvisionerBlock, generatedVars []string) ([]packer.CoreBuildProvisioner, hcl.Diagnostics)
func (*Parser) StartBuilder ¶ added in v1.5.0
func (*Parser) StartPostProcessor ¶ added in v1.5.0
func (p *Parser) StartPostProcessor(pp *PostProcessorBlock) (packer.PostProcessor, hcl.Diagnostics)
func (*Parser) StartProvisioner ¶ added in v1.5.0
func (p *Parser) StartProvisioner(pb *ProvisionerBlock, generatedVars []string) (packer.Provisioner, hcl.Diagnostics)
type PostProcessorBlock ¶ added in v1.5.0
type PostProcessorBlock struct {
PType string
// contains filtered or unexported fields
}
PostProcessorBlock represents a parsed PostProcessorBlock
type ProvisionerBlock ¶ added in v1.5.0
type ProvisionerBlock struct {
PType string
// contains filtered or unexported fields
}
ProvisionerBlock represents a parsed provisioner