Documentation ¶
Index ¶
- Constants
- Variables
- func CommHost(state multistep.StateBag) (string, error)
- func MergeCloudUserMetaData(usersData ...string) (string, error)
- func StepHaltWithError(state multistep.StateBag, err error) multistep.StepAction
- type AccessConfig
- type Artifact
- type Builder
- type CloudConfig
- type CommonConfig
- type Config
- type DiskConfig
- type Driver
- type FlatConfig
- type Image
- type ImageConfig
- type InstanceConfig
- type NetworkConfig
- type SourceImageConfig
- type StepCreateInstance
- type StepInstanceInfo
- type StepTeardownInstance
Constants ¶
View Source
const BuilderID = "packer.yandex"
The unique ID for this builder.
View Source
const StandardImagesFolderID = "standard-images"
Variables ¶
View Source
var TemplateFuncs = template.FuncMap{
"clean_resource_name": templateCleanResourceName,
}
Functions ¶
func MergeCloudUserMetaData ¶
MergeCloudUserMetaData allow merge some user-data sections
func StepHaltWithError ¶
func StepHaltWithError(state multistep.StateBag, err error) multistep.StepAction
Types ¶
type AccessConfig ¶
type AccessConfig struct { // Non standard API endpoint. Default is `api.cloud.yandex.net:443`. Endpoint string `mapstructure:"endpoint" required:"false"` // Path to file with Service Account key in json format. This // is an alternative method to authenticate to Yandex.Cloud. Alternatively you may set environment variable // `YC_SERVICE_ACCOUNT_KEY_FILE`. ServiceAccountKeyFile string `mapstructure:"service_account_key_file" required:"false"` // [OAuth token](https://cloud.yandex.com/docs/iam/concepts/authorization/oauth-token) // or [IAM token](https://cloud.yandex.com/docs/iam/concepts/authorization/iam-token) // to use to authenticate to Yandex.Cloud. Alternatively you may set // value by environment variable `YC_TOKEN`. Token string `mapstructure:"token" required:"true"` // The maximum number of times an API request is being executed. MaxRetries int `mapstructure:"max_retries"` }
AccessConfig is for common configuration related to Yandex.Cloud API access
func (*AccessConfig) Prepare ¶
func (c *AccessConfig) Prepare(ctx *interpolate.Context) []error
type Artifact ¶
type Artifact struct { Image *compute.Image // StateData should store data such as GeneratedData // to be shared with post-processors StateData map[string]interface{} // contains filtered or unexported fields }
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder represents a Packer Builder.
func (*Builder) ConfigSpec ¶
func (b *Builder) ConfigSpec() hcldec.ObjectSpec
type CloudConfig ¶
type CloudConfig struct { // The folder ID that will be used to launch instances and store images. // Alternatively you may set value by environment variable `YC_FOLDER_ID`. // To use a different folder for looking up the source image or saving the target image to // check options 'source_image_folder_id' and 'target_image_folder_id'. FolderID string `mapstructure:"folder_id" required:"true"` }
func (*CloudConfig) Prepare ¶
func (c *CloudConfig) Prepare(errs *packersdk.MultiError) *packersdk.MultiError
type CommonConfig ¶
type CommonConfig struct { // File path to save serial port output of the launched instance. SerialLogFile string `mapstructure:"serial_log_file" required:"false"` // The time to wait for instance state changes. // Defaults to `5m`. StateTimeout time.Duration `mapstructure:"state_timeout" required:"false"` InstanceConfig `mapstructure:",squash"` DiskConfig `mapstructure:",squash"` NetworkConfig `mapstructure:",squash"` CloudConfig `mapstructure:",squash"` }
func (*CommonConfig) Prepare ¶
func (c *CommonConfig) Prepare(errs *packersdk.MultiError) *packersdk.MultiError
type Config ¶
type Config struct { common.PackerConfig `mapstructure:",squash"` Communicator communicator.Config `mapstructure:",squash"` AccessConfig `mapstructure:",squash"` CommonConfig `mapstructure:",squash"` ImageConfig `mapstructure:",squash"` SourceImageConfig `mapstructure:",squash"` // Service account identifier to assign to instance. ServiceAccountID string `mapstructure:"service_account_id" required:"false"` // The ID of the folder to save built image in. // This defaults to value of 'folder_id'. TargetImageFolderID string `mapstructure:"target_image_folder_id" required:"false"` // contains filtered or unexported fields }
func (*Config) FlatMapstructure ¶
FlatMapstructure returns a new FlatConfig. FlatConfig is an auto-generated flat version of Config. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
type DiskConfig ¶
type DiskConfig struct { // The name of the disk, if unset the instance name // will be used. DiskName string `mapstructure:"disk_name" required:"false"` // The size of the disk in GB. This defaults to 10/100GB. DiskSizeGb int `mapstructure:"disk_size_gb" required:"false"` // Specify disk type for the launched instance. Defaults to `network-ssd`. DiskType string `mapstructure:"disk_type" required:"false"` // Key/value pair labels to apply to the disk. DiskLabels map[string]string `mapstructure:"disk_labels" required:"false"` }
func (*DiskConfig) Prepare ¶
func (c *DiskConfig) Prepare(errs *packersdk.MultiError) *packersdk.MultiError
type Driver ¶
type Driver interface { DeleteImage(id string) error SDK() *ycsdk.SDK GetImage(imageID string) (*Image, error) GetImageFromFolder(ctx context.Context, folderID string, family string) (*Image, error) GetImageFromFolderByName(ctx context.Context, folderID string, name string) (*Image, error) DeleteDisk(ctx context.Context, diskID string) error DeleteInstance(ctx context.Context, instanceID string) error DeleteSubnet(ctx context.Context, subnetID string) error DeleteNetwork(ctx context.Context, networkID string) error GetInstanceMetadata(ctx context.Context, instanceID string, key string) (string, error) }
func NewDriverYC ¶
func NewDriverYC(ui packersdk.Ui, ac *AccessConfig) (Driver, error)
type FlatConfig ¶
type FlatConfig struct { PackerBuildName *string `mapstructure:"packer_build_name" cty:"packer_build_name" hcl:"packer_build_name"` PackerBuilderType *string `mapstructure:"packer_builder_type" cty:"packer_builder_type" hcl:"packer_builder_type"` PackerCoreVersion *string `mapstructure:"packer_core_version" cty:"packer_core_version" hcl:"packer_core_version"` PackerDebug *bool `mapstructure:"packer_debug" cty:"packer_debug" hcl:"packer_debug"` PackerForce *bool `mapstructure:"packer_force" cty:"packer_force" hcl:"packer_force"` PackerOnError *string `mapstructure:"packer_on_error" cty:"packer_on_error" hcl:"packer_on_error"` PackerUserVars map[string]string `mapstructure:"packer_user_variables" cty:"packer_user_variables" hcl:"packer_user_variables"` PackerSensitiveVars []string `mapstructure:"packer_sensitive_variables" cty:"packer_sensitive_variables" hcl:"packer_sensitive_variables"` Type *string `mapstructure:"communicator" cty:"communicator" hcl:"communicator"` PauseBeforeConnect *string `mapstructure:"pause_before_connecting" cty:"pause_before_connecting" hcl:"pause_before_connecting"` SSHHost *string `mapstructure:"ssh_host" cty:"ssh_host" hcl:"ssh_host"` SSHPort *int `mapstructure:"ssh_port" cty:"ssh_port" hcl:"ssh_port"` SSHUsername *string `mapstructure:"ssh_username" cty:"ssh_username" hcl:"ssh_username"` SSHPassword *string `mapstructure:"ssh_password" cty:"ssh_password" hcl:"ssh_password"` SSHKeyPairName *string `mapstructure:"ssh_keypair_name" undocumented:"true" cty:"ssh_keypair_name" hcl:"ssh_keypair_name"` SSHTemporaryKeyPairName *string `mapstructure:"temporary_key_pair_name" undocumented:"true" cty:"temporary_key_pair_name" hcl:"temporary_key_pair_name"` SSHTemporaryKeyPairType *string `mapstructure:"temporary_key_pair_type" cty:"temporary_key_pair_type" hcl:"temporary_key_pair_type"` SSHTemporaryKeyPairBits *int `mapstructure:"temporary_key_pair_bits" cty:"temporary_key_pair_bits" hcl:"temporary_key_pair_bits"` SSHCiphers []string `mapstructure:"ssh_ciphers" cty:"ssh_ciphers" hcl:"ssh_ciphers"` SSHClearAuthorizedKeys *bool `mapstructure:"ssh_clear_authorized_keys" cty:"ssh_clear_authorized_keys" hcl:"ssh_clear_authorized_keys"` SSHKEXAlgos []string `mapstructure:"ssh_key_exchange_algorithms" cty:"ssh_key_exchange_algorithms" hcl:"ssh_key_exchange_algorithms"` SSHPrivateKeyFile *string `mapstructure:"ssh_private_key_file" undocumented:"true" cty:"ssh_private_key_file" hcl:"ssh_private_key_file"` SSHCertificateFile *string `mapstructure:"ssh_certificate_file" cty:"ssh_certificate_file" hcl:"ssh_certificate_file"` SSHPty *bool `mapstructure:"ssh_pty" cty:"ssh_pty" hcl:"ssh_pty"` SSHTimeout *string `mapstructure:"ssh_timeout" cty:"ssh_timeout" hcl:"ssh_timeout"` SSHWaitTimeout *string `mapstructure:"ssh_wait_timeout" undocumented:"true" cty:"ssh_wait_timeout" hcl:"ssh_wait_timeout"` SSHAgentAuth *bool `mapstructure:"ssh_agent_auth" undocumented:"true" cty:"ssh_agent_auth" hcl:"ssh_agent_auth"` SSHDisableAgentForwarding *bool `mapstructure:"ssh_disable_agent_forwarding" cty:"ssh_disable_agent_forwarding" hcl:"ssh_disable_agent_forwarding"` SSHHandshakeAttempts *int `mapstructure:"ssh_handshake_attempts" cty:"ssh_handshake_attempts" hcl:"ssh_handshake_attempts"` SSHBastionHost *string `mapstructure:"ssh_bastion_host" cty:"ssh_bastion_host" hcl:"ssh_bastion_host"` SSHBastionPort *int `mapstructure:"ssh_bastion_port" cty:"ssh_bastion_port" hcl:"ssh_bastion_port"` SSHBastionAgentAuth *bool `mapstructure:"ssh_bastion_agent_auth" cty:"ssh_bastion_agent_auth" hcl:"ssh_bastion_agent_auth"` SSHBastionUsername *string `mapstructure:"ssh_bastion_username" cty:"ssh_bastion_username" hcl:"ssh_bastion_username"` SSHBastionPassword *string `mapstructure:"ssh_bastion_password" cty:"ssh_bastion_password" hcl:"ssh_bastion_password"` SSHBastionInteractive *bool `mapstructure:"ssh_bastion_interactive" cty:"ssh_bastion_interactive" hcl:"ssh_bastion_interactive"` SSHBastionPrivateKeyFile *string `mapstructure:"ssh_bastion_private_key_file" cty:"ssh_bastion_private_key_file" hcl:"ssh_bastion_private_key_file"` SSHBastionCertificateFile *string `mapstructure:"ssh_bastion_certificate_file" cty:"ssh_bastion_certificate_file" hcl:"ssh_bastion_certificate_file"` SSHFileTransferMethod *string `mapstructure:"ssh_file_transfer_method" cty:"ssh_file_transfer_method" hcl:"ssh_file_transfer_method"` SSHProxyHost *string `mapstructure:"ssh_proxy_host" cty:"ssh_proxy_host" hcl:"ssh_proxy_host"` SSHProxyPort *int `mapstructure:"ssh_proxy_port" cty:"ssh_proxy_port" hcl:"ssh_proxy_port"` SSHProxyUsername *string `mapstructure:"ssh_proxy_username" cty:"ssh_proxy_username" hcl:"ssh_proxy_username"` SSHProxyPassword *string `mapstructure:"ssh_proxy_password" cty:"ssh_proxy_password" hcl:"ssh_proxy_password"` SSHKeepAliveInterval *string `mapstructure:"ssh_keep_alive_interval" cty:"ssh_keep_alive_interval" hcl:"ssh_keep_alive_interval"` SSHReadWriteTimeout *string `mapstructure:"ssh_read_write_timeout" cty:"ssh_read_write_timeout" hcl:"ssh_read_write_timeout"` SSHRemoteTunnels []string `mapstructure:"ssh_remote_tunnels" cty:"ssh_remote_tunnels" hcl:"ssh_remote_tunnels"` SSHLocalTunnels []string `mapstructure:"ssh_local_tunnels" cty:"ssh_local_tunnels" hcl:"ssh_local_tunnels"` SSHPublicKey []byte `mapstructure:"ssh_public_key" undocumented:"true" cty:"ssh_public_key" hcl:"ssh_public_key"` SSHPrivateKey []byte `mapstructure:"ssh_private_key" undocumented:"true" cty:"ssh_private_key" hcl:"ssh_private_key"` WinRMUser *string `mapstructure:"winrm_username" cty:"winrm_username" hcl:"winrm_username"` WinRMPassword *string `mapstructure:"winrm_password" cty:"winrm_password" hcl:"winrm_password"` WinRMHost *string `mapstructure:"winrm_host" cty:"winrm_host" hcl:"winrm_host"` WinRMNoProxy *bool `mapstructure:"winrm_no_proxy" cty:"winrm_no_proxy" hcl:"winrm_no_proxy"` WinRMPort *int `mapstructure:"winrm_port" cty:"winrm_port" hcl:"winrm_port"` WinRMTimeout *string `mapstructure:"winrm_timeout" cty:"winrm_timeout" hcl:"winrm_timeout"` WinRMUseSSL *bool `mapstructure:"winrm_use_ssl" cty:"winrm_use_ssl" hcl:"winrm_use_ssl"` WinRMInsecure *bool `mapstructure:"winrm_insecure" cty:"winrm_insecure" hcl:"winrm_insecure"` WinRMUseNTLM *bool `mapstructure:"winrm_use_ntlm" cty:"winrm_use_ntlm" hcl:"winrm_use_ntlm"` Endpoint *string `mapstructure:"endpoint" required:"false" cty:"endpoint" hcl:"endpoint"` ServiceAccountKeyFile *string `mapstructure:"service_account_key_file" required:"false" cty:"service_account_key_file" hcl:"service_account_key_file"` Token *string `mapstructure:"token" required:"true" cty:"token" hcl:"token"` MaxRetries *int `mapstructure:"max_retries" cty:"max_retries" hcl:"max_retries"` SerialLogFile *string `mapstructure:"serial_log_file" required:"false" cty:"serial_log_file" hcl:"serial_log_file"` StateTimeout *string `mapstructure:"state_timeout" required:"false" cty:"state_timeout" hcl:"state_timeout"` InstanceCores *int `mapstructure:"instance_cores" required:"false" cty:"instance_cores" hcl:"instance_cores"` InstanceGpus *int `mapstructure:"instance_gpus" required:"false" cty:"instance_gpus" hcl:"instance_gpus"` InstanceMemory *int `mapstructure:"instance_mem_gb" required:"false" cty:"instance_mem_gb" hcl:"instance_mem_gb"` InstanceName *string `mapstructure:"instance_name" required:"false" cty:"instance_name" hcl:"instance_name"` PlatformID *string `mapstructure:"platform_id" required:"false" cty:"platform_id" hcl:"platform_id"` Labels map[string]string `mapstructure:"labels" required:"false" cty:"labels" hcl:"labels"` Metadata map[string]string `mapstructure:"metadata" required:"false" cty:"metadata" hcl:"metadata"` MetadataFromFile map[string]string `mapstructure:"metadata_from_file" cty:"metadata_from_file" hcl:"metadata_from_file"` Preemptible *bool `mapstructure:"preemptible" cty:"preemptible" hcl:"preemptible"` DiskName *string `mapstructure:"disk_name" required:"false" cty:"disk_name" hcl:"disk_name"` DiskSizeGb *int `mapstructure:"disk_size_gb" required:"false" cty:"disk_size_gb" hcl:"disk_size_gb"` DiskType *string `mapstructure:"disk_type" required:"false" cty:"disk_type" hcl:"disk_type"` DiskLabels map[string]string `mapstructure:"disk_labels" required:"false" cty:"disk_labels" hcl:"disk_labels"` SubnetID *string `mapstructure:"subnet_id" required:"false" cty:"subnet_id" hcl:"subnet_id"` Zone *string `mapstructure:"zone" required:"false" cty:"zone" hcl:"zone"` UseIPv4Nat *bool `mapstructure:"use_ipv4_nat" required:"false" cty:"use_ipv4_nat" hcl:"use_ipv4_nat"` UseIPv6 *bool `mapstructure:"use_ipv6" required:"false" cty:"use_ipv6" hcl:"use_ipv6"` UseInternalIP *bool `mapstructure:"use_internal_ip" required:"false" cty:"use_internal_ip" hcl:"use_internal_ip"` FolderID *string `mapstructure:"folder_id" required:"true" cty:"folder_id" hcl:"folder_id"` ImageName *string `mapstructure:"image_name" required:"false" cty:"image_name" hcl:"image_name"` ImageDescription *string `mapstructure:"image_description" required:"false" cty:"image_description" hcl:"image_description"` ImageFamily *string `mapstructure:"image_family" required:"false" cty:"image_family" hcl:"image_family"` ImageLabels map[string]string `mapstructure:"image_labels" required:"false" cty:"image_labels" hcl:"image_labels"` ImageMinDiskSizeGb *int `mapstructure:"image_min_disk_size_gb" required:"false" cty:"image_min_disk_size_gb" hcl:"image_min_disk_size_gb"` ImageProductIDs []string `mapstructure:"image_product_ids" required:"false" cty:"image_product_ids" hcl:"image_product_ids"` ImagePooled *bool `mapstructure:"image_pooled" required:"false" cty:"image_pooled" hcl:"image_pooled"` SkipCreateImage *bool `mapstructure:"skip_create_image" required:"false" cty:"skip_create_image" hcl:"skip_create_image"` SourceImageFamily *string `mapstructure:"source_image_family" required:"true" cty:"source_image_family" hcl:"source_image_family"` SourceImageFolderID *string `mapstructure:"source_image_folder_id" required:"false" cty:"source_image_folder_id" hcl:"source_image_folder_id"` SourceImageID *string `mapstructure:"source_image_id" required:"false" cty:"source_image_id" hcl:"source_image_id"` SourceImageName *string `mapstructure:"source_image_name" cty:"source_image_name" hcl:"source_image_name"` ServiceAccountID *string `mapstructure:"service_account_id" required:"false" cty:"service_account_id" hcl:"service_account_id"` TargetImageFolderID *string `mapstructure:"target_image_folder_id" required:"false" cty:"target_image_folder_id" hcl:"target_image_folder_id"` }
FlatConfig is an auto-generated flat version of Config. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
type ImageConfig ¶
type ImageConfig struct { // The name of the resulting image, which contains 1-63 characters and only // supports lowercase English characters, numbers and hyphen. Defaults to // `packer-{{timestamp}}`. ImageName string `mapstructure:"image_name" required:"false"` // The description of the image. ImageDescription string `mapstructure:"image_description" required:"false"` // The family name of the image. ImageFamily string `mapstructure:"image_family" required:"false"` // Key/value pair labels to apply to the image. ImageLabels map[string]string `mapstructure:"image_labels" required:"false"` // Minimum size of the disk that will be created from built image, specified in gigabytes. // Should be more or equal to `disk_size_gb`. ImageMinDiskSizeGb int `mapstructure:"image_min_disk_size_gb" required:"false"` // License IDs that indicate which licenses are attached to resulting image. ImageProductIDs []string `mapstructure:"image_product_ids" required:"false"` // When true, an image pool will be created for fast creation disks from the image. ImagePooled bool `mapstructure:"image_pooled" required:"false"` // Skip creating the image. Useful for setting to `true` during a build test stage. Defaults to `false`. SkipCreateImage bool `mapstructure:"skip_create_image" required:"false"` }
func (*ImageConfig) Prepare ¶
func (c *ImageConfig) Prepare(errs *packersdk.MultiError) *packersdk.MultiError
type InstanceConfig ¶
type InstanceConfig struct { // The number of cores available to the instance. InstanceCores int `mapstructure:"instance_cores" required:"false"` // The number of GPU available to the instance. InstanceGpus int `mapstructure:"instance_gpus" required:"false"` // The amount of memory available to the instance, specified in gigabytes. InstanceMemory int `mapstructure:"instance_mem_gb" required:"false"` // The name assigned to the instance. InstanceName string `mapstructure:"instance_name" required:"false"` // Identifier of the hardware platform configuration for the instance. This defaults to `standard-v2`. PlatformID string `mapstructure:"platform_id" required:"false"` // Key/value pair labels to apply to the launched instance. Labels map[string]string `mapstructure:"labels" required:"false"` // Metadata applied to the launched instance. Metadata map[string]string `mapstructure:"metadata" required:"false"` // Metadata applied to the launched instance. // The values in this map are the paths to the content files for the corresponding metadata keys. MetadataFromFile map[string]string `mapstructure:"metadata_from_file"` // Launch a preemptible instance. This defaults to `false`. Preemptible bool `mapstructure:"preemptible"` }
func (*InstanceConfig) Prepare ¶
func (c *InstanceConfig) Prepare(errs *packersdk.MultiError) *packersdk.MultiError
type NetworkConfig ¶
type NetworkConfig struct { // The Yandex VPC subnet id to use for // the launched instance. Note, the zone of the subnet must match the // zone in which the VM is launched. SubnetID string `mapstructure:"subnet_id" required:"false"` // The name of the zone to launch the instance. This defaults to `ru-central1-a`. Zone string `mapstructure:"zone" required:"false"` // If set to true, then launched instance will have external internet // access. UseIPv4Nat bool `mapstructure:"use_ipv4_nat" required:"false"` // Set to true to enable IPv6 for the instance being // created. This defaults to `false`, or not enabled. // // -> **Note**: Usage of IPv6 will be available in the future. UseIPv6 bool `mapstructure:"use_ipv6" required:"false"` // If true, use the instance's internal IP address // instead of its external IP during building. UseInternalIP bool `mapstructure:"use_internal_ip" required:"false"` }
func (*NetworkConfig) Prepare ¶
func (c *NetworkConfig) Prepare(errs *packersdk.MultiError) *packersdk.MultiError
type SourceImageConfig ¶
type SourceImageConfig struct { // The source image family to create the new image // from. You can also specify source_image_id instead. Just one of a source_image_id or // source_image_family must be specified. Example: `ubuntu-1804-lts`. SourceImageFamily string `mapstructure:"source_image_family" required:"true"` // The ID of the folder containing the source image. SourceImageFolderID string `mapstructure:"source_image_folder_id" required:"false"` // The source image ID to use to create the new image from. SourceImageID string `mapstructure:"source_image_id" required:"false"` // The source image name to use to create the new image // from. Name will be looked up in `source_image_folder_id`. SourceImageName string `mapstructure:"source_image_name"` }
func (*SourceImageConfig) Prepare ¶
func (c *SourceImageConfig) Prepare(errs *packersdk.MultiError) *packersdk.MultiError
type StepCreateInstance ¶
type StepCreateInstance struct { Debug bool SerialLogFile string GeneratedData *packerbuilderdata.GeneratedData }
func (*StepCreateInstance) Cleanup ¶
func (s *StepCreateInstance) Cleanup(state multistep.StateBag)
func (*StepCreateInstance) Run ¶
func (s *StepCreateInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepInstanceInfo ¶
type StepInstanceInfo struct{}
func (*StepInstanceInfo) Cleanup ¶
func (s *StepInstanceInfo) Cleanup(state multistep.StateBag)
func (*StepInstanceInfo) Run ¶
func (s *StepInstanceInfo) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
type StepTeardownInstance ¶
type StepTeardownInstance struct {
SerialLogFile string
}
func (*StepTeardownInstance) Cleanup ¶
func (s *StepTeardownInstance) Cleanup(state multistep.StateBag)
func (*StepTeardownInstance) Run ¶
func (s *StepTeardownInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction
Click to show internal directories.
Click to hide internal directories.