common

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: MPL-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const BuilderId = "jetbrains.vsphere"
View Source
const DefaultHttpBindAddress = "0.0.0.0"

DefaultHttpBindAddress defines the default IP address for the HTTP server.

View Source
const DefaultRemoteCachePath = "packer_cache"
View Source
const OvftoolWindows = "ovftool.exe"

Variables

This section is empty.

Functions

func CleanupVM

func CleanupVM(state multistep.StateBag)

func CommHost

func CommHost(host string) func(multistep.StateBag) (string, error)

func GetRemoteDirectoryAndPath

func GetRemoteDirectoryAndPath(path string, ds driver.Datastore, remoteCachePath string) (string, string, string, string)

func GetVMMetadata added in v1.0.2

func GetVMMetadata(vm *driver.VirtualMachineDriver, state multistep.StateBag) map[string]string

func IsIPInInterfaces added in v1.4.0

func IsIPInInterfaces(ipStr string) bool

IsIPInInterfaces checks if the provided IP address is assigned to any interface in the system.

func ValidateHTTPAddress added in v1.4.0

func ValidateHTTPAddress(httpAddress string) error

ValidateHTTPAddress validates if the provided HTTP address is valid and assigned to an interface.

Types

type Artifact

type Artifact struct {
	Outconfig            *OutputConfig
	Name                 string
	Location             LocationConfig
	Datacenter           *object.Datacenter
	VM                   *driver.VirtualMachineDriver
	ContentLibraryConfig *ContentLibraryDestinationConfig
	// StateData should store data such as GeneratedData
	// to be shared with post-processors
	StateData map[string]interface{}
}

func (*Artifact) BuilderId

func (a *Artifact) BuilderId() string

func (*Artifact) Destroy

func (a *Artifact) Destroy() error

func (*Artifact) Files

func (a *Artifact) Files() []string

func (*Artifact) Id

func (a *Artifact) Id() string

func (*Artifact) State

func (a *Artifact) State(name string) interface{}

func (*Artifact) String

func (a *Artifact) String() string

type BootConfig

type BootConfig struct {
	bootcommand.BootConfig `mapstructure:",squash"`
	// The IP address to use for the HTTP server to serve the `http_directory`.
	HTTPIP string `mapstructure:"http_ip"`
}

func (*BootConfig) Prepare

func (c *BootConfig) Prepare(ctx *interpolate.Context) []error

type CDRomConfig

type CDRomConfig struct {
	// The type of controller to use for the CD-ROM device. Defaults to `ide`.
	//
	// The available options for this setting are: `ide` and `sata`.
	CdromType string `mapstructure:"cdrom_type"`
	// A list of paths to ISO files in either a datastore or a content library
	// that will be attached to the virtual machine.
	//
	// HCL Example:
	//
	// “`hcl
	// iso_paths = [
	//   "[nfs] iso/ubuntu-server-amd64.iso",
	//   "Example Content Library/ubuntu-server-amd64/ubuntu-server-amd64.iso"
	// ]
	// “`
	//
	// JSON Example:
	//
	// “`json
	// "iso_paths": [
	//   "[nfs] iso/ubuntu-server-amd64.iso",
	//   "Example Content Library/ubuntu-server-amd64/ubuntu-server-amd64.iso"
	// ]
	// “`
	//
	// Two ISOs are referenced:
	//
	// 1. An ISO in the "_iso_" folder of the "_nfs_" datastore with the file
	//   name of "_ubuntu-server-amd64.iso_". "_ubuntu-server-amd64.iso_".
	// 2. An ISO in the "_Example Content Library_" content library with the
	//   item name of "_ubuntu-server-amd64_".
	//
	// -> **Note:** All files in a content library have an associated item name.
	// To determine the file name, view the datastore backing the content
	// library or use the `govc` vSphere CLI.
	ISOPaths []string `mapstructure:"iso_paths"`
}

func (*CDRomConfig) FlatMapstructure

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

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

func (*CDRomConfig) Prepare

func (c *CDRomConfig) Prepare(k *ReattachCDRomConfig) []error

type ConfigParamsConfig

type ConfigParamsConfig struct {
	// A map of key-value pairs to sent to the [`extraConfig`](https://dp-downloads.broadcom.com/api-content/apis/API_VWSA_001/8.0U3/html/ReferenceGuides/vim.vm.ConfigSpec.html#extraConfig).
	// in the vSphere API's `VirtualMachineConfigSpec`.
	//
	// HCL Example:
	//
	// “`hcl
	//   configuration_parameters = {
	//     "disk.EnableUUID" = "TRUE"
	//     "svga.autodetect" = "TRUE"
	//     "log.keepOld"     = "15"
	//   }
	// “`
	//
	// JSON Example:
	//
	// “`json
	//   "configuration_parameters": {
	//     "disk.EnableUUID": "TRUE",
	//     "svga.autodetect": "TRUE",
	//     "log.keepOld": "15"
	//   }
	// “`
	//
	// ~> **Note:** Configuration keys that would conflict with parameters that
	// are explicitly configurable through other fields in the `ConfigSpec“ object
	// are silently ignored. Refer to the [`VirtualMachineConfigSpec`](https://dp-downloads.broadcom.com/api-content/apis/API_VWSA_001/8.0U3/html/ReferenceGuides/vim.vm.ConfigSpec.html)
	// in the vSphere API documentation.
	ConfigParams map[string]string `mapstructure:"configuration_parameters"`
	// Enable time synchronization with the ESXi host where the virtual machine
	// is running. Defaults to `false`.
	ToolsSyncTime bool `mapstructure:"tools_sync_time"`
	// Automatically check for and upgrade VMware Tools after a virtual machine
	// power cycle. Defaults to `false`.
	ToolsUpgradePolicy bool `mapstructure:"tools_upgrade_policy"`
}

func (*ConfigParamsConfig) FlatMapstructure

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

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

type ConnectConfig

type ConnectConfig struct {
	// The fully qualified domain name or IP address of the vCenter Server
	// instance.
	VCenterServer string `mapstructure:"vcenter_server"`
	// The username to authenticate with the vCenter Server instance.
	Username string `mapstructure:"username"`
	// The password to authenticate with the vCenter Server instance.
	Password string `mapstructure:"password"`
	// Do not validate the certificate of the vCenter Server instance.
	// Defaults to `false`.
	//
	// -> **Note:** This option is beneficial in scenarios where the certificate
	// is self-signed or does not meet standard validation criteria.
	InsecureConnection bool `mapstructure:"insecure_connection"`
	// The name of the datacenter object in the vSphere inventory.
	//
	// -> **Note:** Required if more than one datacenter object exists in the
	// vSphere inventory.
	Datacenter string `mapstructure:"datacenter"`
}

