ecs

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2019 License: MPL-2.0 Imports: 28 Imported by: 0

Documentation

Overview

The alicloud contains a packer.Builder implementation that builds ecs images for alicloud.

Code generated by "mapstructure-to-hcl2 -type Config,AlicloudDiskDevice"; DO NOT EDIT.

Index

Constants

View Source
const (
	ALICLOUD_DEFAULT_SHORT_TIMEOUT = 180
	ALICLOUD_DEFAULT_TIMEOUT       = 1800
	ALICLOUD_DEFAULT_LONG_TIMEOUT  = 3600
)
View Source
const (
	InstanceStatusRunning  = "Running"
	InstanceStatusStarting = "Starting"
	InstanceStatusStopped  = "Stopped"
	InstanceStatusStopping = "Stopping"
)
View Source
const (
	ImageStatusWaiting      = "Waiting"
	ImageStatusCreating     = "Creating"
	ImageStatusCreateFailed = "CreateFailed"
	ImageStatusAvailable    = "Available"
)
View Source
const (
	SnapshotStatusAll          = "all"
	SnapshotStatusProgressing  = "progressing"
	SnapshotStatusAccomplished = "accomplished"
	SnapshotStatusFailed       = "failed"
)
View Source
const (
	DiskStatusInUse     = "In_use"
	DiskStatusAvailable = "Available"
	DiskStatusAttaching = "Attaching"
	DiskStatusDetaching = "Detaching"
	DiskStatusCreating  = "Creating"
	DiskStatusReIniting = "ReIniting"
)
View Source
const (
	VpcStatusPending   = "Pending"
	VpcStatusAvailable = "Available"
)
View Source
const (
	VSwitchStatusPending   = "Pending"
	VSwitchStatusAvailable = "Available"
)
View Source
const (
	EipStatusAssociating   = "Associating"
	EipStatusUnassociating = "Unassociating"
	EipStatusInUse         = "InUse"
	EipStatusAvailable     = "Available"
)
View Source
const (
	ImageOwnerSystem      = "system"
	ImageOwnerSelf        = "self"
	ImageOwnerOthers      = "others"
	ImageOwnerMarketplace = "marketplace"
)
View Source
const (
	IOOptimizedNone      = "none"
	IOOptimizedOptimized = "optimized"
)
View Source
const (
	InstanceNetworkClassic = "classic"
	InstanceNetworkVpc     = "vpc"
)
View Source
const (
	DiskTypeSystem = "system"
	DiskTypeData   = "data"
)
View Source
const (
	TagResourceImage    = "image"
	TagResourceInstance = "instance"
	TagResourceSnapshot = "snapshot"
	TagResourceDisk     = "disk"
)
View Source
const (
	IpProtocolAll  = "all"
	IpProtocolTCP  = "tcp"
	IpProtocolUDP  = "udp"
	IpProtocolICMP = "icmp"
	IpProtocolGRE  = "gre"
)
View Source
const (
	NicTypeInternet = "internet"
	NicTypeIntranet = "intranet"
)
View Source
const (
	DefaultPortRange = "-1/-1"
	DefaultCidrIp    = "0.0.0.0/0"
	DefaultCidrBlock = "172.16.0.0/24"
)
View Source
const (
	EvalRetryErrorType    = EvalErrorType(true)
	EvalNotRetryErrorType = EvalErrorType(false)
)
View Source
const BuilderId = "alibaba.alicloud"

The unique ID for this builder

View Source
const DefaultRequestReadTimeout = 10 * time.Second
View Source
const Packer = "HashiCorp-Packer"

Variables

View Source
var (
	WaitForExpectSuccess = WaitForExpectEvalResult{
							// contains filtered or unexported fields
	}

	WaitForExpectToRetry = WaitForExpectEvalResult{
							// contains filtered or unexported fields
	}

	WaitForExpectFailToStop = WaitForExpectEvalResult{
							// contains filtered or unexported fields
	}
)

Functions

func ContainsInArray added in v1.4.1

func ContainsInArray(arr []string, value string) bool

func SSHHost

func SSHHost(e alicloudSSHHelper, private bool) func(multistep.StateBag) (string, error)

SSHHost returns a function that can be given to the SSH communicator

Types

type AlicloudAccessConfig

