config

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultSSHUsername           = "packer"
	DefaultZone                  = mws.DefaultZone
	DefaultImageDescription      = "Image created by Packer"
	DefaultDiskType              = "nbs-pl2"
	DefaultDiskIOPS              = int64(1000)
	DefaultSubnetCidr            = "192.168.0.0/16"
	DefaultIPV6Prefix            = "64:ff9b::/96"
	DefaultVMType                = "gen-2-8"
	DefaultCleanupTimeout        = time.Hour
	DefaultObjectStorageRegion   = "ru-central1"
	DefaultObjectStorageEndpoint = "https://storage.mwsapis.ru"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessConfig

type AccessConfig struct {
	// The project identifier where resources will be created.
	Project string `mapstructure:"project" required:"true"`
	// The zone in which the VM will be created (defaults to "ru-central1-a")
	Zone string `mapstructure:"zone" required:"false"`

	// MWS Cloud Platform API base endpoint (defaults to "https://api.mwsapis.ru").
	// Can be specified using the `MWS_BASE_ENDPOINT` environment variable.
	BaseEndpoint string `mapstructure:"base_endpoint" required:"false"`
	// Path to the service account authorized key file used for authentication.
	// Has no effect if IAM token is set.
	// Can be specified using the `MWS_SERVICE_ACCOUNT_AUTHORIZED_KEY_PATH` environment variable.
	ServiceAccountAuthorizedKeyPath string `mapstructure:"service_account_authorized_key_path" required:"false"`
	// IAM token used for authentication.
	// Can be specified using the `MWS_TOKEN` environment variable.
	Token string `mapstructure:"token" required:"false"`
}

func (*AccessConfig) SetDefaults

func (c *AccessConfig) SetDefaults()

func (*AccessConfig) Validate

func (c *AccessConfig) Validate() error

type DiskConfig

type DiskConfig struct {
	// Name for the disk (defaults to "packer-{{uuid}}-disk").
	DiskName string `mapstructure:"disk_name" required:"false"`
	// Type of disk to create (defaults to "nbs-pl2").
	DiskType string `mapstructure:"disk_type" required:"false"`
	// Size of the disk (defaults to source minDiskSize, in export post-processor minDiskSize of image_for_export is added).
	DiskSize string `mapstructure:"disk_size" required:"false"`
	// IOPS for the disk (defaults to 1000).
	DiskIOPS int64 `mapstructure:"disk_iops" required:"false"`
	// Project ID where the source_image/source_disk_backup exists (defaults to the `project`).
	SourceProject string `mapstructure:"source_project" required:"false"`
	// ID of an existing image to use as a base (required unless using `source_disk_backup`).
	SourceImage string `mapstructure:"source_image" required:"false"`
	// ID of an existing disk backup to use as a base (required unless using `source_image`).
	SourceDiskBackup string `mapstructure:"source_disk_backup" required:"false"`
}

func (*DiskConfig) SetDefaults

func (c *DiskConfig) SetDefaults()

func (*DiskConfig) Validate

func (c *DiskConfig) Validate() error

type DiskForExportConfig added in v0.6.0

type DiskForExportConfig struct {
	// Type of the disk used for image export (defaults to "nbs-pl2").
	DiskForExportType string `mapstructure:"disk_for_export_type" required:"false"`
	// IOPS for the disk used for image export (defaults to 1000).
	DiskForExportIOPS int64 `mapstructure:"disk_for_export_iops" required:"false"`
	// The project identifier where the image for export exists (defaults to the `project`).
	ImageForExportProject string `mapstructure:"image_for_export_project" required:"false"`
	// Identifier of the image to export. Required only when post processor used
	// without mws builder.
	ImageForExport string `mapstructure:"image_for_export" required:"false"`
}

func (*DiskForExportConfig) SetDefaults added in v0.6.0

func (c *DiskForExportConfig) SetDefaults()

func (*DiskForExportConfig) Validate added in v0.6.0

func (c *DiskForExportConfig) Validate() error

type ImageConfig

type ImageConfig struct {
	// Name for the resulting image (defaults to "packer-{{uuid}}-image").
	ImageName string `mapstructure:"image_name" required:"false"`
	// Display name for the resulting image (defaults to the `image_name`).
	ImageDisplayName string `mapstructure:"image_display_name" required:"false"`
	// Description for the resulting image. (defaults to "Image created by Packer").
	ImageDescription string `mapstructure:"image_description" required:"false"`
}

func (*ImageConfig) SetDefaults

func (c *ImageConfig) SetDefaults()