func (*ConnectConfig) FlatMapstructure

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

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

func (*ConnectConfig) Prepare

func (c *ConnectConfig) Prepare() []error

type ContentLibraryDestinationConfig

type ContentLibraryDestinationConfig struct {
	// The name of the content library in which the new content library item
	// containing the template will be created or updated. The content library
	// must be of type Local to allow deploying virtual machines.
	Library string `mapstructure:"library"`
	// The name of the content library item that will be created or updated.
	// For VM templates, the name of the item should be different from
	// [vm_name](#vm_name) and the default is [vm_name](#vm_name) + timestamp
	// when not set. VM templates will be always imported to a new library item.
	// For OVF templates, the name defaults to [vm_name](#vm_name) when not set,
	// and if an item with the same name already exists it will be then updated
	// with the new OVF template, otherwise a new item will be created.
	//
	// ~> **Note:** It's not possible to update existing content library items
	// with a new VM template. If updating an existing content library item is
	// necessary, use an OVF template instead by setting the [ovf](#ovf) option
	// as `true`.
	Name string `mapstructure:"name"`
	// A description for the content library item that will be created.
	// Defaults to "Packer imported [vm_name](#vm_name) VM template".
	Description string `mapstructure:"description"`
	// The cluster where the VM template will be placed.
	// If `cluster` and `resource_pool` are both specified, `resource_pool` must
	// belong to cluster. If `cluster` and `host` are both specified, the ESXi
	// host must be a member of the cluster. This option is not used when
	// importing OVF templates. Defaults to [`cluster`](#cluster).
	Cluster string `mapstructure:"cluster"`
	// The virtual machine folder where the VM template will be placed.
	// This option is not used when importing OVF templates. Defaults to
	// the same folder as the source virtual machine.
	Folder string `mapstructure:"folder"`
	// The ESXi host where the virtual machine template will be placed.
	// If `host` and `resource_pool` are both specified, `resource_pool` must
	// belong to host. If `host` and `cluster` are both specified, `host` must
	// be a member of the cluster. This option is not used when importing OVF
	// templates. Defaults to [`host`](#host).
	Host string `mapstructure:"host"`
	// The resource pool where the virtual machine template will be placed.
	// Defaults to [`resource_pool`](#resource_pool). If [`resource_pool`](#resource_pool)
	// is unset, the system will attempt to choose a suitable resource pool
	// for the VM template.
	ResourcePool string `mapstructure:"resource_pool"`
	// The datastore for the virtual machine template's configuration and log
	// files. This option is not used when importing OVF templates.
	// Defaults to the storage backing associated with the content library.
	Datastore string `mapstructure:"datastore"`
	// Destroy the virtual machine after the import to the content library.
	// Defaults to `false`.
	Destroy bool `mapstructure:"destroy"`
	// Import an OVF template to the content library item. Defaults to `false`.
	Ovf bool `mapstructure:"ovf"`
	// Skip the import to the content library item. Useful during a build test
	// stage. Defaults to `false`.
	SkipImport bool `mapstructure:"skip_import"`
	// Flags to use for OVF package creation. The supported flags can be
	// obtained using ExportFlag.list. If unset, no flags will be used.
	// Known values: `EXTRA_CONFIG`, `PRESERVE_MAC`.
	OvfFlags []string `mapstructure:"ovf_flags"`
}

Create a content library item in a content library whose content is a VM template or an OVF template created from the virtual machine image after the build is complete.

The template is stored in a existing or newly created library item.

func (*ContentLibraryDestinationConfig) FlatMapstructure

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

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

func (*ContentLibraryDestinationConfig) Prepare

type DiskConfig

type DiskConfig struct {
	// The size of the disk in MiB.
	DiskSize int64 `mapstructure:"disk_size" required:"true"`
	// Enable thin provisioning for the disk.
	// Defaults to `false`.
	DiskThinProvisioned bool `mapstructure:"disk_thin_provisioned"`
	// Enable eager scrubbing for the disk.
	// Defaults to `false`.
	DiskEagerlyScrub bool `mapstructure:"disk_eagerly_scrub"`
	// The assigned disk controller for the disk.
	// Defaults to the first controller, `(0)`.
	DiskControllerIndex int `mapstructure:"disk_controller_index"`
}

The following example that will create a 15GB and a 20GB disk on the virtual machine. The second disk will be thin provisioned:

HCL Example:

```hcl

storage {
    disk_size = 15000
}
storage {
    disk_size = 20000
    disk_thin_provisioned = true
}

```

JSON Example:

```json

"storage": [
  {
    "disk_size": 15000
  },
  {
    "disk_size": 20000,
    "disk_thin_provisioned": true
  }
],

```

The following example will use two PVSCSI controllers and two disks on each controller.

HCL Example:

```hcl

 disk_controller_type = ["pvscsi", "pvscsi"]
	storage {
	   disk_size = 15000,
	   disk_controller_index = 0
	}
	storage {
	   disk_size = 15000
	   disk_controller_index = 0
	}
	storage {
	   disk_size = 15000
	   disk_controller_index = 1
	}
	storage {
	   disk_size = 15000
	   disk_controller_index = 1
	}

```

JSON Example:

```json

"disk_controller_type": ["pvscsi", "pvscsi"],
"storage": [
  {
    "disk_size": 15000,
    "disk_controller_index": 0
  },
  {
    "disk_size": 15000,
    "disk_controller_index": 0
  },
  {
    "disk_size": 15000,
    "disk_controller_index": 1
  },
  {
    "disk_size": 15000,
    "disk_controller_index": 1
  }
],

```

func (*DiskConfig) FlatMapstructure

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

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

type DownloadStep

type DownloadStep interface {
	Run(context.Context, multistep.StateBag) multistep.StepAction
	Cleanup(multistep.StateBag)
	UseSourceToFindCacheTarget(source string) (*url.URL, string, error)
}

Defining this interface ensures that we use the common StepDownload, or the mock created to test this wrapper.

type ExportConfig