type AlicloudAccessConfig struct {
	// This is the Alicloud access key. It must be provided, but it can also be
	// sourced from the ALICLOUD_ACCESS_KEY environment variable.
	AlicloudAccessKey string `mapstructure:"access_key" required:"true"`
	// This is the Alicloud secret key. It must be provided, but it can also be
	// sourced from the ALICLOUD_SECRET_KEY environment variable.
	AlicloudSecretKey string `mapstructure:"secret_key" required:"true"`
	// This is the Alicloud region. It must be provided, but it can also be
	// sourced from the ALICLOUD_REGION environment variables.
	AlicloudRegion string `mapstructure:"region" required:"true"`
	// The region validation can be skipped if this value is true, the default
	// value is false.
	AlicloudSkipValidation bool `mapstructure:"skip_region_validation" required:"false"`
	// The image validation can be skipped if this value is true, the default
	// value is false.
	AlicloudSkipImageValidation bool `mapstructure:"skip_image_validation" required:"false"`
	// STS access token, can be set through template or by exporting as
	// environment variable such as `export SECURITY_TOKEN=value`.
	SecurityToken string `mapstructure:"security_token" required:"false"`
	// contains filtered or unexported fields
}

Config of alicloud

func (*AlicloudAccessConfig) Client

func (c *AlicloudAccessConfig) Client() (*ClientWrapper, error)

Client for AlicloudClient

func (*AlicloudAccessConfig) Config

func (c *AlicloudAccessConfig) Config() error

func (*AlicloudAccessConfig) Prepare

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

func (*AlicloudAccessConfig) ValidateRegion added in v1.4.1

func (c *AlicloudAccessConfig) ValidateRegion(region string) error

type AlicloudDiskDevice

type AlicloudDiskDevice struct {
	// The value of disk name is blank by default. [2,
	// 128] English or Chinese characters, must begin with an
	// uppercase/lowercase letter or Chinese character. Can contain numbers,
	// ., _ and -. The disk name will appear on the console. It cannot
	// begin with http:// or https://.
	DiskName string `mapstructure:"disk_name" required:"false"`
	// Category of the system disk. Optional values
	// are:
	//     -   cloud - general cloud disk
	//     -   cloud_efficiency - efficiency cloud disk
	//     -   cloud_ssd - cloud SSD
	DiskCategory string `mapstructure:"disk_category" required:"false"`
	// Size of the system disk, measured in GiB. Value
	// range: [20, 500]. The specified value must be equal to or greater
	// than max{20, ImageSize}. Default value: max{40, ImageSize}.
	DiskSize int `mapstructure:"disk_size" required:"false"`
	// Snapshots are used to create the data
	// disk After this parameter is specified, Size is ignored. The actual
	// size of the created disk is the size of the specified snapshot.
	SnapshotId string `mapstructure:"disk_snapshot_id" required:"false"`
	// The value of disk description is blank by
	// default. [2, 256] characters. The disk description will appear on the
	// console. It cannot begin with http:// or https://.
	Description string `mapstructure:"disk_description" required:"false"`
	// Whether or not the disk is
	// released along with the instance:
	DeleteWithInstance bool `mapstructure:"disk_delete_with_instance" required:"false"`
	// Device information of the related instance:
	// such as /dev/xvdb It is null unless the Status is In_use.
	Device string `mapstructure:"disk_device" required:"false"`
	// Whether or not to encrypt the data disk.
	// If this option is set to true, the data disk will be encryped and corresponding snapshot in the target image will also be encrypted. By
	// default, if this is an extra data disk, Packer will not encrypt the
	// data disk. Otherwise, Packer will keep the encryption setting to what
	// it was in the source image. Please refer to Introduction of ECS disk encryption
	// for more details.
	Encrypted config.Trilean `mapstructure:"disk_encrypted" required:"false"`
}

func (*AlicloudDiskDevice) FlatMapstructure added in v1.4.5

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

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

type AlicloudDiskDevices

