Documentation

Index

Constants

View Source
const (
	UiColorRed     UiColor = 31
	UiColorGreen           = 32
	UiColorYellow          = 33
	UiColorBlue            = 34
	UiColorMagenta         = 35
	UiColorCyan            = 36
)
View Source
const PACKERSPACE = "-PACKERSPACE-"

    PACKERSPACE is used to represent the spaces that separate args for a command without being confused with spaces in the path to the command itself.

    View Source
    const TelemetryPanicVersion string = "beta/packer_panic/4"
    View Source
    const TelemetryVersion string = "beta/packer/5"

    Variables

    View Source
    var BuilderDataCommonKeys = []string{
    	"ID",
    
    	"Host",
    	"Port",
    	"User",
    	"Password",
    	"ConnType",
    	"PackerRunUUID",
    	"PackerHTTPPort",
    	"PackerHTTPIP",
    	"PackerHTTPAddr",
    	"SSHPublicKey",
    	"SSHPrivateKey",
    	"WinRMPassword",
    }

      BuilderDataCommonKeys is the list of common keys that all builder will return

      View Source
      var ConsoleHelp = strings.TrimSpace(`
      Packer console JSON Mode.
      The Packer console allows you to experiment with Packer interpolations.
      You may access variables in the Packer config you called the console with.
      
      Type in the interpolation to test and hit <enter> to see the result.
      
      "variables" will dump all available variables and their values.
      
      "{{timestamp}}" will output the timestamp, for example "1559855090".
      
      To exit the console, type "exit" and hit <enter>, or use Control-C.
      
      /!\ If you would like to start console in hcl2 mode without a config you can
      use the --config-type=hcl2 option.
      `)
      View Source
      var ErrInterrupted = errors.New("interrupted")
      View Source
      var Killed = false

        If this is true, then the "unexpected EOF" panic will not be raised throughout the clients.

        Functions

        func BasicPlaceholderData

        func BasicPlaceholderData() map[string]string

          Provisioners interpolate most of their fields in the prepare stage; this placeholder map helps keep fields that are only generated at build time from accidentally being interpolated into empty strings at prepare time. This helper function generates the most basic placeholder data which should be accessible to the provisioners. It is used to initialize provisioners, to force validation using the `generated` template function. In the future, custom generated data could be passed into provisioners from builders to enable specialized builder-specific (but still validated!!) access to builder data.

          func CastDataToMap

          func CastDataToMap(data interface{}) map[string]interface{}

          func CleanupClients

          func CleanupClients()

            This makes sure all the managed subprocesses are killed and properly logged. This should be called before the parent process running the plugins exits.

            This must only be called _once_.

            func PluginFolders

            func PluginFolders(dirs ...string) []string

              PluginFolders returns the list of known plugin folders based on system.

              func ProgressBarConfig

              func ProgressBarConfig(bar *pb.ProgressBar, prefix string)

              func TestBuilder

              func TestBuilder(t *testing.T, c *CoreConfig, n string) *packersdk.MockBuilder

                TestBuilder sets the builder with the name n to the component finder and returns the mock.

                func TestProvisioner

                func TestProvisioner(t *testing.T, c *CoreConfig, n string) *packersdk.MockProvisioner

                  TestProvisioner sets the prov. with the name n to the component finder and returns the mock.

                  func TestUi

                  func TestUi(t *testing.T) packersdk.Ui

                  Types

                  type BasicStore

                  type BasicStore interface {
                  	Has(name string) bool
                  	List() (names []string)
                  }

                  type BuildGetter

                  type BuildGetter interface {
                  	// GetBuilds return all possible builds for a config. It also starts all
                  	// builders.
                  	// TODO(azr): rename to builder starter ?
                  	GetBuilds(GetBuildsOptions) ([]packersdk.Build, hcl.Diagnostics)
                  }

                  type BuilderFunc

                  type BuilderFunc func(name string) (packersdk.Builder, error)

                    The function type used to lookup Builder implementations.

                    type BuilderSet

                    type BuilderSet interface {
                    	BuilderStore
                    	Set(name string, starter func() (packersdk.Builder, error))
                    }

                    type BuilderStore

                    type BuilderStore interface {
                    	BasicStore
                    	Start(name string) (packersdk.Builder, error)
                    }

                    type CheckpointTelemetry

                    type CheckpointTelemetry struct {
                    	// contains filtered or unexported fields
                    }
                    var CheckpointReporter *CheckpointTelemetry

                    func NewCheckpointReporter

                    func NewCheckpointReporter(disableSignature bool) *CheckpointTelemetry

                    func (*CheckpointTelemetry) AddSpan

                    func (c *CheckpointTelemetry) AddSpan(name, pluginType string, options interface{}) *TelemetrySpan

                    func (*CheckpointTelemetry) Finalize

                    func (c *CheckpointTelemetry) Finalize(command string, errCode int, err error) error

                    func (*CheckpointTelemetry) ReportPanic

                    func (c *CheckpointTelemetry) ReportPanic(m string) error

                    type ColoredUi

                    type ColoredUi struct {
                    	Color      UiColor
                    	ErrorColor UiColor
                    	Ui         packersdk.Ui
                    	PB         getter.ProgressTracker
                    }

                      ColoredUi is a UI that is colored using terminal colors.

                      func (*ColoredUi) Ask

                      func (u *ColoredUi) Ask(query string) (string, error)

                      func (*ColoredUi) Error

                      func (u *ColoredUi) Error(message string)

                      func (*ColoredUi) Machine

                      func (u *ColoredUi) Machine(t string, args ...string)

                      func (*ColoredUi) Message

                      func (u *ColoredUi) Message(message string)

                      func (*ColoredUi) Say

                      func (u *ColoredUi) Say(message string)

                      func (*ColoredUi) TrackProgress

                      func (u *ColoredUi) TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) io.ReadCloser

                      type ComponentFinder

                      type ComponentFinder struct {
                      	Hook         HookFunc
                      	PluginConfig *PluginConfig
                      }

                        ComponentFinder is a struct that contains the various function pointers necessary to look up components of Packer such as builders, commands, etc.

                        type ConfigFixer

                        type ConfigFixer interface {
                        	// FixConfig will output the config in a fixed manner.
                        	FixConfig(FixConfigOptions) hcl.Diagnostics
                        }

                        type ConfigInspector

                        type ConfigInspector interface {
                        	// Inspect will output self inspection for a configuration
                        	InspectConfig(InspectConfigOptions) (ret int)
                        }

                        type Core

                        type Core struct {
                        	Template *template.Template
                        	// contains filtered or unexported fields
                        }

                          Core is the main executor of Packer. If Packer is being used as a library, this is the struct you'll want to instantiate to get anything done.

                          func NewCore

                          func NewCore(c *CoreConfig) *Core

                            NewCore creates a new Core.

                            func TestCore

                            func TestCore(t *testing.T, c *CoreConfig) *Core

                            func (*Core) Build

                            func (c *Core) Build(n string) (packersdk.Build, error)

                              Build returns the Build object for the given name.

                              func (*Core) BuildNames

                              func (c *Core) BuildNames(only, except []string) []string

                                BuildNames returns the builds that are available in this configured core.

                                func (*Core) Context

                                func (c *Core) Context() *interpolate.Context

                                  Context returns an interpolation context.

                                  func (*Core) EvaluateExpression

                                  func (c *Core) EvaluateExpression(line string) (string, bool, hcl.Diagnostics)

                                  func (*Core) FixConfig

                                  func (c *Core) FixConfig(opts FixConfigOptions) hcl.Diagnostics

                                  func (*Core) GetBuilds

                                  func (c *Core) GetBuilds(opts GetBuildsOptions) ([]packersdk.Build, hcl.Diagnostics)

                                    This is used for json templates to launch the build plugins. They will be prepared via b.Prepare() later.

                                    func (*Core) Initialize

                                    func (core *Core) Initialize() error

                                    func (*Core) InspectConfig

                                    func (c *Core) InspectConfig(opts InspectConfigOptions) int

                                    type CoreBuild

                                    type CoreBuild struct {
                                    	BuildName     string
                                    	Type          string
                                    	Builder       packersdk.Builder
                                    	BuilderConfig interface{}
                                    	BuilderType   string
                                    
                                    	Provisioners       []CoreBuildProvisioner
                                    	PostProcessors     [][]CoreBuildPostProcessor
                                    	CleanupProvisioner CoreBuildProvisioner
                                    	TemplatePath       string
                                    	Variables          map[string]string
                                    
                                    	// Indicates whether the build is already initialized before calling Prepare(..)
                                    	Prepared bool
                                    	// contains filtered or unexported fields
                                    }

                                      A CoreBuild struct represents a single build job, the result of which should be a single machine image artifact. This artifact may be comprised of multiple files, of course, but it should be for only a single provider (such as VirtualBox, EC2, etc.).

                                      func (*CoreBuild) Name

                                      func (b *CoreBuild) Name() string

                                        Returns the name of the build.

                                        func (*CoreBuild) Prepare

                                        func (b *CoreBuild) Prepare() (warn []string, err error)

                                          Prepare prepares the build by doing some initialization for the builder and any hooks. This _must_ be called prior to Run. The parameter is the overrides for the variables within the template (if any).

                                          func (*CoreBuild) Run

                                          func (b *CoreBuild) Run(ctx context.Context, originalUi packersdk.Ui) ([]packersdk.Artifact, error)

                                            Runs the actual build. Prepare must be called prior to running this.

                                            func (*CoreBuild) SetDebug

                                            func (b *CoreBuild) SetDebug(val bool)

                                            func (*CoreBuild) SetForce

                                            func (b *CoreBuild) SetForce(val bool)

                                            func (*CoreBuild) SetOnError

                                            func (b *CoreBuild) SetOnError(val string)

                                            type CoreBuildPostProcessor

                                            type CoreBuildPostProcessor struct {
                                            	PostProcessor packersdk.PostProcessor
                                            	PType         string
                                            	PName         string
                                            
                                            	KeepInputArtifact *bool
                                            	// contains filtered or unexported fields
                                            }

                                              CoreBuildPostProcessor Keeps track of the post-processor and the configuration of the post-processor used within a build.

                                              type CoreBuildProvisioner

                                              type CoreBuildProvisioner struct {
                                              	PType       string
                                              	PName       string
                                              	Provisioner packersdk.Provisioner
                                              	// contains filtered or unexported fields
                                              }

                                                CoreBuildProvisioner keeps track of the provisioner and the configuration of the provisioner within the build.

                                                type CoreConfig

                                                type CoreConfig struct {
                                                	Components         ComponentFinder
                                                	Template           *template.Template
                                                	Variables          map[string]string
                                                	SensitiveVariables []string
                                                	Version            string
                                                
                                                	// These are set by command-line flags
                                                	Except []string
                                                	Only   []string
                                                }

                                                  CoreConfig is the structure for initializing a new Core. Once a CoreConfig is used to initialize a Core, it shouldn't be re-used or modified again.

                                                  func TestCoreConfig

                                                  func TestCoreConfig(t *testing.T) *CoreConfig

                                                  type DatasourceSet

                                                  type DatasourceSet interface {
                                                  	DatasourceStore
                                                  	Set(name string, starter func() (packersdk.Datasource, error))
                                                  }

                                                  type DatasourceStore

                                                  type DatasourceStore interface {
                                                  	BasicStore
                                                  	Start(name string) (packersdk.Datasource, error)
                                                  }

                                                  type DebuggedProvisioner

                                                  type DebuggedProvisioner struct {
                                                  	Provisioner packersdk.Provisioner
                                                  	// contains filtered or unexported fields
                                                  }

                                                    DebuggedProvisioner is a Provisioner implementation that waits until a key press before the provisioner is actually run.

                                                    func (*DebuggedProvisioner) ConfigSpec

                                                    func (p *DebuggedProvisioner) ConfigSpec() hcldec.ObjectSpec

                                                    func (*DebuggedProvisioner) FlatConfig

                                                    func (p *DebuggedProvisioner) FlatConfig() interface{}

                                                    func (*DebuggedProvisioner) Prepare

                                                    func (p *DebuggedProvisioner) Prepare(raws ...interface{}) error

                                                    func (*DebuggedProvisioner) Provision

                                                    func (p *DebuggedProvisioner) Provision(ctx context.Context, ui packersdk.Ui, comm packersdk.Communicator, generatedData map[string]interface{}) error

                                                    type Evaluator

                                                    type Evaluator interface {
                                                    	// EvaluateExpression is meant to be used in the `packer console` command.
                                                    	// It parses the input string and returns what needs to be displayed. In
                                                    	// case of an error the error should be displayed.
                                                    	EvaluateExpression(expr string) (output string, exit bool, diags hcl.Diagnostics)
                                                    }

                                                    type FixConfigMode

                                                    type FixConfigMode int
                                                    const (
                                                    	// Stdout will make FixConfig simply print what the config should be; it
                                                    	// will only work when a single file is passed.
                                                    	Stdout FixConfigMode = iota
                                                    	// Inplace fixes your files on the spot.
                                                    	Inplace
                                                    	// Diff shows a full diff.
                                                    	Diff
                                                    )

                                                    func FixConfigModeString

                                                    func FixConfigModeString(s string) (FixConfigMode, error)

                                                      FixConfigModeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

                                                      func FixConfigModeValues

                                                      func FixConfigModeValues() []FixConfigMode

                                                        FixConfigModeValues returns all values of the enum

                                                        func (FixConfigMode) IsAFixConfigMode

                                                        func (i FixConfigMode) IsAFixConfigMode() bool

                                                          IsAFixConfigMode returns "true" if the value is listed in the enum definition. "false" otherwise

                                                          func (FixConfigMode) String

                                                          func (i FixConfigMode) String() string

                                                          type FixConfigOptions

                                                          type FixConfigOptions struct {
                                                          	Mode FixConfigMode
                                                          }

                                                          type FlatMockPostProcessor

                                                          type FlatMockPostProcessor struct {
                                                          	ArtifactId          *string         `cty:"artifact_id" hcl:"artifact_id"`
                                                          	Keep                *bool           `cty:"keep" hcl:"keep"`
                                                          	ForceOverride       *bool           `cty:"force_override" hcl:"force_override"`
                                                          	Error               error           `cty:"error" hcl:"error"`
                                                          	ConfigureCalled     *bool           `cty:"configure_called" hcl:"configure_called"`
                                                          	ConfigureConfigs    []interface{}   `cty:"configure_configs" hcl:"configure_configs"`
                                                          	ConfigureError      error           `cty:"configure_error" hcl:"configure_error"`
                                                          	PostProcessCalled   *bool           `cty:"post_process_called" hcl:"post_process_called"`
                                                          	PostProcessArtifact packer.Artifact `cty:"post_process_artifact" hcl:"post_process_artifact"`
                                                          	PostProcessUi       packer.Ui       `cty:"post_process_ui" hcl:"post_process_ui"`
                                                          }

                                                            FlatMockPostProcessor is an auto-generated flat version of MockPostProcessor. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.

                                                            func (*FlatMockPostProcessor) HCL2Spec

                                                            func (*FlatMockPostProcessor) HCL2Spec() map[string]hcldec.Spec

                                                              HCL2Spec returns the hcl spec of a MockPostProcessor. This spec is used by HCL to read the fields of MockPostProcessor. The decoded values from this spec will then be applied to a FlatMockPostProcessor.

                                                              type GetBuildsOptions

                                                              type GetBuildsOptions struct {
                                                              	// Get builds except the ones that match with except and with only the ones
                                                              	// that match with Only. When those are empty everything matches.
                                                              	Except, Only []string
                                                              	Debug, Force bool
                                                              	OnError      string
                                                              }

                                                              type Handler

                                                              type Handler interface {
                                                              	Initialize(InitializeOptions) hcl.Diagnostics
                                                              	// PluginRequirements returns the list of plugin Requirements from the
                                                              	// config file.
                                                              	PluginRequirements() (plugingetter.Requirements, hcl.Diagnostics)
                                                              	Evaluator
                                                              	BuildGetter
                                                              	ConfigFixer
                                                              	ConfigInspector
                                                              }

                                                                The Handler handles all Packer things. This interface reflects the Packer commands, ex: init, console ( evaluate ), fix config, inspect config, etc. To run a build we will start the builds and then the core of Packer handles execution.

                                                                type HookFunc

                                                                type HookFunc func(name string) (packersdk.Hook, error)

                                                                  The function type used to lookup Hook implementations.

                                                                  type HookedProvisioner

                                                                  type HookedProvisioner struct {
                                                                  	Provisioner packersdk.Provisioner
                                                                  	Config      interface{}
                                                                  	TypeName    string
                                                                  }

                                                                    A HookedProvisioner represents a provisioner and information describing it

                                                                    type InitializeOptions

                                                                    type InitializeOptions struct {
                                                                    	// When set, the execution of datasources will be skipped and the datasource will provide
                                                                    	// a output spec that will be used for validation only.
                                                                    	SkipDatasourcesExecution bool
                                                                    }

                                                                    type InspectConfigOptions

                                                                    type InspectConfigOptions struct {
                                                                    	packersdk.Ui
                                                                    }

                                                                    type MachineReadableUi

                                                                    type MachineReadableUi struct {
                                                                    	Writer io.Writer
                                                                    	PB     packersdk.NoopProgressTracker
                                                                    }

                                                                      MachineReadableUi is a UI that only outputs machine-readable output to the given Writer.

                                                                      func (*MachineReadableUi) Ask

                                                                      func (u *MachineReadableUi) Ask(query string) (string, error)

                                                                      func (*MachineReadableUi) Error

                                                                      func (u *MachineReadableUi) Error(message string)

                                                                      func (*MachineReadableUi) Machine

                                                                      func (u *MachineReadableUi) Machine(category string, args ...string)

                                                                      func (*MachineReadableUi) Message

                                                                      func (u *MachineReadableUi) Message(message string)

                                                                      func (*MachineReadableUi) Say

                                                                      func (u *MachineReadableUi) Say(message string)

                                                                      func (*MachineReadableUi) TrackProgress

                                                                      func (u *MachineReadableUi) TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) (body io.ReadCloser)

                                                                      type MapOfBuilder

                                                                      type MapOfBuilder map[string]func() (packersdk.Builder, error)

                                                                      func (MapOfBuilder) Has

                                                                      func (mob MapOfBuilder) Has(builder string) bool

                                                                      func (MapOfBuilder) List

                                                                      func (mob MapOfBuilder) List() []string

                                                                      func (MapOfBuilder) Set

                                                                      func (mob MapOfBuilder) Set(builder string, starter func() (packersdk.Builder, error))

                                                                      func (MapOfBuilder) Start

                                                                      func (mob MapOfBuilder) Start(builder string) (packersdk.Builder, error)

                                                                      type MapOfDatasource

                                                                      type MapOfDatasource map[string]func() (packersdk.Datasource, error)

                                                                      func (MapOfDatasource) Has

                                                                      func (mod MapOfDatasource) Has(dataSource string) bool

                                                                      func (MapOfDatasource) List

                                                                      func (mod MapOfDatasource) List() []string

                                                                      func (MapOfDatasource) Set

                                                                      func (mod MapOfDatasource) Set(dataSource string, starter func() (packersdk.Datasource, error))

                                                                      func (MapOfDatasource) Start

                                                                      func (mod MapOfDatasource) Start(dataSource string) (packersdk.Datasource, error)

                                                                      type MapOfPostProcessor

                                                                      type MapOfPostProcessor map[string]func() (packersdk.PostProcessor, error)

                                                                      func (MapOfPostProcessor) Has

                                                                      func (mopp MapOfPostProcessor) Has(postProcessor string) bool

                                                                      func (MapOfPostProcessor) List

                                                                      func (mopp MapOfPostProcessor) List() []string

                                                                      func (MapOfPostProcessor) Set

                                                                      func (mopp MapOfPostProcessor) Set(postProcessor string, starter func() (packersdk.PostProcessor, error))

                                                                      func (MapOfPostProcessor) Start

                                                                      func (mopp MapOfPostProcessor) Start(postProcessor string) (packersdk.PostProcessor, error)

                                                                      type MapOfProvisioner

                                                                      type MapOfProvisioner map[string]func() (packersdk.Provisioner, error)

                                                                      func (MapOfProvisioner) Has

                                                                      func (mop MapOfProvisioner) Has(provisioner string) bool

                                                                      func (MapOfProvisioner) List

                                                                      func (mop MapOfProvisioner) List() []string

                                                                      func (MapOfProvisioner) Set

                                                                      func (mop MapOfProvisioner) Set(provisioner string, starter func() (packersdk.Provisioner, error))

                                                                      func (MapOfProvisioner) Start

                                                                      func (mop MapOfProvisioner) Start(provisioner string) (packersdk.Provisioner, error)

                                                                      type MockPostProcessor

                                                                      type MockPostProcessor struct {
                                                                      	ArtifactId    string
                                                                      	Keep          bool
                                                                      	ForceOverride bool
                                                                      	Error         error
                                                                      
                                                                      	ConfigureCalled  bool
                                                                      	ConfigureConfigs []interface{}
                                                                      	ConfigureError   error
                                                                      
                                                                      	PostProcessCalled   bool
                                                                      	PostProcessArtifact packersdk.Artifact
                                                                      	PostProcessUi       packersdk.Ui
                                                                      }

                                                                        MockPostProcessor is an implementation of PostProcessor that can be used for tests.

                                                                        func TestPostProcessor

                                                                        func TestPostProcessor(t *testing.T, c *CoreConfig, n string) *MockPostProcessor

                                                                          TestPostProcessor sets the prov. with the name n to the component finder and returns the mock.

                                                                          func (*MockPostProcessor) ConfigSpec

                                                                          func (t *MockPostProcessor) ConfigSpec() hcldec.ObjectSpec

                                                                          func (*MockPostProcessor) Configure

                                                                          func (t *MockPostProcessor) Configure(configs ...interface{}) error

                                                                          func (*MockPostProcessor) FlatMapstructure

                                                                          func (*MockPostProcessor) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }

                                                                            FlatMapstructure returns a new FlatMockPostProcessor. FlatMockPostProcessor is an auto-generated flat version of MockPostProcessor. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.

                                                                            func (*MockPostProcessor) PostProcess

                                                                            type PackerReport

                                                                            type PackerReport struct {
                                                                            	Spans    []*TelemetrySpan `json:"spans"`
                                                                            	ExitCode int              `json:"exit_code"`
                                                                            	Error    string           `json:"error"`
                                                                            	Command  string           `json:"command"`
                                                                            }

                                                                            type PausedProvisioner

                                                                            type PausedProvisioner struct {
                                                                            	PauseBefore time.Duration
                                                                            	Provisioner packersdk.Provisioner
                                                                            }

                                                                              PausedProvisioner is a Provisioner implementation that pauses before the provisioner is actually run.

                                                                              func (*PausedProvisioner) ConfigSpec

                                                                              func (p *PausedProvisioner) ConfigSpec() hcldec.ObjectSpec

                                                                              func (*PausedProvisioner) FlatConfig

                                                                              func (p *PausedProvisioner) FlatConfig() interface{}

                                                                              func (*PausedProvisioner) Prepare

                                                                              func (p *PausedProvisioner) Prepare(raws ...interface{}) error

                                                                              func (*PausedProvisioner) Provision

                                                                              func (p *PausedProvisioner) Provision(ctx context.Context, ui packersdk.Ui, comm packersdk.Communicator, generatedData map[string]interface{}) error

                                                                              type PluginClient

                                                                              type PluginClient struct {
                                                                              	// contains filtered or unexported fields
                                                                              }

                                                                                Client handles the lifecycle of a plugin application, determining its RPC address, and returning various types of packer interface implementations across the multi-process communication layer.

                                                                                func NewClient

                                                                                func NewClient(config *PluginClientConfig) (c *PluginClient)

                                                                                  Creates a new plugin client which manages the lifecycle of an external plugin and gets the address for the RPC connection.

                                                                                  The client must be cleaned up at some point by calling Kill(). If the client is a managed client (created with NewManagedClient) you can just call CleanupClients at the end of your program and they will be properly cleaned.

                                                                                  func (*PluginClient) Builder

                                                                                  func (c *PluginClient) Builder() (packersdk.Builder, error)

                                                                                    Returns a builder implementation that is communicating over this client. If the client hasn't been started, this will start it.

                                                                                    func (*PluginClient) Client

                                                                                    func (c *PluginClient) Client() (*packerrpc.Client, error)

                                                                                    func (*PluginClient) Datasource

                                                                                    func (c *PluginClient) Datasource() (packersdk.Datasource, error)

                                                                                      Returns a data source implementation that is communicating over this client. If the client hasn't been started, this will start it.

                                                                                      func (*PluginClient) Exited

                                                                                      func (c *PluginClient) Exited() bool

                                                                                        Tells whether or not the underlying process has exited.

                                                                                        func (*PluginClient) Hook

                                                                                        func (c *PluginClient) Hook() (packersdk.Hook, error)

                                                                                          Returns a hook implementation that is communicating over this client. If the client hasn't been started, this will start it.

                                                                                          func (*PluginClient) Kill

                                                                                          func (c *PluginClient) Kill()

                                                                                            End the executing subprocess (if it is running) and perform any cleanup tasks necessary such as capturing any remaining logs and so on.

                                                                                            This method blocks until the process successfully exits.

                                                                                            This method can safely be called multiple times.

                                                                                            func (*PluginClient) PostProcessor

                                                                                            func (c *PluginClient) PostProcessor() (packersdk.PostProcessor, error)

                                                                                              Returns a post-processor implementation that is communicating over this client. If the client hasn't been started, this will start it.

                                                                                              func (*PluginClient) Provisioner

                                                                                              func (c *PluginClient) Provisioner() (packersdk.Provisioner, error)

                                                                                                Returns a provisioner implementation that is communicating over this client. If the client hasn't been started, this will start it.

                                                                                                func (*PluginClient) Start

                                                                                                func (c *PluginClient) Start() (net.Addr, error)

                                                                                                  Starts the underlying subprocess, communicating with it to negotiate a port for RPC connections, and returning the address to connect via RPC.

                                                                                                  This method is safe to call multiple times. Subsequent calls have no effect. Once a client has been started once, it cannot be started again, even if it was killed.

                                                                                                  type PluginClientConfig

                                                                                                  type PluginClientConfig struct {
                                                                                                  	// The unstarted subprocess for starting the plugin.
                                                                                                  	Cmd *exec.Cmd
                                                                                                  
                                                                                                  	// Managed represents if the client should be managed by the
                                                                                                  	// plugin package or not. If true, then by calling CleanupClients,
                                                                                                  	// it will automatically be cleaned up. Otherwise, the client
                                                                                                  	// user is fully responsible for making sure to Kill all plugin
                                                                                                  	// clients. By default the client is _not_ managed.
                                                                                                  	Managed bool
                                                                                                  
                                                                                                  	// The minimum and maximum port to use for communicating with
                                                                                                  	// the subprocess. If not set, this defaults to 10,000 and 25,000
                                                                                                  	// respectively.
                                                                                                  	MinPort, MaxPort int
                                                                                                  
                                                                                                  	// StartTimeout is the timeout to wait for the plugin to say it
                                                                                                  	// has started successfully.
                                                                                                  	StartTimeout time.Duration
                                                                                                  
                                                                                                  	// If non-nil, then the stderr of the client will be written to here
                                                                                                  	// (as well as the log).
                                                                                                  	Stderr io.Writer
                                                                                                  }

                                                                                                    PluginClientConfig is the configuration used to initialize a new plugin client. After being used to initialize a plugin client, that configuration must not be modified again.

                                                                                                    type PluginConfig

                                                                                                    type PluginConfig struct {
                                                                                                    	KnownPluginFolders []string
                                                                                                    	PluginMinPort      int
                                                                                                    	PluginMaxPort      int
                                                                                                    	Builders           BuilderSet
                                                                                                    	Provisioners       ProvisionerSet
                                                                                                    	PostProcessors     PostProcessorSet
                                                                                                    	DataSources        DatasourceSet
                                                                                                    
                                                                                                    	// Redirects are only set when a plugin was completely moved out; they allow
                                                                                                    	// telling where a plugin has moved by checking if a known component of this
                                                                                                    	// plugin is used. For example implicitly require the
                                                                                                    	// github.com/hashicorp/amazon plugin if it was moved out and the
                                                                                                    	// "amazon-ebs" plugin is used, but not found.
                                                                                                    	//
                                                                                                    	// Redirects will be bypassed if the redirected components are already found
                                                                                                    	// in their corresponding sets (Builders, Provisioners, PostProcessors,
                                                                                                    	// DataSources). That is, for example, if you manually put a single
                                                                                                    	// component plugin in the plugins folder.
                                                                                                    	//
                                                                                                    	// Example BuilderRedirects: "amazon-ebs" => "github.com/hashicorp/amazon"
                                                                                                    	BuilderRedirects       map[string]string
                                                                                                    	DatasourceRedirects    map[string]string
                                                                                                    	ProvisionerRedirects   map[string]string
                                                                                                    	PostProcessorRedirects map[string]string
                                                                                                    }

                                                                                                      PluginConfig helps load and use packer plugins

                                                                                                      func (*PluginConfig) Client

                                                                                                      func (c *PluginConfig) Client(path string, args ...string) *PluginClient

                                                                                                      func (*PluginConfig) Discover

                                                                                                      func (c *PluginConfig) Discover() error

                                                                                                        Discover discovers plugins.

                                                                                                        Search the directory of the executable, then the plugins directory, and finally the CWD, in that order. Any conflicts will overwrite previously found plugins, in that order. Hence, the priority order is the reverse of the search order - i.e., the CWD has the highest priority.

                                                                                                        func (*PluginConfig) DiscoverMultiPlugin

                                                                                                        func (c *PluginConfig) DiscoverMultiPlugin(pluginName, pluginPath string) error

                                                                                                          DiscoverMultiPlugin takes the description from a multi-component plugin binary and makes the plugins available to use in Packer. Each plugin found in the binary will be addressable using `${pluginName}-${builderName}` for example. pluginName could be manually set. It usually is a cloud name like amazon. pluginName can be extrapolated from the filename of the binary; so if the "packer-plugin-amazon" binary had an "ebs" builder one could use the "amazon-ebs" builder.

                                                                                                          type PostProcessorFunc

                                                                                                          type PostProcessorFunc func(name string) (packersdk.PostProcessor, error)

                                                                                                            The function type used to lookup PostProcessor implementations.

                                                                                                            type PostProcessorSet

                                                                                                            type PostProcessorSet interface {
                                                                                                            	PostProcessorStore
                                                                                                            	Set(name string, starter func() (packersdk.PostProcessor, error))
                                                                                                            }

                                                                                                            type PostProcessorStore

                                                                                                            type PostProcessorStore interface {
                                                                                                            	BasicStore
                                                                                                            	Start(name string) (packersdk.PostProcessor, error)
                                                                                                            }

                                                                                                            type ProvisionHook

                                                                                                            type ProvisionHook struct {
                                                                                                            	// The provisioners to run as part of the hook. These should already
                                                                                                            	// be prepared (by calling Prepare) at some earlier stage.
                                                                                                            	Provisioners []*HookedProvisioner
                                                                                                            }

                                                                                                              A Hook implementation that runs the given provisioners.

                                                                                                              func (*ProvisionHook) Run

                                                                                                              func (h *ProvisionHook) Run(ctx context.Context, name string, ui packersdk.Ui, comm packersdk.Communicator, data interface{}) error

                                                                                                                Runs the provisioners in order.

                                                                                                                type ProvisionerFunc

                                                                                                                type ProvisionerFunc func(name string) (packersdk.Provisioner, error)

                                                                                                                  The function type used to lookup Provisioner implementations.

                                                                                                                  type ProvisionerSet

                                                                                                                  type ProvisionerSet interface {
                                                                                                                  	ProvisionerStore
                                                                                                                  	Set(name string, starter func() (packersdk.Provisioner, error))
                                                                                                                  }

                                                                                                                  type ProvisionerStore

                                                                                                                  type ProvisionerStore interface {
                                                                                                                  	BasicStore
                                                                                                                  	Start(name string) (packersdk.Provisioner, error)
                                                                                                                  }

                                                                                                                  type RetriedProvisioner

                                                                                                                  type RetriedProvisioner struct {
                                                                                                                  	MaxRetries  int
                                                                                                                  	Provisioner packersdk.Provisioner
                                                                                                                  }

                                                                                                                    RetriedProvisioner is a Provisioner implementation that retries the provisioner whenever there's an error.

                                                                                                                    func (*RetriedProvisioner) ConfigSpec

                                                                                                                    func (r *RetriedProvisioner) ConfigSpec() hcldec.ObjectSpec

                                                                                                                    func (*RetriedProvisioner) FlatConfig

                                                                                                                    func (r *RetriedProvisioner) FlatConfig() interface{}

                                                                                                                    func (*RetriedProvisioner) Prepare

                                                                                                                    func (r *RetriedProvisioner) Prepare(raws ...interface{}) error

                                                                                                                    func (*RetriedProvisioner) Provision

                                                                                                                    func (r *RetriedProvisioner) Provision(ctx context.Context, ui packersdk.Ui, comm packersdk.Communicator, generatedData map[string]interface{}) error

                                                                                                                    type TargetedUI

                                                                                                                    type TargetedUI struct {
                                                                                                                    	Target string
                                                                                                                    	Ui     packersdk.Ui
                                                                                                                    }

                                                                                                                      TargetedUI is a UI that wraps another UI implementation and modifies the output to indicate a specific target. Specifically, all Say output is prefixed with the target name. Message output is not prefixed but is offset by the length of the target so that output is lined up properly with Say output. Machine-readable output has the proper target set.

                                                                                                                      func (*TargetedUI) Ask

                                                                                                                      func (u *TargetedUI) Ask(query string) (string, error)

                                                                                                                      func (*TargetedUI) Error

                                                                                                                      func (u *TargetedUI) Error(message string)

                                                                                                                      func (*TargetedUI) Machine

                                                                                                                      func (u *TargetedUI) Machine(t string, args ...string)

                                                                                                                      func (*TargetedUI) Message

                                                                                                                      func (u *TargetedUI) Message(message string)

                                                                                                                      func (*TargetedUI) Say

                                                                                                                      func (u *TargetedUI) Say(message string)

                                                                                                                      func (*TargetedUI) TrackProgress

                                                                                                                      func (u *TargetedUI) TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) io.ReadCloser

                                                                                                                      type TelemetrySpan

                                                                                                                      type TelemetrySpan struct {
                                                                                                                      	EndTime   time.Time `json:"end_time"`
                                                                                                                      	Error     string    `json:"error"`
                                                                                                                      	Name      string    `json:"name"`
                                                                                                                      	Options   []string  `json:"options"`
                                                                                                                      	StartTime time.Time `json:"start_time"`
                                                                                                                      	Type      string    `json:"type"`
                                                                                                                      }

                                                                                                                      func (*TelemetrySpan) End

                                                                                                                      func (s *TelemetrySpan) End(err error)

                                                                                                                      type TimeoutProvisioner

                                                                                                                      type TimeoutProvisioner struct {
                                                                                                                      	packersdk.Provisioner
                                                                                                                      	Timeout time.Duration
                                                                                                                      }

                                                                                                                        TimeoutProvisioner is a Provisioner implementation that can timeout after a duration

                                                                                                                        func (*TimeoutProvisioner) Provision

                                                                                                                        func (p *TimeoutProvisioner) Provision(ctx context.Context, ui packersdk.Ui, comm packersdk.Communicator, generatedData map[string]interface{}) error

                                                                                                                        type TimestampedUi

                                                                                                                        type TimestampedUi struct {
                                                                                                                        	Ui packersdk.Ui
                                                                                                                        	PB getter.ProgressTracker
                                                                                                                        }

                                                                                                                          TimestampedUi is a UI that wraps another UI implementation and prefixes each message with an RFC3339 timestamp

                                                                                                                          func (*TimestampedUi) Ask

                                                                                                                          func (u *TimestampedUi) Ask(query string) (string, error)

                                                                                                                          func (*TimestampedUi) Error

                                                                                                                          func (u *TimestampedUi) Error(message string)

                                                                                                                          func (*TimestampedUi) Machine

                                                                                                                          func (u *TimestampedUi) Machine(message string, args ...string)

                                                                                                                          func (*TimestampedUi) Message

                                                                                                                          func (u *TimestampedUi) Message(message string)

                                                                                                                          func (*TimestampedUi) Say

                                                                                                                          func (u *TimestampedUi) Say(message string)

                                                                                                                          func (*TimestampedUi) TrackProgress

                                                                                                                          func (u *TimestampedUi) TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) (body io.ReadCloser)

                                                                                                                          type UiColor

                                                                                                                          type UiColor uint

                                                                                                                          type UiProgressBar

                                                                                                                          type UiProgressBar struct {
                                                                                                                          	// contains filtered or unexported fields
                                                                                                                          }

                                                                                                                            UiProgressBar is a progress bar compatible with go-getter used in our UI structs.

                                                                                                                            func (*UiProgressBar) TrackProgress

                                                                                                                            func (p *UiProgressBar) TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) io.ReadCloser

                                                                                                                            Directories

                                                                                                                            Path Synopsis
                                                                                                                            Package plugingetter defines means to download and install plugins.
                                                                                                                            Package plugingetter defines means to download and install plugins.