type ExportConfig struct {
	// The name of the exported image in Open Virtualization Format (OVF).
	//
	// -> **Note:** The name of the virtual machine with the `.ovf` extension is
	// used if this option is not specified.
	Name string `mapstructure:"name"`
	// Forces the export to overwrite existing files. Defaults to `false`.
	// If set to `false`, an error is returned if the file(s) already exists.
	Force bool `mapstructure:"force"`
	// Include additional image files that are that are associated with the
	// virtual machine. Defaults to `false`. For example, `.nvram` and `.log`
	// files.
	ImageFiles bool `mapstructure:"image_files"`
	// The hash algorithm to use when generating a manifest file. Defaults to
	// `sha256`.
	//
	// The available options for this setting are: 'none', 'sha1', 'sha256', and
	// 'sha512'.
	//
	// --> **Tip:** Use `none` to disable the creation of a manifest file.
	Manifest string `mapstructure:"manifest"`
	// The path to the directory where the exported image will be saved.
	OutputDir OutputConfig `mapstructure:",squash"`
	// Advanced image export options. Available options include:
	// * `mac` - MAC address is exported for each Ethernet device.
	// * `uuid` - UUID is exported for the virtual machine.
	// * `extraconfig` - Extra configuration options are exported for the
	//   virtual machine.
	// * `nodevicesubtypes` - Resource subtypes for CD/DVD drives, floppy
	//   drives, and SCSI controllers are not exported.
	//
	// For example, adding the following export configuration option outputs the
	// MAC addresses for each Ethernet device in the OVF descriptor:
	//
	// HCL Example:
	//
	// “`hcl
	// ...
	//   export {
	//     options = ["mac"]
	//   }
	// “`
	//
	// JSON: Example:
	//
	// “`json
	// ...
	//   "export": {
	//     "options": ["mac"]
	//   },
	// “`
	Options []string `mapstructure:"options"`
	// The output format for the exported virtual machine image.
	// Defaults to `ovf`. Available options include `ovf` and `ova`.
	//
	// When set to `ova`, the image is first exported using Open Virtualization
	// Format (`.ovf`) and then converted to an Open Virtualization Archive
	// (`.ova`) using the VMware [Open Virtualization Format Tool](https://developer.broadcom.com/tools/open-virtualization-format-ovf-tool/latest)
	// (ovftool). The intermediate files are removed after the conversion.
	//
	// ~> **Note:** To use the `ova` format option, VMware ovftool must be
	// installed on the Packer host and accessible in either the system `PATH`
	// or the user's `PATH`.
	Format string `mapstructure:"output_format"`
}

You can export an image in Open Virtualization Format (OVF) to the Packer host.

HCL Example:

```hcl

# ...
vm_name = "example-ubuntu"
# ...
export {
  force = true
  output_directory = "./output-artifacts"
}

```

JSON Example:

```json ...

"vm_name": "example-ubuntu",

...

"export": {
  "force": true,
  "output_directory": "./output-artifacts"
},

```

The above configuration would create the following files:

```text ./output-artifacts/example-ubuntu-disk-0.vmdk ./output-artifacts/example-ubuntu.mf ./output-artifacts/example-ubuntu.ovf ```

func (*ExportConfig) FlatMapstructure

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

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

func (*ExportConfig) Prepare

type FlagConfig added in v1.2.3

type FlagConfig struct {
	// Enable Virtualization Based Security option for virtual machine. Defaults to `false`.
	// Requires `vvtd_enabled` and `NestedHV` to be set to `true`.
	// Requires `firmware` to be set to `efi-secure`.
	VbsEnabled bool `mapstructure:"vbs_enabled"`
	// Enable IO/MMU option for virtual machine. Defaults to `false`.
	VvtdEnabled bool `mapstructure:"vvtd_enabled"`
}

func (*FlagConfig) FlatMapstructure added in v1.2.3

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

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

func (*FlagConfig) Prepare added in v1.2.3

func (c *FlagConfig) Prepare(h *HardwareConfig) []error

type FlatCDRomConfig

type FlatCDRomConfig struct {
	CdromType *string  `mapstructure:"cdrom_type" cty:"cdrom_type" hcl:"cdrom_type"`
	ISOPaths  []string `mapstructure:"iso_paths" cty:"iso_paths" hcl:"iso_paths"`
}

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

func (*FlatCDRomConfig) HCL2Spec

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

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

type FlatConfigParamsConfig

type FlatConfigParamsConfig struct {
	ConfigParams       map[string]string `mapstructure:"configuration_parameters" cty:"configuration_parameters" hcl:"configuration_parameters"`
	ToolsSyncTime      *bool             `mapstructure:"tools_sync_time" cty:"tools_sync_time" hcl:"tools_sync_time"`
	ToolsUpgradePolicy *bool             `mapstructure:"tools_upgrade_policy" cty:"tools_upgrade_policy" hcl:"tools_upgrade_policy"`
}

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

func (*FlatConfigParamsConfig) HCL2Spec

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

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

type FlatConnectConfig

type FlatConnectConfig struct {
	VCenterServer      *string `mapstructure:"vcenter_server" cty:"vcenter_server" hcl:"vcenter_server"`
	Username           *string `mapstructure:"username" cty:"username" hcl:"username"`
	Password           *string `mapstructure:"password" cty:"password" hcl:"password"`
	InsecureConnection *bool   `mapstructure:"insecure_connection" cty:"insecure_connection" hcl:"insecure_connection"`
	Datacenter         *string `mapstructure:"datacenter" cty:"datacenter" hcl:"datacenter"`
}

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

func (*FlatConnectConfig) HCL2Spec

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

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

type FlatContentLibraryDestinationConfig

type FlatContentLibraryDestinationConfig struct {
	Library      *string  `mapstructure:"library" cty:"library" hcl:"library"`
	Name         *string  `mapstructure:"name" cty:"name" hcl:"name"`
	Description  *string  `mapstructure:"description" cty:"description" hcl:"description"`
	Cluster      *string  `mapstructure:"cluster" cty:"cluster" hcl:"cluster"`
	Folder       *string  `mapstructure:"folder" cty:"folder" hcl:"folder"`
	Host         *string  `mapstructure:"host" cty:"host" hcl:"host"`
	ResourcePool *string  `mapstructure:"resource_pool" cty:"resource_pool" hcl:"resource_pool"`
	Datastore    *string  `mapstructure:"datastore" cty:"datastore" hcl:"datastore"`
	Destroy      *bool    `mapstructure:"destroy" cty:"destroy" hcl:"destroy"`
	Ovf          *bool    `mapstructure:"ovf" cty:"ovf" hcl:"ovf"`
	SkipImport   *bool    `mapstructure:"skip_import" cty:"skip_import" hcl:"skip_import"`
	OvfFlags     []string `mapstructure:"ovf_flags" cty:"ovf_flags" hcl:"ovf_flags"`
}

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

func (*FlatContentLibraryDestinationConfig) HCL2Spec

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

type FlatDiskConfig