type AlicloudDiskDevices struct {
	// Image disk mapping for system
	// disk.
	// -   `disk_category` (string) - Category of the system disk. Optional values
	//     are:
	//         -   `cloud` - general cloud disk
	//         -   `cloud_efficiency` - efficiency cloud disk
	//         -   `cloud_ssd` - cloud SSD
	//
	//         For phased-out instance types and non-I/O optimized instances, the
	//         default value is cloud. Otherwise, the default value is
	//         cloud\_efficiency.
	//
	// -   `disk_description` (string) - The value of disk description is blank by
	//     default. \[2, 256\] characters. The disk description will appear on the
	//     console. It cannot begin with `http://` or `https://`.
	//
	// -   `disk_name` (string) - The value of disk name is blank by default. \[2,
	//     128\] English or Chinese characters, must begin with an
	//     uppercase/lowercase letter or Chinese character. Can contain numbers,
	//     `.`, `_` and `-`. The disk name will appear on the console. It cannot
	//     begin with `http://` or `https://`.
	//
	// -   `disk_size` (number) - Size of the system disk, measured in GiB. Value
	//     range: \[20, 500\]. The specified value must be equal to or greater
	//     than max{20, ImageSize}. Default value: max{40, ImageSize}.
	//
	ECSSystemDiskMapping AlicloudDiskDevice `mapstructure:"system_disk_mapping" required:"false"`
	// Add one or more data
	// disks to the image.
	//
	// -   `disk_category` (string) - Category of the data disk. Optional values
	//     are:
	//     -   `cloud` - general cloud disk
	//     -   `cloud_efficiency` - efficiency cloud disk
	//     -   `cloud_ssd` - cloud SSD
	//
	//     Default value: cloud.
	//
	// -   `disk_delete_with_instance` (boolean) - Whether or not the disk is
	//     released along with the instance:
	//     -   True indicates that when the instance is released, this disk will
	//         be released with it
	//     -   False indicates that when the instance is released, this disk will
	//         be retained.
	// -   `disk_description` (string) - The value of disk description is blank by
	//     default. \[2, 256\] characters. The disk description will appear on the
	//     console. It cannot begin with `http://` or `https://`.
	//
	// -   `disk_device` (string) - Device information of the related instance:
	//     such as `/dev/xvdb` It is null unless the Status is In\_use.
	//
	// -   `disk_name` (string) - The value of disk name is blank by default. \[2,
	//     128\] English or Chinese characters, must begin with an
	//     uppercase/lowercase letter or Chinese character. Can contain numbers,
	//     `.`, `_` and `-`. The disk name will appear on the console. It cannot
	//     begin with `http://` or `https://`.
	//
	// -   `disk_size` (number) - Size of the data disk, in GB, values range:
	//     -   `cloud` - 5 \~ 2000
	//     -   `cloud_efficiency` - 20 \~ 2048
	//     -   `cloud_ssd` - 20 \~ 2048
	//
	//     The value should be equal to or greater than the size of the specific
	//     SnapshotId.
	//
	// -   `disk_snapshot_id` (string) - Snapshots are used to create the data
	//     disk After this parameter is specified, Size is ignored. The actual
	//     size of the created disk is the size of the specified snapshot.
	//
	//     Snapshots from on or before July 15, 2013 cannot be used to create a
	//     disk.
	//
	// -   `disk_encrypted` (boolean) - Whether or not to encrypt the data disk.
	//     If this option is set to true, the data disk will be encryped and corresponding snapshot in the target image will also be encrypted. By
	//     default, if this is an extra data disk, Packer will not encrypt the
	//     data disk. Otherwise, Packer will keep the encryption setting to what
	//     it was in the source image. Please refer to Introduction of [ECS disk encryption](https://www.alibabacloud.com/help/doc-detail/59643.htm)
	//     for more details.
	//
	ECSImagesDiskMappings []AlicloudDiskDevice `mapstructure:"image_disk_mappings" required:"false"`
}

type AlicloudImageConfig