func (*ImageConfig) Validate

func (c *ImageConfig) Validate() error

type NetworkConfig

type NetworkConfig struct {
	// Name for the network (defaults to "packer-{{uuid}}-network").
	// If specified, Packer will use existing network.
	NetworkName string `mapstructure:"network_name" required:"false"`
	// Name for the subnet (defaults to "packer-{{uuid}}-subnet").
	// If specified, Packer will use existing subnet.
	SubnetName string `mapstructure:"subnet_name" required:"false"`
	// Subnet CIDR (defaults to "192.168.0.0/16").
	SubnetCidr string `mapstructure:"subnet_cidr" required:"false"`
	// Use external address for connection to virtual machine from internet (defaults to "false").
	UseExternalAddress bool `mapstructure:"use_external_address" required:"false"`
	// External address name (defaults to "packer-{{uuid}}-external-address").
	// Can be specified only if external address usage is enabled.
	ExternalAddressName string `mapstructure:"external_address_name" required:"false"`
	// Enables virtual machine ip conversion from ipv4 to ipv6 with RFC 6052 (defaults to "false").
	// Meant to be used when packer is in ipv6 only network.
	Nat64Enable bool `mapstructure:"nat64_enable" required:"false"`
	// Prefix used in nat64 conversion (defaults to "64:ff9b::/96" (RFC 6052 Well-Known Prefix)).
	// CIDR notation only.
	Nat64IPV6Prefix string `mapstructure:"nat64_ipv6_prefix" required:"false"`
}

func (*NetworkConfig) SetDefaults

func (c *NetworkConfig) SetDefaults()

func (*NetworkConfig) Validate

func (c *NetworkConfig) Validate() error

type ObjectStorageConfig added in v0.6.0

type ObjectStorageConfig struct {
	// MWS Cloud Platform Service Account used for generating temporal HMAC key
	// to access Object Storage. Required, unless `access_key` and `secret_key`
	// are provided.
	ServiceAccount string `mapstructure:"service_account" required:"false"`

	// HMAC key identifier for authenticating with Object Storage. Used if
	// `service_account` is not provided. Also requires `secret_key` to be
	// provided.
	AccessKey string `mapstructure:"access_key" required:"false"`
	// HMAC key secret for accessing Object Storage. Required if `access_key` is
	// provided.
	SecretKey string `mapstructure:"secret_key" required:"false"`

	// MWS Cloud Platform Object Storage endpoint (defaults to "https://storage.mwsapis.ru").
	ObjectStorageEndpoint string `mapstructure:"object_storage_endpoint" required:"false"`
	// MWS Cloud Platform Object Storage region where the bucket is located (defaults to "ru-central1").
	ObjectStorageRegion string `mapstructure:"object_storage_region" required:"false"`
}

func (*ObjectStorageConfig) SetDefaults added in v0.6.0

func (c *ObjectStorageConfig) SetDefaults()

func (*ObjectStorageConfig) Validate added in v0.6.0

func (c *ObjectStorageConfig) Validate() error

type VirtualMachineConfig

type VirtualMachineConfig struct {
	DiskConfig    `mapstructure:",squash"`
	NetworkConfig `mapstructure:",squash"`
	// Name for the temporary build VM (defaults to "packer-{{uuid}}-vm").
	VirtualMachineName string `mapstructure:"virtual_machine_name" required:"false"`
	// The VM type (defaults to "gen-2-8").
	VMType string `mapstructure:"vm_type" required:"false"`

	// Configuration script for initial setup of a virtual machine in the
	// [#cloud-config](https://docs.cloud-init.io/en/latest/explanation/format/cloud-config.html)
	// format. Note that this configuration would be extended with SSH key used
	// for Packer communicator.
	CloudConfig string `mapstructure:"cloud_config" required:"false"`

	// Service account can be connected to virtual machine so that applications and scripts
	// on a virtual machine can work with MWS Cloud Platform services.
	VMServiceAccount string `mapstructure:"vm_service_account" required:"false"`

	// File path to save virtual machine serial port output.
	SerialConsoleLogFile string `mapstructure:"serial_console_log_file" required:"false"`

	// Timeout for resources cleanup (defaults to "1h").
	CleanupTimeout time.Duration `mapstructure:"cleanup_timeout" required:"false"`
}

func (*VirtualMachineConfig) SetDefaults

func (c *VirtualMachineConfig) SetDefaults()

func (*VirtualMachineConfig) Validate

func (c *VirtualMachineConfig) Validate() error

Jump to

Keyboard shortcuts

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