type FlatDiskConfig struct {
	DiskSize            *int64 `mapstructure:"disk_size" required:"true" cty:"disk_size" hcl:"disk_size"`
	DiskThinProvisioned *bool  `mapstructure:"disk_thin_provisioned" cty:"disk_thin_provisioned" hcl:"disk_thin_provisioned"`
	DiskEagerlyScrub    *bool  `mapstructure:"disk_eagerly_scrub" cty:"disk_eagerly_scrub" hcl:"disk_eagerly_scrub"`
	DiskControllerIndex *int   `mapstructure:"disk_controller_index" cty:"disk_controller_index" hcl:"disk_controller_index"`
}

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

func (*FlatDiskConfig) HCL2Spec

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

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

type FlatExportConfig

type FlatExportConfig struct {
	Name       *string      `mapstructure:"name" cty:"name" hcl:"name"`
	Force      *bool        `mapstructure:"force" cty:"force" hcl:"force"`
	ImageFiles *bool        `mapstructure:"image_files" cty:"image_files" hcl:"image_files"`
	Manifest   *string      `mapstructure:"manifest" cty:"manifest" hcl:"manifest"`
	OutputDir  *string      `mapstructure:"output_directory" required:"false" cty:"output_directory" hcl:"output_directory"`
	DirPerm    *fs.FileMode `mapstructure:"directory_permission" required:"false" cty:"directory_permission" hcl:"directory_permission"`
	Options    []string     `mapstructure:"options" cty:"options" hcl:"options"`
	Format     *string      `mapstructure:"output_format" cty:"output_format" hcl:"output_format"`
}

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

func (*FlatExportConfig) HCL2Spec

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

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

type FlatFlagConfig added in v1.2.3

type FlatFlagConfig struct {
	VbsEnabled  *bool `mapstructure:"vbs_enabled" cty:"vbs_enabled" hcl:"vbs_enabled"`
	VvtdEnabled *bool `mapstructure:"vvtd_enabled" cty:"vvtd_enabled" hcl:"vvtd_enabled"`
}

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

func (*FlatFlagConfig) HCL2Spec added in v1.2.3

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

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

type FlatFloppyConfig

type FlatFloppyConfig struct {
	FloppyIMGPath     *string           `mapstructure:"floppy_img_path" cty:"floppy_img_path" hcl:"floppy_img_path"`
	FloppyFiles       []string          `mapstructure:"floppy_files" cty:"floppy_files" hcl:"floppy_files"`
	FloppyDirectories []string          `mapstructure:"floppy_dirs" cty:"floppy_dirs" hcl:"floppy_dirs"`
	FloppyContent     map[string]string `mapstructure:"floppy_content" cty:"floppy_content" hcl:"floppy_content"`
	FloppyLabel       *string           `mapstructure:"floppy_label" cty:"floppy_label" hcl:"floppy_label"`
}

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

func (*FlatFloppyConfig) HCL2Spec

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

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

type FlatHardwareConfig

type FlatHardwareConfig struct {
	CPUs                  *int32                            `mapstructure:"CPUs" cty:"CPUs" hcl:"CPUs"`
	CpuCores              *int32                            `mapstructure:"cpu_cores" cty:"cpu_cores" hcl:"cpu_cores"`
	CPUReservation        *int64                            `mapstructure:"CPU_reservation" cty:"CPU_reservation" hcl:"CPU_reservation"`
	CPULimit              *int64                            `mapstructure:"CPU_limit" cty:"CPU_limit" hcl:"CPU_limit"`
	CpuHotAddEnabled      *bool                             `mapstructure:"CPU_hot_plug" cty:"CPU_hot_plug" hcl:"CPU_hot_plug"`
	RAM                   *int64                            `mapstructure:"RAM" cty:"RAM" hcl:"RAM"`
	RAMReservation        *int64                            `mapstructure:"RAM_reservation" cty:"RAM_reservation" hcl:"RAM_reservation"`
	RAMReserveAll         *bool                             `mapstructure:"RAM_reserve_all" cty:"RAM_reserve_all" hcl:"RAM_reserve_all"`
	MemoryHotAddEnabled   *bool                             `mapstructure:"RAM_hot_plug" cty:"RAM_hot_plug" hcl:"RAM_hot_plug"`
	VideoRAM              *int64                            `mapstructure:"video_ram" cty:"video_ram" hcl:"video_ram"`
	Displays              *int32                            `mapstructure:"displays" cty:"displays" hcl:"displays"`
	AllowedDevices        []FlatPCIPassthroughAllowedDevice `mapstructure:"pci_passthrough_allowed_device" cty:"pci_passthrough_allowed_device" hcl:"pci_passthrough_allowed_device"`
	VGPUProfile           *string                           `mapstructure:"vgpu_profile" cty:"vgpu_profile" hcl:"vgpu_profile"`
	NestedHV              *bool                             `mapstructure:"NestedHV" cty:"NestedHV" hcl:"NestedHV"`
	Firmware              *string                           `mapstructure:"firmware" cty:"firmware" hcl:"firmware"`
	ForceBIOSSetup        *bool                             `mapstructure:"force_bios_setup" cty:"force_bios_setup" hcl:"force_bios_setup"`
	VTPMEnabled           *bool                             `mapstructure:"vTPM" cty:"vTPM" hcl:"vTPM"`
	VirtualPrecisionClock *string                           `mapstructure:"precision_clock" cty:"precision_clock" hcl:"precision_clock"`
}

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

func (*FlatHardwareConfig) HCL2Spec

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

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

type FlatLocationConfig

type FlatLocationConfig struct {
	VMName                     *string `mapstructure:"vm_name" cty:"vm_name" hcl:"vm_name"`
	Folder                     *string `mapstructure:"folder" cty:"folder" hcl:"folder"`
	Cluster                    *string `mapstructure:"cluster" cty:"cluster" hcl:"cluster"`
	Host                       *string `mapstructure:"host" cty:"host" hcl:"host"`
	ResourcePool               *string `mapstructure:"resource_pool" cty:"resource_pool" hcl:"resource_pool"`
	Datastore                  *string `mapstructure:"datastore" cty:"datastore" hcl:"datastore"`
	SetHostForDatastoreUploads *bool   `mapstructure:"set_host_for_datastore_uploads" cty:"set_host_for_datastore_uploads" hcl:"set_host_for_datastore_uploads"`
}

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

func (*FlatLocationConfig) HCL2Spec

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

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

type FlatOutputConfig