type AlicloudImageConfig struct {
	// The name of the user-defined image, [2, 128]
	// English or Chinese characters. It must begin with an uppercase/lowercase
	// letter or a Chinese character, and may contain numbers, _ or -. It
	// cannot begin with http:// or https://.
	AlicloudImageName string `mapstructure:"image_name" required:"true"`
	// The version number of the image, with a length
	// limit of 1 to 40 English characters.
	AlicloudImageVersion string `mapstructure:"image_version" required:"false"`
	// The description of the image, with a length
	// limit of 0 to 256 characters. Leaving it blank means null, which is the
	// default value. It cannot begin with http:// or https://.
	AlicloudImageDescription string `mapstructure:"image_description" required:"false"`
	// The IDs of to-be-added Aliyun
	// accounts to which the image is shared. The number of accounts is 1 to 10.
	// If number of accounts is greater than 10, this parameter is ignored.
	AlicloudImageShareAccounts   []string `mapstructure:"image_share_account" required:"false"`
	AlicloudImageUNShareAccounts []string `mapstructure:"image_unshare_account"`
	// Copy to the destination regionIds.
	AlicloudImageDestinationRegions []string `mapstructure:"image_copy_regions" required:"false"`
	// The name of the destination image,
	// [2, 128] English or Chinese characters. It must begin with an
	// uppercase/lowercase letter or a Chinese character, and may contain numbers,
	// _ or -. It cannot begin with http:// or https://.
	AlicloudImageDestinationNames []string `mapstructure:"image_copy_names" required:"false"`
	// Whether or not to encrypt the target images,            including those copied if image_copy_regions is specified. If this option
	// is set to true, a temporary image will be created from the provisioned
	// instance in the main region and an encrypted copy will be generated in the
	// same region. By default, Packer will keep the encryption setting to what
	// it was in the source image.
	ImageEncrypted config.Trilean `mapstructure:"image_encrypted" required:"false"`
	// If this value is true, when the target image names including those
	// copied are duplicated with existing images, it will delete the existing
	// images and then create the target images, otherwise, the creation will
	// fail. The default value is false. Check `image_name` and
	// `image_copy_names` options for names of target images. If
	// [-force](https://packer.io/docs/commands/build.html#force) option is
	// provided in `build` command, this option can be omitted and taken as
	// true.
	AlicloudImageForceDelete bool `mapstructure:"image_force_delete" required:"false"`
	// If this value is true, when delete the duplicated existing images, the
	// source snapshots of those images will be delete either. If
	// [-force](https://packer.io/docs/commands/build.html#force) option is
	// provided in `build` command, this option can be omitted and taken as
	// true.
	AlicloudImageForceDeleteSnapshots bool `mapstructure:"image_force_delete_snapshots" required:"false"`
	AlicloudImageForceDeleteInstances bool `mapstructure:"image_force_delete_instances"`
	// If this value is true, the image
	// created will not include any snapshot of data disks. This option would be
	// useful for any circumstance that default data disks with instance types are
	// not concerned. The default value is false.
	AlicloudImageIgnoreDataDisks bool `mapstructure:"image_ignore_data_disks" required:"false"`
	// The region validation can be skipped
	// if this value is true, the default value is false.
	AlicloudImageSkipRegionValidation bool `mapstructure:"skip_region_validation" required:"false"`
	// Tags applied to the destination
	// image and relevant snapshots.
	AlicloudImageTags   map[string]string `mapstructure:"tags" required:"false"`
	AlicloudDiskDevices `mapstructure:",squash"`
}

func (*AlicloudImageConfig) Prepare

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

type Artifact

type Artifact struct {
	// A map of regions to alicloud image IDs.
	AlicloudImages map[string]string

	// BuilderId is the unique ID for the builder that created this alicloud image
	BuilderIdValue string

	// Alcloud connection for performing API stuff.
	Client *ClientWrapper
}

func (*Artifact) BuilderId

func (a *Artifact) BuilderId() string

func (*Artifact) Destroy

func (a *Artifact) Destroy() error

func (*Artifact) Files

func (*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 Builder

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

func (*Builder) ConfigSpec added in v1.5.0

func (b *Builder) ConfigSpec() hcldec.ObjectSpec

func (*Builder) Prepare

func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error)

func (*Builder) Run

func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error)

type ClientWrapper added in v1.4.1

type ClientWrapper struct {
	*ecs.Client
}

func (*ClientWrapper) EvalCouldRetryResponse added in v1.4.1

func (c *ClientWrapper) EvalCouldRetryResponse(evalErrors []string, evalErrorType EvalErrorType) func(response responses.AcsResponse, err error) WaitForExpectEvalResult

func (*ClientWrapper) WaitForExpected added in v1.4.1

func (c *ClientWrapper) WaitForExpected(args *WaitForExpectArgs) (responses.AcsResponse, error)

func (*ClientWrapper) WaitForImageStatus added in v1.4.1

func (c *ClientWrapper) WaitForImageStatus(regionId string, imageId string, expectedStatus string, timeout time.Duration) (responses.AcsResponse, error)

func (*ClientWrapper) WaitForInstanceStatus added in v1.4.1

func (c *ClientWrapper) WaitForInstanceStatus(regionId string, instanceId string, expectedStatus string) (responses.AcsResponse, error)

func (*ClientWrapper) WaitForSnapshotStatus added in v1.4.2

func (c *ClientWrapper) WaitForSnapshotStatus(regionId string, snapshotId string, expectedStatus string, timeout time.Duration) (responses.AcsResponse, error)

type Config

type Config struct {
	common.PackerConfig  `mapstructure:",squash"`
	AlicloudAccessConfig `mapstructure:",squash"`
	AlicloudImageConfig  `mapstructure:",squash"`
	RunConfig            `mapstructure:",squash"`
	// contains filtered or unexported fields
}

func (*Config) FlatMapstructure added in v1.4.5

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

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 EvalErrorType added in v1.4.1

type EvalErrorType bool

type FlatAlicloudDiskDevice added in v1.4.5