type FlatOutputConfig struct {
	OutputDir *string      `mapstructure:"output_directory" required:"false" cty:"output_directory" hcl:"output_directory"`
	DirPerm   *fs.FileMode `mapstructure:"directory_permission" required:"false" cty:"directory_permission" hcl:"directory_permission"`
}

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

func (*FlatOutputConfig) HCL2Spec

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

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

type FlatPCIPassthroughAllowedDevice added in v1.3.0

type FlatPCIPassthroughAllowedDevice struct {
	VendorId    *string `mapstructure:"vendor_id" cty:"vendor_id" hcl:"vendor_id"`
	DeviceId    *string `mapstructure:"device_id" cty:"device_id" hcl:"device_id"`
	SubVendorId *string `mapstructure:"sub_vendor_id" cty:"sub_vendor_id" hcl:"sub_vendor_id"`
	SubDeviceId *string `mapstructure:"sub_device_id" cty:"sub_device_id" hcl:"sub_device_id"`
}

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

func (*FlatPCIPassthroughAllowedDevice) HCL2Spec added in v1.3.0

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

type FlatReattachCDRomConfig added in v1.2.4

type FlatReattachCDRomConfig struct {
	ReattachCDRom *int `mapstructure:"reattach_cdroms" cty:"reattach_cdroms" hcl:"reattach_cdroms"`
}

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

func (*FlatReattachCDRomConfig) HCL2Spec added in v1.2.4

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

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

type FlatRemoveCDRomConfig

type FlatRemoveCDRomConfig struct {
	RemoveCdrom *bool `mapstructure:"remove_cdrom" cty:"remove_cdrom" hcl:"remove_cdrom"`
}

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

func (*FlatRemoveCDRomConfig) HCL2Spec

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

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

type FlatRemoveNetworkAdapterConfig added in v1.3.0

type FlatRemoveNetworkAdapterConfig struct {
	RemoveNetworkAdapter *bool `mapstructure:"remove_network_adapter" cty:"remove_network_adapter" hcl:"remove_network_adapter"`
}

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

func (*FlatRemoveNetworkAdapterConfig) HCL2Spec added in v1.3.0

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

type FlatRunConfig

type FlatRunConfig struct {
	BootOrder *string `mapstructure:"boot_order" cty:"boot_order" hcl:"boot_order"`
}

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

func (*FlatRunConfig) HCL2Spec

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

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

type FlatShutdownConfig

type FlatShutdownConfig struct {
	Command         *string `mapstructure:"shutdown_command" cty:"shutdown_command" hcl:"shutdown_command"`
	Timeout         *string `mapstructure:"shutdown_timeout" cty:"shutdown_timeout" hcl:"shutdown_timeout"`
	DisableShutdown *bool   `mapstructure:"disable_shutdown" cty:"disable_shutdown" hcl:"disable_shutdown"`
}

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

func (*FlatShutdownConfig) HCL2Spec

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

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

type FlatStorageConfig

type FlatStorageConfig struct {
	DiskControllerType []string         `mapstructure:"disk_controller_type" cty:"disk_controller_type" hcl:"disk_controller_type"`
	Storage            []FlatDiskConfig `mapstructure:"storage" cty:"storage" hcl:"storage"`
}

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

func (*FlatStorageConfig) HCL2Spec

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

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

type FlatWaitIpConfig

type FlatWaitIpConfig struct {
	WaitTimeout   *string `mapstructure:"ip_wait_timeout" cty:"ip_wait_timeout" hcl:"ip_wait_timeout"`
	SettleTimeout *string `mapstructure:"ip_settle_timeout" cty:"ip_settle_timeout" hcl:"ip_settle_timeout"`
	WaitAddress   *string `mapstructure:"ip_wait_address" cty:"ip_wait_address" hcl:"ip_wait_address"`
}

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

func (*FlatWaitIpConfig) HCL2Spec

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

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

type FloppyConfig

type FloppyConfig struct {
	// Datastore path to a floppy image that will be mounted to the virtual
	// machine. Example: `[datastore] iso/foo.flp`.
	FloppyIMGPath string `mapstructure:"floppy_img_path"`
	// A list of local files to be mounted to the virtual machine's floppy
	// drive.
	FloppyFiles []string `mapstructure:"floppy_files"`
	// A list of directories to copy files from.
	FloppyDirectories []string `mapstructure:"floppy_dirs"`
	// Key/Values to add to the floppy disk. The keys represent the paths, and
	// the values contents. It can be used alongside `floppy_files` or
	// `floppy_dirs`, which is useful to add large files without loading them
	// into memory. If any paths are specified by both, the contents in
	// `floppy_content` will take precedence.
	//
	// HCL Example:
	//
	// “`hcl
	// floppy_content = {
	//   "meta-data" = jsonencode(local.instance_data)
	//   "user-data" = templatefile("user-data", { packages = ["nginx"] })
	// }
	// “`
	FloppyContent map[string]string `mapstructure:"floppy_content"`
	// The label to use for the floppy disk that is attached when the virtual
	// machine is booted. This is most useful for cloud-init, Kickstart or other
	// early initialization tools, which can benefit from labelled floppy disks.
	// By default, the floppy label will be 'packer'.
	FloppyLabel string `mapstructure:"floppy_label"`
}

func (*FloppyConfig) FlatMapstructure

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

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

type HardwareConfig

type HardwareConfig struct {
	// The number of virtual CPUs cores for the virtual machine.
	CPUs int32 `mapstructure:"CPUs"`
	// The number of virtual CPU cores per socket for the virtual machine.
	CpuCores int32 `mapstructure:"cpu_cores"`
	// The CPU reservation in MHz.
	CPUReservation int64 `mapstructure:"CPU_reservation"`
	// The upper limit of available CPU resources in MHz.
	CPULimit int64 `mapstructure:"CPU_limit"`
	// Enable CPU hot plug setting for virtual machine. Defaults to `false`
	CpuHotAddEnabled bool `mapstructure:"CPU_hot_plug"`
	// The amount of memory for the virtual machine in MB.
	RAM int64 `mapstructure:"RAM"`
	// The guaranteed minimum allocation of memory for the virtual machine in MB.
	RAMReservation int64 `mapstructure:"RAM_reservation"`
	// Reserve all allocated memory. Defaults to `false`.
	//
	// -> **Note:** May not be used together with `RAM_reservation`.
	RAMReserveAll bool `mapstructure:"RAM_reserve_all"`
	// Enable memory hot add setting for virtual machine. Defaults to `false`.
	MemoryHotAddEnabled bool `mapstructure:"RAM_hot_plug"`
	// The amount of video memory in KB. Defaults to 4096 KB.
	//
	// -> **Note:** Refer to the [vSphere documentation](https://docs.vmware.com/en/VMware-vSphere/8.0/vsphere-vm-administration/GUID-789C3913-1053-4850-A0F0-E29C3D32B6DA.html)
	// for supported maximums.
	VideoRAM int64 `mapstructure:"video_ram"`
	// The number of video displays. Defaults to `1`.
	//
	//`-> **Note:** Refer to the [vSphere documentation](https://docs.vmware.com/en/VMware-vSphere/8.0/vsphere-vm-administration/GUID-789C3913-1053-4850-A0F0-E29C3D32B6DA.html)
	// for supported maximums.
	Displays int32 `mapstructure:"displays"`
	// Configure Dynamic DirectPath I/O [PCI Passthrough](#pci-passthrough-configuration) for
	// virtual machine. Refer to the [vSphere documentation](https://docs.vmware.com/en/VMware-vSphere/8.0/vsphere-vm-administration/GUID-5B3CAB26-5D06-4A99-92A0-3A04C69CE64B.html)
	AllowedDevices []PCIPassthroughAllowedDevice `mapstructure:"pci_passthrough_allowed_device"`
	// vGPU profile for accelerated graphics. Refer to the [NVIDIA GRID vGPU documentation](https://docs.nvidia.com/grid/latest/grid-vgpu-user-guide/index.html#configure-vmware-vsphere-vm-with-vgpu)
	// for examples of profile names. Defaults to none.
	VGPUProfile string `mapstructure:"vgpu_profile"`
	// Enable nested hardware virtualization for the virtual machine.
	// Defaults to `false`.
	NestedHV bool `mapstructure:"NestedHV"`
	// The firmware for the virtual machine.
	//
	// The available options for this setting are: 'bios', 'efi', and
	// 'efi-secure'.
	//
	// -> **Note:** Use `efi-secure` for UEFI Secure Boot.
	Firmware string `mapstructure:"firmware"`
	// Force entry into the BIOS setup screen during boot. Defaults to `false`.
	ForceBIOSSetup bool `mapstructure:"force_bios_setup"`
	// Enable virtual trusted platform module (TPM) device for the virtual
	// machine. Defaults to `false`.
	VTPMEnabled bool `mapstructure:"vTPM"`
	// The virtual precision clock device for the virtual machine.
	// Defaults to `none`.
	//
	// The available options for this setting are: `none`, `ntp`, and `ptp`.
	VirtualPrecisionClock string `mapstructure:"precision_clock"`
}

func (*HardwareConfig) FlatMapstructure

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

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

func (*HardwareConfig) Prepare

func (c *HardwareConfig) Prepare() []error

type LocationConfig

type LocationConfig struct {
	// The name of the virtual machine.
	VMName string `mapstructure:"vm_name"`
	// The virtual machine folder where the virtual machine is created.
	Folder string `mapstructure:"folder"`
	// The cluster where the virtual machine is created.
	// Refer to the [Working With Clusters And Hosts](#working-with-clusters-and-hosts)
	// section for more details.
	Cluster string `mapstructure:"cluster"`
	// The ESXi host where the virtual machine is created. A full path must be
	// specified if the ESXi host is in a folder. For example `folder/host`.
	// Refer to the [Working With Clusters And Hosts](#working-with-clusters-and-hosts)
	// section for more details.
	Host string `mapstructure:"host"`
	// The resource pool where the virtual machine is created.
	// If this is not specified, the root resource pool associated with the
	// `host` or `cluster` is used.
	//
	// ~> **Note:**  The full path to the resource pool must be provided.
	// For example, a simple resource pool path might resemble `rp-packer` and
	// a nested path might resemble 'rp-packer/rp-linux-images'.
	ResourcePool string `mapstructure:"resource_pool"`
	// The datastore where the virtual machine is created.
	// Required if `host` is a cluster, or if `host` has multiple datastores.
	Datastore string `mapstructure:"datastore"`
	// The ESXI host used for uploading files to the datastore.
	// Defaults to `false`.
	SetHostForDatastoreUploads bool `mapstructure:"set_host_for_datastore_uploads"`
}

func (*LocationConfig) FlatMapstructure

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

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

func (*LocationConfig) Prepare

func (c *LocationConfig) Prepare() []error

type OutputConfig

type OutputConfig struct {
	// The directory where artifacts from the build, such as the virtual machine
	// files and disks, will be output to. The path to the directory may be
	// relative or absolute. If relative, the path is relative to the working
	// directory Packer is run from. This directory must not exist or, if
	// created, must be empty prior to running the builder. By default this is
	// "output-<buildName>" where "buildName" is the name of the build.
	OutputDir string `mapstructure:"output_directory" required:"false"`
	// The permissions to apply to the "output_directory", and to any parent
	// directories that get created for output_directory.  By default this is
	// "0750". You should express the permission as quoted string with a
	// leading zero such as "0755" in JSON file, because JSON does not support
	// octal value. In Unix-like OS, the actual permission may differ from
	// this value because of umask.
	DirPerm os.FileMode `mapstructure:"directory_permission" required:"false"`
}

func (*OutputConfig) FlatMapstructure

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

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

func (*OutputConfig) ListFiles

func (c *OutputConfig) ListFiles() ([]string, error)

Stolen from output_dir_local.go in vmware builder.

func (*OutputConfig) Prepare

func (c *OutputConfig) Prepare(ctx *interpolate.Context, pc *common.PackerConfig) []error

type PCIPassthroughAllowedDevice added in v1.3.0

type PCIPassthroughAllowedDevice struct {
	// The sub-vendor ID of the PCI device.
	VendorId string `mapstructure:"vendor_id"`
	// The vendor ID of the PCI device.
	DeviceId string `mapstructure:"device_id"`
	// The sub-vendor ID of the PCI device.
	SubVendorId string `mapstructure:"sub_vendor_id"`
	// The sub-device ID of the PCI device.
	SubDeviceId string `mapstructure:"sub_device_id"`
}

Dynamic DirectPath I/O is component of the Assignable Hardware framework in VMware vSphere. Dynamic DirectPath I/O enables the Assignable Hardware intelligence for passthrough devices and the hardware address of the PCIe device is no longer directly mapped to the virtual machine configuration. Instead, the attributes, or capabilities, are exposed to the virtual machine.

JSON

```json

{
  "pci_passthrough_allowed_device": {
    "vendor_id": "8086",
    "device_id": "100e",
    "sub_device_id": "8086",
    "sub_vendor_id": "100e"
  }
}

```

HCL2