type FlatAlicloudDiskDevice struct {
	DiskName           *string `mapstructure:"disk_name" required:"false" cty:"disk_name"`
	DiskCategory       *string `mapstructure:"disk_category" required:"false" cty:"disk_category"`
	DiskSize           *int    `mapstructure:"disk_size" required:"false" cty:"disk_size"`
	SnapshotId         *string `mapstructure:"disk_snapshot_id" required:"false" cty:"disk_snapshot_id"`
	Description        *string `mapstructure:"disk_description" required:"false" cty:"disk_description"`
	DeleteWithInstance *bool   `mapstructure:"disk_delete_with_instance" required:"false" cty:"disk_delete_with_instance"`
	Device             *string `mapstructure:"disk_device" required:"false" cty:"disk_device"`
	Encrypted          *bool   `mapstructure:"disk_encrypted" required:"false" cty:"disk_encrypted"`
}

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

func (*FlatAlicloudDiskDevice) HCL2Spec added in v1.4.5

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

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

type FlatConfig added in v1.4.5

type FlatConfig struct {
	PackerBuildName                   *string                  `mapstructure:"packer_build_name" cty:"packer_build_name"`
	PackerBuilderType                 *string                  `mapstructure:"packer_builder_type" cty:"packer_builder_type"`
	PackerDebug                       *bool                    `mapstructure:"packer_debug" cty:"packer_debug"`
	PackerForce                       *bool                    `mapstructure:"packer_force" cty:"packer_force"`
	PackerOnError                     *string                  `mapstructure:"packer_on_error" cty:"packer_on_error"`
	PackerUserVars                    map[string]string        `mapstructure:"packer_user_variables" cty:"packer_user_variables"`
	PackerSensitiveVars               []string                 `mapstructure:"packer_sensitive_variables" cty:"packer_sensitive_variables"`
	AlicloudAccessKey                 *string                  `mapstructure:"access_key" required:"true" cty:"access_key"`
	AlicloudSecretKey                 *string                  `mapstructure:"secret_key" required:"true" cty:"secret_key"`
	AlicloudRegion                    *string                  `mapstructure:"region" required:"true" cty:"region"`
	AlicloudSkipValidation            *bool                    `mapstructure:"skip_region_validation" required:"false" cty:"skip_region_validation"`
	AlicloudSkipImageValidation       *bool                    `mapstructure:"skip_image_validation" required:"false" cty:"skip_image_validation"`
	SecurityToken                     *string                  `mapstructure:"security_token" required:"false" cty:"security_token"`
	AlicloudImageName                 *string                  `mapstructure:"image_name" required:"true" cty:"image_name"`
	AlicloudImageVersion              *string                  `mapstructure:"image_version" required:"false" cty:"image_version"`
	AlicloudImageDescription          *string                  `mapstructure:"image_description" required:"false" cty:"image_description"`
	AlicloudImageShareAccounts        []string                 `mapstructure:"image_share_account" required:"false" cty:"image_share_account"`
	AlicloudImageUNShareAccounts      []string                 `mapstructure:"image_unshare_account" cty:"image_unshare_account"`
	AlicloudImageDestinationRegions   []string                 `mapstructure:"image_copy_regions" required:"false" cty:"image_copy_regions"`
	AlicloudImageDestinationNames     []string                 `mapstructure:"image_copy_names" required:"false" cty:"image_copy_names"`
	ImageEncrypted                    *bool                    `mapstructure:"image_encrypted" required:"false" cty:"image_encrypted"`
	AlicloudImageForceDelete          *bool                    `mapstructure:"image_force_delete" required:"false" cty:"image_force_delete"`
	AlicloudImageForceDeleteSnapshots *bool                    `mapstructure:"image_force_delete_snapshots" required:"false" cty:"image_force_delete_snapshots"`
	AlicloudImageForceDeleteInstances *bool                    `mapstructure:"image_force_delete_instances" cty:"image_force_delete_instances"`
	AlicloudImageIgnoreDataDisks      *bool                    `mapstructure:"image_ignore_data_disks" required:"false" cty:"image_ignore_data_disks"`
	AlicloudImageTags                 map[string]string        `mapstructure:"tags" required:"false" cty:"tags"`
	ECSSystemDiskMapping              *FlatAlicloudDiskDevice  `mapstructure:"system_disk_mapping" required:"false" cty:"system_disk_mapping"`
	ECSImagesDiskMappings             []FlatAlicloudDiskDevice `mapstructure:"image_disk_mappings" required:"false" cty:"image_disk_mappings"`
	AssociatePublicIpAddress          *bool                    `mapstructure:"associate_public_ip_address" cty:"associate_public_ip_address"`
	ZoneId                            *string                  `mapstructure:"zone_id" required:"false" cty:"zone_id"`
	IOOptimized                       *bool                    `mapstructure:"io_optimized" required:"false" cty:"io_optimized"`
	InstanceType                      *string                  `mapstructure:"instance_type" required:"true" cty:"instance_type"`
	Description                       *string                  `mapstructure:"description" cty:"description"`
	AlicloudSourceImage               *string                  `mapstructure:"source_image" required:"true" cty:"source_image"`
	ForceStopInstance                 *bool                    `mapstructure:"force_stop_instance" required:"false" cty:"force_stop_instance"`
	DisableStopInstance               *bool                    `mapstructure:"disable_stop_instance" required:"false" cty:"disable_stop_instance"`
	SecurityGroupId                   *string                  `mapstructure:"security_group_id" required:"false" cty:"security_group_id"`
	SecurityGroupName                 *string                  `mapstructure:"security_group_name" required:"false" cty:"security_group_name"`
	UserData                          *string                  `mapstructure:"user_data" required:"false" cty:"user_data"`
	UserDataFile                      *string                  `mapstructure:"user_data_file" required:"false" cty:"user_data_file"`
	VpcId                             *string                  `mapstructure:"vpc_id" required:"false" cty:"vpc_id"`
	VpcName                           *string                  `mapstructure:"vpc_name" required:"false" cty:"vpc_name"`
	CidrBlock                         *string                  `mapstructure:"vpc_cidr_block" required:"false" cty:"vpc_cidr_block"`
	VSwitchId                         *string                  `mapstructure:"vswitch_id" required:"false" cty:"vswitch_id"`
	VSwitchName                       *string                  `mapstructure:"vswitch_name" required:"false" cty:"vswitch_name"`
	InstanceName                      *string                  `mapstructure:"instance_name" required:"false" cty:"instance_name"`
	InternetChargeType                *string                  `mapstructure:"internet_charge_type" required:"false" cty:"internet_charge_type"`
	InternetMaxBandwidthOut           *int                     `mapstructure:"internet_max_bandwidth_out" required:"false" cty:"internet_max_bandwidth_out"`
	WaitSnapshotReadyTimeout          *int                     `mapstructure:"wait_snapshot_ready_timeout" required:"false" cty:"wait_snapshot_ready_timeout"`
	Type                              *string                  `mapstructure:"communicator" cty:"communicator"`
	PauseBeforeConnect                *string                  `mapstructure:"pause_before_connecting" cty:"pause_before_connecting"`
	SSHHost                           *string                  `mapstructure:"ssh_host" cty:"ssh_host"`
	SSHPort                           *int                     `mapstructure:"ssh_port" cty:"ssh_port"`
	SSHUsername                       *string                  `mapstructure:"ssh_username" cty:"ssh_username"`
	SSHPassword                       *string                  `mapstructure:"ssh_password" cty:"ssh_password"`
	SSHKeyPairName                    *string                  `mapstructure:"ssh_keypair_name" cty:"ssh_keypair_name"`
	SSHTemporaryKeyPairName           *string                  `mapstructure:"temporary_key_pair_name" cty:"temporary_key_pair_name"`
	SSHClearAuthorizedKeys            *bool                    `mapstructure:"ssh_clear_authorized_keys" cty:"ssh_clear_authorized_keys"`
	SSHPrivateKeyFile                 *string                  `mapstructure:"ssh_private_key_file" cty:"ssh_private_key_file"`
	SSHPty                            *bool                    `mapstructure:"ssh_pty" cty:"ssh_pty"`
	SSHTimeout                        *string                  `mapstructure:"ssh_timeout" cty:"ssh_timeout"`
	SSHAgentAuth                      *bool                    `mapstructure:"ssh_agent_auth" cty:"ssh_agent_auth"`
	SSHDisableAgentForwarding         *bool                    `mapstructure:"ssh_disable_agent_forwarding" cty:"ssh_disable_agent_forwarding"`
	SSHHandshakeAttempts              *int                     `mapstructure:"ssh_handshake_attempts" cty:"ssh_handshake_attempts"`
	SSHBastionHost                    *string                  `mapstructure:"ssh_bastion_host" cty:"ssh_bastion_host"`
	SSHBastionPort                    *int                     `mapstructure:"ssh_bastion_port" cty:"ssh_bastion_port"`
	SSHBastionAgentAuth               *bool                    `mapstructure:"ssh_bastion_agent_auth" cty:"ssh_bastion_agent_auth"`
	SSHBastionUsername                *string                  `mapstructure:"ssh_bastion_username" cty:"ssh_bastion_username"`
	SSHBastionPassword                *string                  `mapstructure:"ssh_bastion_password" cty:"ssh_bastion_password"`
	SSHBastionPrivateKeyFile          *string                  `mapstructure:"ssh_bastion_private_key_file" cty:"ssh_bastion_private_key_file"`
	SSHFileTransferMethod             *string                  `mapstructure:"ssh_file_transfer_method" cty:"ssh_file_transfer_method"`
	SSHProxyHost                      *string                  `mapstructure:"ssh_proxy_host" cty:"ssh_proxy_host"`
	SSHProxyPort                      *int                     `mapstructure:"ssh_proxy_port" cty:"ssh_proxy_port"`
	SSHProxyUsername                  *string                  `mapstructure:"ssh_proxy_username" cty:"ssh_proxy_username"`
	SSHProxyPassword                  *string                  `mapstructure:"ssh_proxy_password" cty:"ssh_proxy_password"`
	SSHKeepAliveInterval              *string                  `mapstructure:"ssh_keep_alive_interval" cty:"ssh_keep_alive_interval"`
	SSHReadWriteTimeout               *string                  `mapstructure:"ssh_read_write_timeout" cty:"ssh_read_write_timeout"`
	SSHRemoteTunnels                  []string                 `mapstructure:"ssh_remote_tunnels" cty:"ssh_remote_tunnels"`
	SSHLocalTunnels                   []string                 `mapstructure:"ssh_local_tunnels" cty:"ssh_local_tunnels"`
	SSHPublicKey                      []byte                   `mapstructure:"ssh_public_key" cty:"ssh_public_key"`
	SSHPrivateKey                     []byte                   `mapstructure:"ssh_private_key" cty:"ssh_private_key"`
	WinRMUser                         *string                  `mapstructure:"winrm_username" cty:"winrm_username"`
	WinRMPassword                     *string                  `mapstructure:"winrm_password" cty:"winrm_password"`
	WinRMHost                         *string                  `mapstructure:"winrm_host" cty:"winrm_host"`
	WinRMPort                         *int                     `mapstructure:"winrm_port" cty:"winrm_port"`
	WinRMTimeout                      *string                  `mapstructure:"winrm_timeout" cty:"winrm_timeout"`
	WinRMUseSSL                       *bool                    `mapstructure:"winrm_use_ssl" cty:"winrm_use_ssl"`
	WinRMInsecure                     *bool                    `mapstructure:"winrm_insecure" cty:"winrm_insecure"`
	WinRMUseNTLM                      *bool                    `mapstructure:"winrm_use_ntlm" cty:"winrm_use_ntlm"`
	SSHPrivateIp                      *bool                    `mapstructure:"ssh_private_ip" required:"false" cty:"ssh_private_ip"`
}

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