```hcl

pci_passthrough_allowed_device {
  "vendor_id": "8086",
  "device_id": "100e",
  "sub_device_id": "8086",
  "sub_vendor_id": "100e"
}

```

func (*PCIPassthroughAllowedDevice) FlatMapstructure added in v1.3.0

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

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

type ReattachCDRomConfig added in v1.2.4

type ReattachCDRomConfig struct {
	// The number of CD-ROM devices to reattach to the final build artifact.
	// Range: 0 - 4. Defaults to 0.
	//
	// -> **Note:** If set to 0, the step is skipped. When set to a value in the
	// range, `remove_cdrom` is ignored and the CD-ROM devices are kept without
	// any attached media.
	ReattachCDRom int `mapstructure:"reattach_cdroms"`
}

func (*ReattachCDRomConfig) FlatMapstructure added in v1.2.4

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

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

type RemoveCDRomConfig

type RemoveCDRomConfig struct {
	// Remove all CD-ROM devices from the virtual machine when the build is
	// complete. Defaults to `false`.
	RemoveCdrom bool `mapstructure:"remove_cdrom"`
}

func (*RemoveCDRomConfig) FlatMapstructure

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

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

type RemoveNetworkAdapterConfig added in v1.3.0

type RemoveNetworkAdapterConfig struct {
	// Remove all network adapters from the virtual machine image. Defaults to `false`.
	RemoveNetworkAdapter bool `mapstructure:"remove_network_adapter"`
}

func (*RemoveNetworkAdapterConfig) FlatMapstructure added in v1.3.0

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

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

type RunConfig

type RunConfig struct {
	// The priority of boot devices. Defaults to `disk,cdrom`.
	//
	// The available boot devices are: `floppy`, `cdrom`, `ethernet`, and
	// `disk`.
	//
	// -> **Note:** If not set, the boot order is temporarily set to
	// `disk,cdrom` for the duration of the build and then cleared upon
	// build completion.
	BootOrder string `mapstructure:"boot_order"`
}

func (*RunConfig) FlatMapstructure

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

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

type ShutdownConfig

type ShutdownConfig struct {
	// Specify a VM guest shutdown command. This command will be executed using
	// the `communicator`. Otherwise, the VMware Tools are used to gracefully shutdown
	// the VM.
	Command string `mapstructure:"shutdown_command"`
	// Amount of time to wait for graceful VM shutdown.
	// Defaults to 5m or five minutes.
	// This will likely need to be modified if the `communicator` is 'none'.
	Timeout time.Duration `mapstructure:"shutdown_timeout"`
	// Packer normally halts the virtual machine after all provisioners have
	// run when no `shutdown_command` is defined. If this is set to `true`, Packer
	// *will not* halt the virtual machine but will assume that you will send the stop
	// signal yourself through a preseed.cfg, a script or the final provisioner.
	// Packer will wait for a default of five minutes until the virtual machine is shutdown.
	// The timeout can be changed using `shutdown_timeout` option.
	DisableShutdown bool `mapstructure:"disable_shutdown"`
}

func (*ShutdownConfig) FlatMapstructure

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

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

func (*ShutdownConfig) Prepare

func (c *ShutdownConfig) Prepare(comm communicator.Config) (warnings []string, errs []error)

type StepAddCDRom

type StepAddCDRom struct {
	Config *CDRomConfig
}

func (*StepAddCDRom) Cleanup

func (s *StepAddCDRom) Cleanup(state multistep.StateBag)

func (*StepAddCDRom) Run

type StepAddFlag added in v1.2.3

type StepAddFlag struct {
	FlagConfig FlagConfig
}

func (*StepAddFlag) Cleanup added in v1.2.3

func (s *StepAddFlag) Cleanup(state multistep.StateBag)

func (*StepAddFlag) Run added in v1.2.3

type StepAddFloppy

type StepAddFloppy struct {
	Config                     *FloppyConfig
	Datastore                  string
	Host                       string
	SetHostForDatastoreUploads bool
}

func (*StepAddFloppy) Cleanup

func (s *StepAddFloppy) Cleanup(state multistep.StateBag)

func (*StepAddFloppy) Run

type StepBootCommand

type StepBootCommand struct {
	Config *BootConfig
	VMName string
	Ctx    interpolate.Context
}

func (*StepBootCommand) Cleanup

func (s *StepBootCommand) Cleanup(_ multistep.StateBag)

func (*StepBootCommand) Run

type StepConfigParams

type StepConfigParams struct {
	Config *ConfigParamsConfig
}

func (*StepConfigParams) Cleanup

func (s *StepConfigParams) Cleanup(state multistep.StateBag)

func (*StepConfigParams) Run

type StepConfigureHardware

type StepConfigureHardware struct {
	Config *HardwareConfig
}

func (*StepConfigureHardware) Cleanup

func (*StepConfigureHardware) Run

type StepConnect

type StepConnect struct {
	Config *ConnectConfig
}

func (*StepConnect) Cleanup

func (s *StepConnect) Cleanup(state multistep.StateBag)

func (*StepConnect) Run

type StepConvertToTemplate

type StepConvertToTemplate struct {
	ConvertToTemplate bool
}

func (*StepConvertToTemplate) Cleanup

func (s *StepConvertToTemplate) Cleanup(state multistep.StateBag)

func (*StepConvertToTemplate) Run

type StepCreateSnapshot

type StepCreateSnapshot struct {
	CreateSnapshot bool
	SnapshotName   string
}

func (*StepCreateSnapshot) Cleanup

func (s *StepCreateSnapshot) Cleanup(state multistep.StateBag)

func (*StepCreateSnapshot) Run

type StepDownload

type StepDownload struct {
	DownloadStep DownloadStep
	// These keys are vSphere-specific and are used to check the remote datastore.
	Url                  []string
	ResultKey            string
	Datastore            string
	Host                 string
	LocalCacheOverwrite  bool
	RemoteCacheOverwrite bool
	RemoteCacheDatastore string
	RemoteCachePath      string
}

Before downloading and uploading an ISO file to the remote cache, check if the ISO file already exists on the datastore.

If it exists, we check if the overwrite flag is set to true. If it is, we delete the file and download it again. If it is not set or false, the download is skipped.

This wrapping-step still uses the common StepDownload, but only if the ISO file does not already exist on the datastore.

func (*StepDownload) Cleanup

func (s *StepDownload) Cleanup(state multistep.StateBag)

func (*StepDownload) Run

type StepExport

type StepExport struct {
	Name       string
	Force      bool
	ImageFiles bool
	Manifest   string
	OutputDir  string
	Options    []string
	Format     string
	// contains filtered or unexported fields
}