func (*FlatConfig) HCL2Spec added in v1.4.5

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

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

type InstanceNetWork

type InstanceNetWork string

type RunConfig

type RunConfig struct {
	AssociatePublicIpAddress bool `mapstructure:"associate_public_ip_address"`
	// ID of the zone to which the disk belongs.
	ZoneId string `mapstructure:"zone_id" required:"false"`
	// Whether an ECS instance is I/O optimized or not. If this option is not
	// provided, the value will be determined by product API according to what
	// `instance_type` is used.
	IOOptimized config.Trilean `mapstructure:"io_optimized" required:"false"`
	// Type of the instance. For values, see [Instance Type
	// Table](https://www.alibabacloud.com/help/doc-detail/25378.htm?spm=a3c0i.o25499en.a3.9.14a36ac8iYqKRA).
	// You can also obtain the latest instance type table by invoking the
	// [Querying Instance Type
	// Table](https://intl.aliyun.com/help/doc-detail/25620.htm?spm=a3c0i.o25499en.a3.6.Dr1bik)
	// interface.
	InstanceType string `mapstructure:"instance_type" required:"true"`
	Description  string `mapstructure:"description"`
	// This is the base image id which you want to
	// create your customized images.
	AlicloudSourceImage string `mapstructure:"source_image" required:"true"`
	// Whether to force shutdown upon device
	// restart. The default value is `false`.
	//
	// If it is set to `false`, the system is shut down normally; if it is set to
	// `true`, the system is forced to shut down.
	ForceStopInstance bool `mapstructure:"force_stop_instance" required:"false"`
	// If this option is set to true, Packer
	// will not stop the instance for you, and you need to make sure the instance
	// will be stopped in the final provisioner command. Otherwise, Packer will
	// timeout while waiting the instance to be stopped. This option is provided
	// for some specific scenarios that you want to stop the instance by yourself.
	// E.g., Sysprep a windows which may shutdown the instance within its command.
	// The default value is false.
	DisableStopInstance bool `mapstructure:"disable_stop_instance" required:"false"`
	// ID of the security group to which a newly
	// created instance belongs. Mutual access is allowed between instances in one
	// security group. If not specified, the newly created instance will be added
	// to the default security group. If the default group doesn’t exist, or the
	// number of instances in it has reached the maximum limit, a new security
	// group will be created automatically.
	SecurityGroupId string `mapstructure:"security_group_id" required:"false"`
	// The security group name. The default value
	// is blank. [2, 128] English or Chinese characters, must begin with an
	// uppercase/lowercase letter or Chinese character. Can contain numbers, .,
	// _ or -. It cannot begin with http:// or https://.
	SecurityGroupName string `mapstructure:"security_group_name" required:"false"`
	// User data to apply when launching the instance. Note
	// that you need to be careful about escaping characters due to the templates
	// being JSON. It is often more convenient to use user_data_file, instead.
	// Packer will not automatically wait for a user script to finish before
	// shutting down the instance this must be handled in a provisioner.
	UserData string `mapstructure:"user_data" required:"false"`
	// Path to a file that will be used for the user
	// data when launching the instance.
	UserDataFile string `mapstructure:"user_data_file" required:"false"`
	// VPC ID allocated by the system.
	VpcId string `mapstructure:"vpc_id" required:"false"`
	// The VPC name. The default value is blank. [2, 128]
	// English or Chinese characters, must begin with an uppercase/lowercase
	// letter or Chinese character. Can contain numbers, _ and -. The disk
	// description will appear on the console. Cannot begin with http:// or
	// https://.
	VpcName string `mapstructure:"vpc_name" required:"false"`
	// Value options: 192.168.0.0/16 and
	// 172.16.0.0/16. When not specified, the default value is 172.16.0.0/16.
	CidrBlock string `mapstructure:"vpc_cidr_block" required:"false"`
	// The ID of the VSwitch to be used.
	VSwitchId string `mapstructure:"vswitch_id" required:"false"`
	// The ID of the VSwitch to be used.
	VSwitchName string `mapstructure:"vswitch_name" required:"false"`
	// Display name of the instance, which is a string of 2 to 128 Chinese or
	// English characters. It must begin with an uppercase/lowercase letter or
	// a Chinese character and can contain numerals, `.`, `_`, or `-`. The
	// instance name is displayed on the Alibaba Cloud console. If this
	// parameter is not specified, the default value is InstanceId of the
	// instance. It cannot begin with `http://` or `https://`.
	InstanceName string `mapstructure:"instance_name" required:"false"`
	// Internet charge type, which can be
	// `PayByTraffic` or `PayByBandwidth`. Optional values:
	// -   `PayByBandwidth`
	// -   `PayByTraffic`
	//
	// If this parameter is not specified, the default value is `PayByBandwidth`.
	// For the regions out of China, currently only support `PayByTraffic`, you
	// must set it manfully.
	InternetChargeType string `mapstructure:"internet_charge_type" required:"false"`
	// Maximum outgoing bandwidth to the
	// public network, measured in Mbps (Mega bits per second).
	//
	// Value range:
	// -   `PayByBandwidth`: \[0, 100\]. If this parameter is not specified, API
	//     automatically sets it to 0 Mbps.
	// -   `PayByTraffic`: \[1, 100\]. If this parameter is not specified, an
	//     error is returned.
	InternetMaxBandwidthOut int `mapstructure:"internet_max_bandwidth_out" required:"false"`
	// Timeout of creating snapshot(s).
	// The default timeout is 3600 seconds if this option is not set or is set
	// to 0. For those disks containing lots of data, it may require a higher
	// timeout value.
	WaitSnapshotReadyTimeout int `mapstructure:"wait_snapshot_ready_timeout" required:"false"`
	// Communicator settings
	Comm communicator.Config `mapstructure:",squash"`
	// If this value is true, packer will connect to
	// the ECS created through private ip instead of allocating a public ip or an
	// EIP. The default value is false.
	SSHPrivateIp bool `mapstructure:"ssh_private_ip" required:"false"`
}

func (*RunConfig) Prepare

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

type WaitForExpectArgs added in v1.4.1

type WaitForExpectArgs struct {
	RequestFunc   func() (responses.AcsResponse, error)
	EvalFunc      func(response responses.AcsResponse, err error) WaitForExpectEvalResult
	RetryInterval time.Duration
	RetryTimes    int
	RetryTimeout  time.Duration
}

type WaitForExpectEvalResult added in v1.4.1

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

Jump to

Keyboard shortcuts

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