func (*StepExport) Cleanup

func (s *StepExport) Cleanup(multistep.StateBag)

func (*StepExport) Download

func (s *StepExport) Download(ctx context.Context, lease *nfc.Lease, item nfc.FileItem) (int64, error)

func (*StepExport) Run

type StepHTTPIPDiscover

type StepHTTPIPDiscover struct {
	HTTPIP  string
	Network *net.IPNet
}

Step to discover the http ip which guests use to reach the vm host To make sure the IP is set before boot command and http server steps

func (*StepHTTPIPDiscover) Cleanup

func (s *StepHTTPIPDiscover) Cleanup(state multistep.StateBag)

func (*StepHTTPIPDiscover) Run

type StepImportToContentLibrary

type StepImportToContentLibrary struct {
	ContentLibConfig *ContentLibraryDestinationConfig
}

func (*StepImportToContentLibrary) Cleanup

func (*StepImportToContentLibrary) Run

type StepReattachCDRom added in v1.2.4

type StepReattachCDRom struct {
	Config      *ReattachCDRomConfig
	CDRomConfig *CDRomConfig
}

func (*StepReattachCDRom) Cleanup added in v1.2.4

func (s *StepReattachCDRom) Cleanup(state multistep.StateBag)

func (*StepReattachCDRom) Run added in v1.2.4

type StepRemoteUpload

type StepRemoteUpload struct {
	Datastore                  string
	Host                       string
	SetHostForDatastoreUploads bool
	RemoteCacheCleanup         bool
	RemoteCacheOverwrite       bool
	RemoteCacheDatastore       string
	RemoteCachePath            string
	UploadedCustomCD           bool
}

func (*StepRemoteUpload) Cleanup

func (s *StepRemoteUpload) Cleanup(state multistep.StateBag)

func (*StepRemoteUpload) Run

type StepRemoveCDRom

type StepRemoveCDRom struct {
	Config *RemoveCDRomConfig
}

func (*StepRemoveCDRom) Cleanup

func (s *StepRemoveCDRom) Cleanup(state multistep.StateBag)

func (*StepRemoveCDRom) Run

type StepRemoveFloppy

type StepRemoveFloppy struct {
	Datastore string
	Host      string
}

func (*StepRemoveFloppy) Cleanup

func (s *StepRemoveFloppy) Cleanup(state multistep.StateBag)

func (*StepRemoveFloppy) Run

type StepRemoveNetworkAdapter added in v1.3.0

type StepRemoveNetworkAdapter struct {
	Config *RemoveNetworkAdapterConfig
}

func (*StepRemoveNetworkAdapter) Cleanup added in v1.3.0

func (s *StepRemoveNetworkAdapter) Cleanup(state multistep.StateBag)

func (*StepRemoveNetworkAdapter) Run added in v1.3.0

type StepRun

type StepRun struct {
	Config   *RunConfig
	SetOrder bool
}

func (*StepRun) Cleanup

func (s *StepRun) Cleanup(state multistep.StateBag)

func (*StepRun) Run

type StepShutdown

type StepShutdown struct {
	Config *ShutdownConfig
}

func (*StepShutdown) Cleanup

func (s *StepShutdown) Cleanup(state multistep.StateBag)

func (*StepShutdown) Run

type StepSshKeyPair

type StepSshKeyPair struct {
	Debug        bool
	DebugKeyPath string
	Comm         *communicator.Config
}

StepSshKeyPair executes the business logic for setting the SSH key pair in the specified communicator.Config.

func (*StepSshKeyPair) Cleanup

func (s *StepSshKeyPair) Cleanup(state multistep.StateBag)

func (*StepSshKeyPair) Run

type StepWaitForIp

type StepWaitForIp struct {
	Config *WaitIpConfig
}

func (*StepWaitForIp) Cleanup

func (s *StepWaitForIp) Cleanup(state multistep.StateBag)

func (*StepWaitForIp) Run

type StorageConfig

type StorageConfig struct {
	// The disk controller type. One of `lsilogic`, `lsilogic-sas`, `pvscsi`,
	// `nvme`, `scsi`, or `sata`. Defaults to `lsilogic`. Use a list to define
	// additional controllers. Refer to [SCSI, SATA, and NVMe Storage Controller
	// Conditions, Limitations, and Compatibility](https://docs.vmware.com/en/VMware-vSphere/8.0/vsphere-vm-administration/GUID-5872D173-A076-42FE-8D0B-9DB0EB0E7362.html)
	// for additional information.
	DiskControllerType []string `mapstructure:"disk_controller_type"`
	// A collection of one or more disks to be provisioned.
	// Refer to the [Storage Configuration](#storage-configuration) section for additional information.
	Storage []DiskConfig `mapstructure:"storage"`
}

func (*StorageConfig) FlatMapstructure

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

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

func (*StorageConfig) Prepare

func (c *StorageConfig) Prepare() []error

type WaitIpConfig

type WaitIpConfig struct {
	// Amount of time to wait for VM's IP, similar to 'ssh_timeout'.
	// Defaults to 30m (30 minutes). See the Golang
	// [ParseDuration](https://golang.org/pkg/time/#ParseDuration) documentation
	// for full details.
	WaitTimeout time.Duration `mapstructure:"ip_wait_timeout"`
	// Amount of time to wait for VM's IP to settle down, sometimes VM may
	// report incorrect IP initially, then its recommended to set that
	// parameter to apx. 2 minutes. Examples 45s and 10m. Defaults to
	// 5s(5 seconds). Refer to the Golang
	// [ParseDuration](https://golang.org/pkg/time/#ParseDuration) documentation
	//  for full details.
	SettleTimeout time.Duration `mapstructure:"ip_settle_timeout"`
	// Set this to a CIDR address to cause the service to wait for an address that is contained in
	// this network range. Defaults to "0.0.0.0/0" for any ipv4 address. Examples include:
	//
	// * empty string ("") - remove all filters
	// * `0:0:0:0:0:0:0:0/0` - allow only ipv6 addresses
	// * `192.168.1.0/24` - only allow ipv4 addresses from 192.168.1.1 to 192.168.1.254
	WaitAddress *string `mapstructure:"ip_wait_address"`
	// contains filtered or unexported fields
}

func (*WaitIpConfig) FlatMapstructure

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

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

func (*WaitIpConfig) GetIPNet

func (c *WaitIpConfig) GetIPNet() *net.IPNet

func (*WaitIpConfig) Prepare

func (c *WaitIpConfig) Prepare() []error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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