common

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2021 License: MPL-2.0 Imports: 50 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TemplateFuncs = template.FuncMap{
	"clean_resource_name": templateCleanAMIName,
}

Functions

func DecodeAuthZMessages added in v1.3.1

func DecodeAuthZMessages(sess *session.Session)

DecodeAuthZMessages enables automatic decoding of any encoded authorization messages

func DestroyAMIs added in v1.4.5

func DestroyAMIs(imageids []*string, ec2conn *ec2.EC2) error

DestroyAMIs deregisters the AWS machine images in imageids from an active AWS account

func GetGeneratedDataList added in v1.6.2

func GetGeneratedDataList() []string

func Port added in v1.6.0

func Port(sshInterface string, port int) func(multistep.StateBag) (int, error)

Port returns a function that can be given to the communicator for determining the port to use when connecting to an instance.

func SSHHost added in v0.8.0

func SSHHost(e ec2Describer, sshInterface string, host string) func(multistep.StateBag) (string, error)

SSHHost returns a function that can be given to the SSH communicator for determining the SSH address based on the instance DNS name.

func ValidateKmsKey added in v1.6.6

func ValidateKmsKey(kmsKey string) (valid bool)

See https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CopyImage.html

func WaitForImageToBeImported added in v1.2.5

func WaitForImageToBeImported(c *ec2.EC2, ctx aws.Context, input *ec2.DescribeImportImageTasksInput, opts ...request.WaiterOption) error

func WaitForVolumeToBeAttached added in v1.2.5

func WaitForVolumeToBeAttached(c *ec2.EC2, ctx aws.Context, input *ec2.DescribeVolumesInput, opts ...request.WaiterOption) error

func WaitForVolumeToBeDetached added in v1.2.5

func WaitForVolumeToBeDetached(c *ec2.EC2, ctx aws.Context, input *ec2.DescribeVolumesInput, opts ...request.WaiterOption) error

Types

type AMIConfig added in v0.3.0

type AMIConfig struct {
	// The name of the resulting AMI that will appear when managing AMIs in the
	// AWS console or via APIs. This must be unique. To help make this unique,
	// use a function like timestamp (see [template
	// engine](/docs/templates/legacy_json_templates/engine) for more info).
	AMIName string `mapstructure:"ami_name" required:"true"`
	// The description to set for the resulting
	// AMI(s). By default this description is empty.  This is a
	// [template engine](/docs/templates/legacy_json_templates/engine), see [Build template
	// data](#build-template-data) for more information.
	AMIDescription string `mapstructure:"ami_description" required:"false"`
	// The type of virtualization for the AMI
	// you are building. This option is required to register HVM images. Can be
	// paravirtual (default) or hvm.
	AMIVirtType string `mapstructure:"ami_virtualization_type" required:"false"`
	// A list of account IDs that have access to
	// launch the resulting AMI(s). By default no additional users other than the
	// user creating the AMI has permissions to launch it.
	AMIUsers []string `mapstructure:"ami_users" required:"false"`
	// A list of groups that have access to
	// launch the resulting AMI(s). By default no groups have permission to launch
	// the AMI. all will make the AMI publicly accessible.
	AMIGroups []string `mapstructure:"ami_groups" required:"false"`
	// A list of product codes to
	// associate with the AMI. By default no product codes are associated with the
	// AMI.
	AMIProductCodes []string `mapstructure:"ami_product_codes" required:"false"`
	// A list of regions to copy the AMI to.
	// Tags and attributes are copied along with the AMI. AMI copying takes time
	// depending on the size of the AMI, but will generally take many minutes.
	AMIRegions []string `mapstructure:"ami_regions" required:"false"`
	// Set to true if you want to skip
	// validation of the ami_regions configuration option. Default false.
	AMISkipRegionValidation bool `mapstructure:"skip_region_validation" required:"false"`
	// Key/value pair tags applied to the AMI. This is a [template
	// engine](/docs/templates/legacy_json_templates/engine), see [Build template
	// data](#build-template-data) for more information.
	AMITags map[string]string `mapstructure:"tags" required:"false"`
	// Same as [`tags`](#tags) but defined as a singular repeatable block
	// containing a `key` and a `value` field. In HCL2 mode the
	// [`dynamic_block`](/docs/templates/hcl_templates/expressions#dynamic-blocks)
	// will allow you to create those programatically.
	AMITag config.KeyValues `mapstructure:"tag" required:"false"`
	// Enable enhanced networking (ENA but not SriovNetSupport) on
	// HVM-compatible AMIs. If set, add `ec2:ModifyInstanceAttribute` to your
	// AWS IAM policy.
	//
	// Note: you must make sure enhanced networking is enabled on your
	// instance. See [Amazon's documentation on enabling enhanced
	// networking](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/enhanced-networking.html#enabling_enhanced_networking).
	AMIENASupport config.Trilean `mapstructure:"ena_support" required:"false"`
	// Enable enhanced networking (SriovNetSupport but not ENA) on
	// HVM-compatible AMIs. If true, add `ec2:ModifyInstanceAttribute` to your
	// AWS IAM policy. Note: you must make sure enhanced networking is enabled
	// on your instance. See [Amazon's documentation on enabling enhanced
	// networking](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/enhanced-networking.html#enabling_enhanced_networking).
	// Default `false`.
	AMISriovNetSupport bool `mapstructure:"sriov_support" required:"false"`
	// Force Packer to first deregister an existing
	// AMI if one with the same name already exists. Default false.
	AMIForceDeregister bool `mapstructure:"force_deregister" required:"false"`
	// Force Packer to delete snapshots
	// associated with AMIs, which have been deregistered by force_deregister.
	// Default false.
	AMIForceDeleteSnapshot bool `mapstructure:"force_delete_snapshot" required:"false"`
	// Whether or not to encrypt the resulting AMI when
	// copying a provisioned instance to an AMI. By default, Packer will keep
	// the encryption setting to what it was in the source image. Setting false
	// will result in an unencrypted image, and true will result in an encrypted
	// one.
	//
	// If you have used the `launch_block_device_mappings` to set an encryption
	// key and that key is the same as the one you want the image encrypted with
	// at the end, then you don't need to set this field; leaving it empty will
	// prevent an unnecessary extra copy step and save you some time.
	//
	// Please note that if you are using an account with the global "Always
	// encrypt new EBS volumes" option set to `true`, Packer will be unable to
	// override this setting, and the final image will be encryoted whether
	// you set this value or not.
	AMIEncryptBootVolume config.Trilean `mapstructure:"encrypt_boot" required:"false"`
	// ID, alias or ARN of the KMS key to use for AMI encryption. This
	// only applies to the main `region` -- any regions the AMI gets copied to
	// copied will be encrypted by the default EBS KMS key for that region,
	// unless you set region-specific keys in AMIRegionKMSKeyIDs.
	//
	// Set this value if you select `encrypt_boot`, but don't want to use the
	// region's default KMS key.
	//
	// If you have a custom kms key you'd like to apply to the launch volume,
	// and are only building in one region, it is more efficient to leave this
	// and `encrypt_boot` empty and to instead set the key id in the
	// launch_block_device_mappings (you can find an example below). This saves
	// potentially many minutes at the end of the build by preventing Packer
	// from having to copy and re-encrypt the image at the end of the build.
	//
	// For valid formats see *KmsKeyId* in the [AWS API docs -
	// CopyImage](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CopyImage.html).
	// This field is validated by Packer, when using an alias, you will have to
	// prefix `kms_key_id` with `alias/`.
	AMIKmsKeyId string `mapstructure:"kms_key_id" required:"false"`
	// regions to copy the ami to, along with the custom kms key id (alias or
	// arn) to use for encryption for that region. Keys must match the regions
	// provided in `ami_regions`. If you just want to encrypt using a default
	// ID, you can stick with `kms_key_id` and `ami_regions`. If you want a
	// region to be encrypted with that region's default key ID, you can use an
	// empty string `""` instead of a key id in this map. (e.g. `"us-east-1":
	// ""`) However, you cannot use default key IDs if you are using this in
	// conjunction with `snapshot_users` -- in that situation you must use
	// custom keys. For valid formats see *KmsKeyId* in the [AWS API docs -
	// CopyImage](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CopyImage.html).
	//
	// This option supercedes the `kms_key_id` option -- if you set both, and
	// they are different, Packer will respect the value in
	// `region_kms_key_ids` for your build region and silently disregard the
	// value provided in `kms_key_id`.
	AMIRegionKMSKeyIDs map[string]string `mapstructure:"region_kms_key_ids" required:"false"`
	// If true, Packer will not check whether an AMI with the `ami_name` exists
	// in the region it is building in. It will use an intermediary AMI name,
	// which it will not convert to an AMI in the build region. It will copy
	// the intermediary AMI into any regions provided in `ami_regions`, then
	// delete the intermediary AMI. Default `false`.
	AMISkipBuildRegion bool `mapstructure:"skip_save_build_region"`
	// Key/value pair tags to apply to snapshot. They will override AMI tags if
	// already applied to snapshot. This is a [template
	// engine](/docs/templates/legacy_json_templates/engine), see [Build template
	// data](#build-template-data) for more information.
	SnapshotTags map[string]string `mapstructure:"snapshot_tags" required:"false"`
	// Same as [`snapshot_tags`](#snapshot_tags) but defined as a singular
	// repeatable block containing a `key` and a `value` field. In HCL2 mode the
	// [`dynamic_block`](/docs/templates/hcl_templates/expressions#dynamic-blocks)
	// will allow you to create those programatically.
	SnapshotTag config.KeyValues `mapstructure:"snapshot_tag" required:"false"`
	// A list of account IDs that have
	// access to create volumes from the snapshot(s). By default no additional
	// users other than the user creating the AMI has permissions to create
	// volumes from the backing snapshot(s).
	SnapshotUsers []string `mapstructure:"snapshot_users" required:"false"`
	// A list of groups that have access to
	// create volumes from the snapshot(s). By default no groups have permission
	// to create volumes from the snapshot(s). all will make the snapshot
	// publicly accessible.
	SnapshotGroups []string `mapstructure:"snapshot_groups" required:"false"`
}

AMIConfig is for common configuration related to creating AMIs.

func (*AMIConfig) Prepare added in v0.3.0

func (c *AMIConfig) Prepare(accessConfig *AccessConfig, ctx *interpolate.Context) []error

type AWSPollingConfig added in v1.6.2

type AWSPollingConfig struct {
	// Specifies the maximum number of attempts the waiter will check for resource state.
	// This value can also be set via the AWS_MAX_ATTEMPTS.
	// If both option and environment variable are set, the max_attempts will be considered over the AWS_MAX_ATTEMPTS.
	// If none is set, defaults to AWS waiter default which is 40 max_attempts.
	MaxAttempts int `mapstructure:"max_attempts" required:"false"`
	// Specifies the delay in seconds between attempts to check the resource state.
	// This value can also be set via the AWS_POLL_DELAY_SECONDS.
	// If both option and environment variable are set, the delay_seconds will be considered over the AWS_POLL_DELAY_SECONDS.
	// If none is set, defaults to AWS waiter default which is 15 seconds.
	DelaySeconds int `mapstructure:"delay_seconds" required:"false"`
}

Polling configuration for the AWS waiter. Configures the waiter for resources creation or actions like attaching volumes or importing image.

HCL2 example: ```hcl

aws_polling {
	 delay_seconds = 30
	 max_attempts = 50
}

```

JSON example: ```json

"aws_polling" : {
	 "delay_seconds": 30,
	 "max_attempts": 50
}

```

func (*AWSPollingConfig) FlatMapstructure added in v1.6.2

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

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

func (*AWSPollingConfig) LogEnvOverrideWarnings added in v1.6.2

func (w *AWSPollingConfig) LogEnvOverrideWarnings()

func (*AWSPollingConfig) WaitUntilAMIAvailable added in v1.6.2

func (w *AWSPollingConfig) WaitUntilAMIAvailable(ctx aws.Context, conn ec2iface.EC2API, imageId string) error

func (*AWSPollingConfig) WaitUntilImageImported added in v1.6.2

func (w *AWSPollingConfig) WaitUntilImageImported(ctx aws.Context, conn *ec2.EC2, taskID string) error

func (*AWSPollingConfig) WaitUntilInstanceRunning added in v1.6.2

func (w *AWSPollingConfig) WaitUntilInstanceRunning(ctx aws.Context, conn *ec2.EC2, instanceId string) error

func (*AWSPollingConfig) WaitUntilInstanceTerminated added in v1.6.2

func (w *AWSPollingConfig) WaitUntilInstanceTerminated(ctx aws.Context, conn *ec2.EC2, instanceId string) error

func (*AWSPollingConfig) WaitUntilSnapshotDone added in v1.6.2

func (w *AWSPollingConfig) WaitUntilSnapshotDone(ctx aws.Context, conn *ec2.EC2, snapshotID string) error

func (*AWSPollingConfig) WaitUntilSpotRequestFulfilled added in v1.6.2

func (w *AWSPollingConfig) WaitUntilSpotRequestFulfilled(ctx aws.Context, conn *ec2.EC2, spotRequestId string) error

This function works for both requesting and cancelling spot instances.

func (*AWSPollingConfig) WaitUntilVolumeAttached added in v1.6.2

func (w *AWSPollingConfig) WaitUntilVolumeAttached(ctx aws.Context, conn *ec2.EC2, volumeId string) error

func (*AWSPollingConfig) WaitUntilVolumeAvailable added in v1.6.2

func (w *AWSPollingConfig) WaitUntilVolumeAvailable(ctx aws.Context, conn *ec2.EC2, volumeId string) error

func (*AWSPollingConfig) WaitUntilVolumeDetached added in v1.6.2

func (w *AWSPollingConfig) WaitUntilVolumeDetached(ctx aws.Context, conn *ec2.EC2, volumeId string) error

type AccessConfig

type AccessConfig struct {
	// The access key used to communicate with AWS. [Learn how  to set this]
	// (/docs/builders/amazon#specifying-amazon-credentials). On EBS, this
	// is not required if you are using `use_vault_aws_engine` for
	// authentication instead.
	AccessKey string `mapstructure:"access_key" required:"true"`
	// If provided with a role ARN, Packer will attempt to assume this role
	// using the supplied credentials. See
	// [AssumeRoleConfig](#assume-role-configuration) below for more
	// details on all of the options available, and for a usage example.
	AssumeRole AssumeRoleConfig `mapstructure:"assume_role" required:"false"`
	// This option is useful if you use a cloud
	// provider whose API is compatible with aws EC2. Specify another endpoint
	// like this https://ec2.custom.endpoint.com.
	CustomEndpointEc2 string `mapstructure:"custom_endpoint_ec2" required:"false"`
	// Path to a credentials file to load credentials from
	CredsFilename string `mapstructure:"shared_credentials_file" required:"false"`
	// Enable automatic decoding of any encoded authorization (error) messages
	// using the `sts:DecodeAuthorizationMessage` API. Note: requires that the
	// effective user/role have permissions to `sts:DecodeAuthorizationMessage`
	// on resource `*`. Default `false`.
	DecodeAuthZMessages bool `mapstructure:"decode_authorization_messages" required:"false"`
	// This allows skipping TLS
	// verification of the AWS EC2 endpoint. The default is false.
	InsecureSkipTLSVerify bool `mapstructure:"insecure_skip_tls_verify" required:"false"`
	// This is the maximum number of times an API call is retried, in the case
	// where requests are being throttled or experiencing transient failures.
	// The delay between the subsequent API calls increases exponentially.
	MaxRetries int `mapstructure:"max_retries" required:"false"`
	// The MFA
	// [TOTP](https://en.wikipedia.org/wiki/Time-based_One-time_Password_Algorithm)
	// code. This should probably be a user variable since it changes all the
	// time.
	MFACode string `mapstructure:"mfa_code" required:"false"`
	// The profile to use in the shared credentials file for
	// AWS. See Amazon's documentation on [specifying
	// profiles](https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html#specifying-profiles)
	// for more details.
	ProfileName string `mapstructure:"profile" required:"false"`
	// The name of the region, such as `us-east-1`, in which
	// to launch the EC2 instance to create the AMI.
	// When chroot building, this value is guessed from environment.
	RawRegion string `mapstructure:"region" required:"true"`
	// The secret key used to communicate with AWS. [Learn how to set
	// this](/docs/builders/amazon#specifying-amazon-credentials). This is not required
	// if you are using `use_vault_aws_engine` for authentication instead.
	SecretKey            string `mapstructure:"secret_key" required:"true"`
	SkipMetadataApiCheck bool   `mapstructure:"skip_metadata_api_check"`
	// Set to true if you want to skip validating AWS credentials before runtime.
	SkipCredsValidation bool `mapstructure:"skip_credential_validation"`
	// The access token to use. This is different from the
	// access key and secret key. If you're not sure what this is, then you
	// probably don't need it. This will also be read from the AWS_SESSION_TOKEN
	// environmental variable.
	Token string `mapstructure:"token" required:"false"`

	// Get credentials from Hashicorp Vault's aws secrets engine. You must
	// already have created a role to use. For more information about
	// generating credentials via the Vault engine, see the [Vault
	// docs.](https://www.vaultproject.io/api/secret/aws#generate-credentials)
	// If you set this flag, you must also set the below options:
	// -   `name` (string) - Required. Specifies the name of the role to generate
	//     credentials against. This is part of the request URL.
	// -   `engine_name` (string) - The name of the aws secrets engine. In the
	//     Vault docs, this is normally referred to as "aws", and Packer will
	//     default to "aws" if `engine_name` is not set.
	// -   `role_arn` (string)- The ARN of the role to assume if credential\_type
	//     on the Vault role is assumed\_role. Must match one of the allowed role
	//     ARNs in the Vault role. Optional if the Vault role only allows a single
	//     AWS role ARN; required otherwise.
	// -   `ttl` (string) - Specifies the TTL for the use of the STS token. This
	//     is specified as a string with a duration suffix. Valid only when
	//     credential\_type is assumed\_role or federation\_token. When not
	//     specified, the default\_sts\_ttl set for the role will be used. If that
	//     is also not set, then the default value of 3600s will be used. AWS
	//     places limits on the maximum TTL allowed. See the AWS documentation on
	//     the DurationSeconds parameter for AssumeRole (for assumed\_role
	//     credential types) and GetFederationToken (for federation\_token
	//     credential types) for more details.
	//
	// HCL2 example:
	//
	// “`hcl
	// vault_aws_engine {
	//     name = "myrole"
	//     role_arn = "myarn"
	//     ttl = "3600s"
	// }
	// “`
	//
	// JSON example:
	//
	// “`json
	// {
	//     "vault_aws_engine": {
	//         "name": "myrole",
	//         "role_arn": "myarn",
	//         "ttl": "3600s"
	//     }
	// }
	// “`
	VaultAWSEngine VaultAWSEngineOptions `mapstructure:"vault_aws_engine" required:"false"`
	// [Polling configuration](#polling-configuration) for the AWS waiter. Configures the waiter that checks
	// resource state.
	PollingConfig *AWSPollingConfig `mapstructure:"aws_polling" required:"false"`
	// contains filtered or unexported fields
}

AccessConfig is for common configuration related to AWS access

func (*AccessConfig) GetCredentials added in v1.6.3

func (c *AccessConfig) GetCredentials(config *aws.Config) (*awsCredentials.Credentials, error)

GetCredentials gets credentials from the environment, shared credentials, the session (which may include a credential process), or ECS/EC2 metadata endpoints. GetCredentials also validates the credentials and the ability to assume a role or will return an error if unsuccessful.

func (*AccessConfig) GetCredsFromVault added in v1.3.5

func (c *AccessConfig) GetCredsFromVault() error

func (*AccessConfig) IsChinaCloud added in v1.2.0

func (c *AccessConfig) IsChinaCloud() bool

func (*AccessConfig) IsGovCloud added in v1.2.0

func (c *AccessConfig) IsGovCloud() bool

func (*AccessConfig) NewEC2Connection added in v1.3.2

func (c *AccessConfig) NewEC2Connection() (ec2iface.EC2API, error)

func (*AccessConfig) NewNoValidCredentialSourcesError added in v1.6.3

func (c *AccessConfig) NewNoValidCredentialSourcesError(err error) error

func (*AccessConfig) Prepare

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

func (*AccessConfig) Session added in v1.0.1

func (c *AccessConfig) Session() (*session.Session, error)

Config returns a valid aws.Config object for access to AWS services, or an error if the authentication and region couldn't be resolved

func (*AccessConfig) SessionRegion added in v1.2.0

func (c *AccessConfig) SessionRegion() string

func (*AccessConfig) ValidateRegion added in v1.3.2

func (c *AccessConfig) ValidateRegion(regions ...string) error

ValidateRegion returns an nil if the regions are valid and exists; otherwise an error. ValidateRegion calls ec2conn.DescribeRegions to get the list of regions available to this account.

type AmiFilterOptions added in v0.12.0

type AmiFilterOptions struct {
	// Filters used to select an AMI. Any filter described in the docs for
	// [DescribeImages](http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeImages.html)
	// is valid.
	Filters map[string]string `mapstructure:"filters"`
	// Filters the images by their owner. You
	// may specify one or more AWS account IDs, "self" (which will use the
	// account whose credentials you are using to run Packer), or an AWS owner
	// alias: for example, `amazon`, `aws-marketplace`, or `microsoft`. This
	// option is required for security reasons.
	Owners []string `mapstructure:"owners"`
	// Selects the newest created image when true.
	// This is most useful for selecting a daily distro build.
	MostRecent bool `mapstructure:"most_recent"`
}

func (*AmiFilterOptions) Empty added in v0.12.0

func (d *AmiFilterOptions) Empty() bool

func (*AmiFilterOptions) FlatMapstructure added in v1.4.5

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

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

func (*AmiFilterOptions) GetFilteredImage added in v1.7.0

func (d *AmiFilterOptions) GetFilteredImage(params *ec2.DescribeImagesInput, ec2conn *ec2.EC2) (*ec2.Image, error)

func (*AmiFilterOptions) GetOwners added in v1.4.5

func (d *AmiFilterOptions) GetOwners() []*string

func (*AmiFilterOptions) NoOwner added in v1.3.0

func (d *AmiFilterOptions) NoOwner() bool

type Artifact

type Artifact struct {
	// A map of regions to AMI IDs.
	Amis map[string]string

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

	// StateData should store data such as GeneratedData
	// to be shared with post-processors
	StateData map[string]interface{}

	// EC2 connection for performing API stuff.
	Session *session.Session
}

Artifact is an artifact implementation that contains built AMIs.

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 added in v0.7.2

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

func (*Artifact) String

func (a *Artifact) String() string

type AssumeRoleConfig added in v1.6.3

type AssumeRoleConfig struct {
	// Amazon Resource Name (ARN) of the IAM Role to assume.
	AssumeRoleARN string `mapstructure:"role_arn" required:"false"`
	// Number of seconds to restrict the assume role session duration.
	AssumeRoleDurationSeconds int `mapstructure:"duration_seconds" required:"false"`
	// The external ID to use when assuming the role. If omitted, no external
	// ID is passed to the AssumeRole call.
	AssumeRoleExternalID string `mapstructure:"external_id" required:"false"`
	// IAM Policy JSON describing further restricting permissions for the IAM
	// Role being assumed.
	AssumeRolePolicy string `mapstructure:"policy" required:"false"`
	// Set of Amazon Resource Names (ARNs) of IAM Policies describing further
	// restricting permissions for the IAM Role being
	AssumeRolePolicyARNs []string `mapstructure:"policy_arns" required:"false"`
	// Session name to use when assuming the role.
	AssumeRoleSessionName string `mapstructure:"session_name" required:"false"`
	// Map of assume role session tags.
	AssumeRoleTags map[string]string `mapstructure:"tags" required:"false"`
	// Set of assume role session tag keys to pass to any subsequent sessions.
	AssumeRoleTransitiveTagKeys []string `mapstructure:"transitive_tag_keys" required:"false"`
}

AssumeRoleConfig lets users set configuration options for assuming a special role when executing Packer.

Usage example:

HCL config example:

```HCL

source "example" "amazon-ebs"{
	assume_role {
		role_arn     = "arn:aws:iam::ACCOUNT_ID:role/ROLE_NAME"
		session_name = "SESSION_NAME"
		external_id  = "EXTERNAL_ID"
	}
}

```

JSON config example:

```json

builder{
	"type": "amazon-ebs",
	"assume_role": {
		"role_arn"    :  "arn:aws:iam::ACCOUNT_ID:role/ROLE_NAME",
		"session_name":  "SESSION_NAME",
		"external_id" :  "EXTERNAL_ID"
	}
}

```

func (*AssumeRoleConfig) FlatMapstructure added in v1.6.3

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

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

type BlockDevice added in v0.3.2

type BlockDevice struct {
	// Indicates whether the EBS volume is deleted on instance termination.
	// Default false. NOTE: If this value is not explicitly set to true and
	// volumes are not cleaned up by an alternative method, additional volumes
	// will accumulate after every build.
	DeleteOnTermination bool `mapstructure:"delete_on_termination" required:"false"`
	// The device name exposed to the instance (for example, /dev/sdh or xvdh).
	// Required for every device in the block device mapping.
	DeviceName string `mapstructure:"device_name" required:"false"`
	// Indicates whether or not to encrypt the volume. By default, Packer will
	// keep the encryption setting to what it was in the source image. Setting
	// false will result in an unencrypted device, and true will result in an
	// encrypted one.
	Encrypted config.Trilean `mapstructure:"encrypted" required:"false"`
	// The number of I/O operations per second (IOPS) that the volume supports.
	// See the documentation on
	// [IOPs](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_EbsBlockDevice.html)
	// for more information
	IOPS *int64 `mapstructure:"iops" required:"false"`
	// Suppresses the specified device included in the block device mapping of
	// the AMI.
	NoDevice bool `mapstructure:"no_device" required:"false"`
	// The ID of the snapshot.
	SnapshotId string `mapstructure:"snapshot_id" required:"false"`
	// The throughput for gp3 volumes, only valid for gp3 types
	// See the documentation on
	// [Throughput](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_EbsBlockDevice.html)
	// for more information
	Throughput *int64 `mapstructure:"throughput" required:"false"`
	// The virtual device name. See the documentation on Block Device Mapping
	// for more information.
	VirtualName string `mapstructure:"virtual_name" required:"false"`
	// The volume type. gp2 & gp3 for General Purpose (SSD) volumes, io1 & io2
	// for Provisioned IOPS (SSD) volumes, st1 for Throughput Optimized HDD,
	// sc1 for Cold HDD, and standard for Magnetic volumes.
	VolumeType string `mapstructure:"volume_type" required:"false"`
	// The size of the volume, in GiB. Required if not specifying a
	// snapshot_id.
	VolumeSize int64 `mapstructure:"volume_size" required:"false"`
	// ID, alias or ARN of the KMS key to use for boot volume encryption.
	// This option exists for launch_block_device_mappings but not
	// ami_block_device_mappings. The kms key id defined here only applies to
	// the original build region; if the AMI gets copied to other regions, the
	// volume in those regions will be encrypted by the default EBS KMS key.
	// For valid formats see KmsKeyId in the [AWS API docs -
	// CopyImage](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CopyImage.html)
	// This field is validated by Packer. When using an alias, you will have to
	// prefix kms_key_id with alias/.
	KmsKeyId string `mapstructure:"kms_key_id" required:"false"`
}

These will be attached when launching your instance. Your options here may vary depending on the type of VM you use.

Example use case:

The following mapping will tell Packer to encrypt the root volume of the build instance at launch using a specific non-default kms key:

HCL2 example:

```hcl

launch_block_device_mappings {
    device_name = "/dev/sda1"
    encrypted = true
    kms_key_id = "1a2b3c4d-5e6f-1a2b-3c4d-5e6f1a2b3c4d"
}

```

JSON example: ```json launch_block_device_mappings: [

{
   "device_name": "/dev/sda1",
   "encrypted": true,
   "kms_key_id": "1a2b3c4d-5e6f-1a2b-3c4d-5e6f1a2b3c4d"
}

] ```

Please note that the kms_key_id option in this example exists for launch_block_device_mappings but not ami_block_device_mappings.

Documentation for Block Devices Mappings can be found here: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html

func (BlockDevice) BuildEC2BlockDeviceMapping added in v1.4.4

func (blockDevice BlockDevice) BuildEC2BlockDeviceMapping() *ec2.BlockDeviceMapping

func (*BlockDevice) FlatMapstructure added in v1.4.5

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

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

func (*BlockDevice) Prepare added in v1.2.0

func (b *BlockDevice) Prepare(ctx *interpolate.Context) error

type BlockDevices added in v0.3.2

type BlockDevices []BlockDevice

func (BlockDevices) BuildEC2BlockDeviceMappings added in v1.4.4

func (bds BlockDevices) BuildEC2BlockDeviceMappings() []*ec2.BlockDeviceMapping

func (BlockDevices) Prepare added in v0.7.0

func (bds BlockDevices) Prepare(ctx *interpolate.Context) (errs []error)

type BuildInfoTemplate added in v0.12.3

type BuildInfoTemplate struct {
	BuildRegion           string
	SourceAMI             string
	SourceAMICreationDate string
	SourceAMIName         string
	SourceAMIOwner        string
	SourceAMIOwnerName    string
	SourceAMITags         map[string]string
}

type EC2BlockDeviceMappingsBuilder added in v1.4.4

type EC2BlockDeviceMappingsBuilder interface {
	BuildEC2BlockDeviceMappings() []*ec2.BlockDeviceMapping
}

type EC2Tags added in v1.2.0

type EC2Tags []*ec2.Tag

func (EC2Tags) Report added in v1.2.0

func (t EC2Tags) Report(ui packersdk.Ui)

type FlatAWSPollingConfig added in v1.6.2

type FlatAWSPollingConfig struct {
	MaxAttempts  *int `mapstructure:"max_attempts" required:"false" cty:"max_attempts" hcl:"max_attempts"`
	DelaySeconds *int `mapstructure:"delay_seconds" required:"false" cty:"delay_seconds" hcl:"delay_seconds"`
}

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

func (*FlatAWSPollingConfig) HCL2Spec added in v1.6.2

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

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

type FlatAmiFilterOptions added in v1.4.5

type FlatAmiFilterOptions struct {
	Filters    map[string]string `mapstructure:"filters" cty:"filters" hcl:"filters"`
	Owners     []string          `mapstructure:"owners" cty:"owners" hcl:"owners"`
	MostRecent *bool             `mapstructure:"most_recent" cty:"most_recent" hcl:"most_recent"`
}

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

func (*FlatAmiFilterOptions) HCL2Spec added in v1.4.5

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

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

type FlatAssumeRoleConfig added in v1.6.3

type FlatAssumeRoleConfig struct {
	AssumeRoleARN               *string           `mapstructure:"role_arn" required:"false" cty:"role_arn" hcl:"role_arn"`
	AssumeRoleDurationSeconds   *int              `mapstructure:"duration_seconds" required:"false" cty:"duration_seconds" hcl:"duration_seconds"`
	AssumeRoleExternalID        *string           `mapstructure:"external_id" required:"false" cty:"external_id" hcl:"external_id"`
	AssumeRolePolicy            *string           `mapstructure:"policy" required:"false" cty:"policy" hcl:"policy"`
	AssumeRolePolicyARNs        []string          `mapstructure:"policy_arns" required:"false" cty:"policy_arns" hcl:"policy_arns"`
	AssumeRoleSessionName       *string           `mapstructure:"session_name" required:"false" cty:"session_name" hcl:"session_name"`
	AssumeRoleTags              map[string]string `mapstructure:"tags" required:"false" cty:"tags" hcl:"tags"`
	AssumeRoleTransitiveTagKeys []string          `mapstructure:"transitive_tag_keys" required:"false" cty:"transitive_tag_keys" hcl:"transitive_tag_keys"`
}

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

func (*FlatAssumeRoleConfig) HCL2Spec added in v1.6.3

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

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

type FlatBlockDevice added in v1.4.5

type FlatBlockDevice struct {
	DeleteOnTermination *bool   `mapstructure:"delete_on_termination" required:"false" cty:"delete_on_termination" hcl:"delete_on_termination"`
	DeviceName          *string `mapstructure:"device_name" required:"false" cty:"device_name" hcl:"device_name"`
	Encrypted           *bool   `mapstructure:"encrypted" required:"false" cty:"encrypted" hcl:"encrypted"`
	IOPS                *int64  `mapstructure:"iops" required:"false" cty:"iops" hcl:"iops"`
	NoDevice            *bool   `mapstructure:"no_device" required:"false" cty:"no_device" hcl:"no_device"`
	SnapshotId          *string `mapstructure:"snapshot_id" required:"false" cty:"snapshot_id" hcl:"snapshot_id"`
	Throughput          *int64  `mapstructure:"throughput" required:"false" cty:"throughput" hcl:"throughput"`
	VirtualName         *string `mapstructure:"virtual_name" required:"false" cty:"virtual_name" hcl:"virtual_name"`
	VolumeType          *string `mapstructure:"volume_type" required:"false" cty:"volume_type" hcl:"volume_type"`
	VolumeSize          *int64  `mapstructure:"volume_size" required:"false" cty:"volume_size" hcl:"volume_size"`
	KmsKeyId            *string `mapstructure:"kms_key_id" required:"false" cty:"kms_key_id" hcl:"kms_key_id"`
}

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

func (*FlatBlockDevice) HCL2Spec added in v1.4.5

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

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

type FlatMetadataOptions added in v1.7.0

type FlatMetadataOptions struct {
	HttpEndpoint            *string `mapstructure:"http_endpoint" required:"false" cty:"http_endpoint" hcl:"http_endpoint"`
	HttpTokens              *string `mapstructure:"http_tokens" required:"false" cty:"http_tokens" hcl:"http_tokens"`
	HttpPutResponseHopLimit *int64  `` /* 127-byte string literal not displayed */
}

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

func (*FlatMetadataOptions) HCL2Spec added in v1.7.0

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

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

type FlatPolicyDocument added in v1.4.5

type FlatPolicyDocument struct {
	Version   *string         `mapstructure:"Version" required:"false" cty:"Version" hcl:"Version"`
	Statement []FlatStatement `mapstructure:"Statement" required:"false" cty:"Statement" hcl:"Statement"`
}

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

func (*FlatPolicyDocument) HCL2Spec added in v1.4.5

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

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

type FlatSecurityGroupFilterOptions added in v1.4.5

type FlatSecurityGroupFilterOptions struct {
	Filters map[string]string      `cty:"filters" hcl:"filters"`
	Filter  []config.FlatNameValue `cty:"filter" hcl:"filter"`
}

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

func (*FlatSecurityGroupFilterOptions) HCL2Spec added in v1.4.5

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

type FlatStatement added in v1.4.5

type FlatStatement struct {
	Effect   *string  `mapstructure:"Effect" required:"false" cty:"Effect" hcl:"Effect"`
	Action   []string `mapstructure:"Action" required:"false" cty:"Action" hcl:"Action"`
	Resource []string `mapstructure:"Resource" required:"false" cty:"Resource" hcl:"Resource"`
}

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

func (*FlatStatement) HCL2Spec added in v1.4.5

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

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

type FlatSubnetFilterOptions added in v1.4.5

type FlatSubnetFilterOptions struct {
	Filters  map[string]string      `cty:"filters" hcl:"filters"`
	Filter   []config.FlatNameValue `cty:"filter" hcl:"filter"`
	MostFree *bool                  `mapstructure:"most_free" cty:"most_free" hcl:"most_free"`
	Random   *bool                  `mapstructure:"random" cty:"random" hcl:"random"`
}

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

func (*FlatSubnetFilterOptions) HCL2Spec added in v1.4.5

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

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

type FlatVaultAWSEngineOptions added in v1.4.5

type FlatVaultAWSEngineOptions struct {
	Name       *string `mapstructure:"name" cty:"name" hcl:"name"`
	RoleARN    *string `mapstructure:"role_arn" cty:"role_arn" hcl:"role_arn"`
	TTL        *string `mapstructure:"ttl" required:"false" cty:"ttl" hcl:"ttl"`
	EngineName *string `mapstructure:"engine_name" cty:"engine_name" hcl:"engine_name"`
}

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

func (*FlatVaultAWSEngineOptions) HCL2Spec added in v1.4.5

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

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

type FlatVpcFilterOptions added in v1.4.5

type FlatVpcFilterOptions struct {
	Filters map[string]string      `cty:"filters" hcl:"filters"`
	Filter  []config.FlatNameValue `cty:"filter" hcl:"filter"`
}

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

func (*FlatVpcFilterOptions) HCL2Spec added in v1.4.5

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

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

type MetadataOptions added in v1.7.0

type MetadataOptions struct {
	// A string to enable or disble the IMDS endpoint for an instance. Defaults to enabled.
	// Accepts either "enabled" or "disabled"
	HttpEndpoint string `mapstructure:"http_endpoint" required:"false"`
	// A string to either set the use of IMDSv2 for the instance to optional or required. Defaults to "optional".
	// Accepts either "optional" or "required"
	HttpTokens string `mapstructure:"http_tokens" required:"false"`
	// A numerical value to set an upper limit for the amount of hops allowed when communicating with IMDS endpoints.
	// Defaults to 1.
	HttpPutResponseHopLimit int64 `mapstructure:"http_put_response_hop_limit" required:"false"`
}

Configures the metadata options. See [Configure IMDS](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html) for details.

func (*MetadataOptions) FlatMapstructure added in v1.7.0

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

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

type PolicyDocument added in v1.4.5

type PolicyDocument struct {
	Version   string      `mapstructure:"Version" required:"false"`
	Statement []Statement `mapstructure:"Statement" required:"false"`
}

func (*PolicyDocument) FlatMapstructure added in v1.4.5

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

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

type RunConfig

type RunConfig struct {
	// If using a non-default VPC,
	// public IP addresses are not provided by default. If this is true, your
	// new instance will get a Public IP. default: false
	AssociatePublicIpAddress bool `mapstructure:"associate_public_ip_address" required:"false"`
	// Destination availability zone to launch
	// instance in. Leave this empty to allow Amazon to auto-assign.
	AvailabilityZone string `mapstructure:"availability_zone" required:"false"`
	// Requires spot_price to be set. The
	// required duration for the Spot Instances (also known as Spot blocks). This
	// value must be a multiple of 60 (60, 120, 180, 240, 300, or 360). You can't
	// specify an Availability Zone group or a launch group if you specify a
	// duration.
	BlockDurationMinutes int64 `mapstructure:"block_duration_minutes" required:"false"`
	// Packer normally stops the build instance after all provisioners have
	// run. For Windows instances, it is sometimes desirable to [run
	// Sysprep](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/Creating_EBSbacked_WinAMI.html)
	// which will stop the instance for you. If this is set to `true`, Packer
	// *will not* stop the instance but will assume that you will send the stop
	// signal yourself through your final provisioner. You can do this with a
	// [windows-shell provisioner](/docs/provisioners/windows-shell). Note that
	// Packer will still wait for the instance to be stopped, and failing to
	// send the stop signal yourself, when you have set this flag to `true`,
	// will cause a timeout.
	//
	// An example of a valid windows shutdown command in a `windows-shell`
	// provisioner is :
	// “`shell-session
	//   ec2config.exe -sysprep
	// “`
	// or
	// “`sell-session
	//   "%programfiles%\amazon\ec2configservice\"ec2config.exe -sysprep""
	// “`
	// -> Note: The double quotation marks in the command are not required if
	// your CMD shell is already in the
	// `C:\Program Files\Amazon\EC2ConfigService\` directory.
	DisableStopInstance bool `mapstructure:"disable_stop_instance" required:"false"`
	// Mark instance as [EBS
	// Optimized](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html).
	// Default `false`.
	EbsOptimized bool `mapstructure:"ebs_optimized" required:"false"`
	// Enabling T2 Unlimited allows the source instance to burst additional CPU
	// beyond its available [CPU
	// Credits](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-credits-baseline-concepts.html)
	// for as long as the demand exists. This is in contrast to the standard
	// configuration that only allows an instance to consume up to its
	// available CPU Credits. See the AWS documentation for [T2
	// Unlimited](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-unlimited.html)
	// and the **T2 Unlimited Pricing** section of the [Amazon EC2 On-Demand
	// Pricing](https://aws.amazon.com/ec2/pricing/on-demand/) document for
	// more information. By default this option is disabled and Packer will set
	// up a [T2
	// Standard](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-std.html)
	// instance instead.
	//
	// To use T2 Unlimited you must use a T2 instance type, e.g. `t2.micro`.
	// Additionally, T2 Unlimited cannot be used in conjunction with Spot
	// Instances, e.g. when the `spot_price` option has been configured.
	// Attempting to do so will cause an error.
	//
	// !> **Warning!** Additional costs may be incurred by enabling T2
	// Unlimited - even for instances that would usually qualify for the
	// [AWS Free Tier](https://aws.amazon.com/free/).
	EnableT2Unlimited bool `mapstructure:"enable_t2_unlimited" required:"false"`
	// The name of an [IAM instance
	// profile](https://docs.aws.amazon.com/IAM/latest/UserGuide/instance-profiles.html)
	// to launch the EC2 instance with.
	IamInstanceProfile string `mapstructure:"iam_instance_profile" required:"false"`
	// Whether or not to check if the IAM instance profile exists. Defaults to false
	SkipProfileValidation bool `mapstructure:"skip_profile_validation" required:"false"`
	// Temporary IAM instance profile policy document
	// If IamInstanceProfile is specified it will be used instead.
	//
	// HCL2 example:
	// “`hcl
	//temporary_iam_instance_profile_policy_document {
	//	Statement {
	//		Action   = ["logs:*"]
	//		Effect   = "Allow"
	//		Resource = "*"
	//	}
	//	Version = "2012-10-17"
	//}
	// “`
	//
	// JSON example:
	// “`json
	//{
	//	"Version": "2012-10-17",
	//	"Statement": [
	//		{
	//			"Action": [
	//			"logs:*"
	//			],
	//			"Effect": "Allow",
	//			"Resource": "*"
	//		}
	//	]
	//}
	// “`
	//
	TemporaryIamInstanceProfilePolicyDocument *PolicyDocument `mapstructure:"temporary_iam_instance_profile_policy_document" required:"false"`
	// Automatically terminate instances on
	// shutdown in case Packer exits ungracefully. Possible values are stop and
	// terminate. Defaults to stop.
	InstanceInitiatedShutdownBehavior string `mapstructure:"shutdown_behavior" required:"false"`
	// The EC2 instance type to use while building the
	// AMI, such as t2.small.
	InstanceType string `mapstructure:"instance_type" required:"true"`
	// Filters used to populate the `security_group_ids` field.
	//
	// HCL2 Example:
	//
	// “`hcl
	//   security_group_filter {
	//     filters = {
	//       "tag:Class": "packer"
	//     }
	//   }
	// “`
	//
	// JSON Example:
	// “`json
	// {
	//   "security_group_filter": {
	//     "filters": {
	//       "tag:Class": "packer"
	//     }
	//   }
	// }
	// “`
	//
	// This selects the SG's with tag `Class` with the value `packer`.
	//
	// -   `filters` (map of strings) - filters used to select a
	//     `security_group_ids`. Any filter described in the docs for
	//     [DescribeSecurityGroups](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeSecurityGroups.html)
	//     is valid.
	//
	// `security_group_ids` take precedence over this.
	SecurityGroupFilter SecurityGroupFilterOptions `mapstructure:"security_group_filter" required:"false"`
	// Key/value pair tags to apply to the instance that is that is *launched*
	// to create the EBS volumes. This is a [template
	// engine](/docs/templates/legacy_json_templates/engine), see [Build template
	// data](#build-template-data) for more information.
	RunTags map[string]string `mapstructure:"run_tags" required:"false"`
	// Same as [`run_tags`](#run_tags) but defined as a singular repeatable
	// block containing a `key` and a `value` field. In HCL2 mode the
	// [`dynamic_block`](/docs/templates/hcl_templates/expressions#dynamic-blocks)
	// will allow you to create those programatically.
	RunTag config.KeyValues `mapstructure:"run_tag" required:"false"`
	// The ID (not the name) of the security
	// group to assign to the instance. By default this is not set and Packer will
	// automatically create a new temporary security group to allow SSH access.
	// Note that if this is specified, you must be sure the security group allows
	// access to the ssh_port given below.
	SecurityGroupId string `mapstructure:"security_group_id" required:"false"`
	// A list of security groups as
	// described above. Note that if this is specified, you must omit the
	// security_group_id.
	SecurityGroupIds []string `mapstructure:"security_group_ids" required:"false"`
	// The source AMI whose root volume will be copied and
	// provisioned on the currently running instance. This must be an EBS-backed
	// AMI with a root volume snapshot that you have access to.
	SourceAmi string `mapstructure:"source_ami" required:"true"`
	// Filters used to populate the `source_ami`
	// field.
	//
	// HCL2 example:
	// “`hcl
	// source "amazon-ebs" "basic-example" {
	//   source_ami_filter {
	//     filters = {
	//        virtualization-type = "hvm"
	//        name = "ubuntu/images/\*ubuntu-xenial-16.04-amd64-server-\*"
	//        root-device-type = "ebs"
	//     }
	//     owners = ["099720109477"]
	//     most_recent = true
	//   }
	// }
	// “`
	//
	// JSON Example:
	// “`json
	// "builders" [
	//   {
	//     "type": "amazon-ebs",
	//     "source_ami_filter": {
	//        "filters": {
	//        "virtualization-type": "hvm",
	//        "name": "ubuntu/images/\*ubuntu-xenial-16.04-amd64-server-\*",
	//        "root-device-type": "ebs"
	//        },
	//        "owners": ["099720109477"],
	//        "most_recent": true
	//     }
	//   }
	// ]
	// “`
	//
	//   This selects the most recent Ubuntu 16.04 HVM EBS AMI from Canonical. NOTE:
	//   This will fail unless *exactly* one AMI is returned. In the above example,
	//   `most_recent` will cause this to succeed by selecting the newest image.
	//
	//   -   `filters` (map of strings) - filters used to select a `source_ami`.
	//       NOTE: This will fail unless *exactly* one AMI is returned. Any filter
	//       described in the docs for
	//       [DescribeImages](http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeImages.html)
	//       is valid.
	//
	//   -   `owners` (array of strings) - Filters the images by their owner. You
	//       may specify one or more AWS account IDs, "self" (which will use the
	//       account whose credentials you are using to run Packer), or an AWS owner
	//       alias: for example, `amazon`, `aws-marketplace`, or `microsoft`. This
	//       option is required for security reasons.
	//
	//   -   `most_recent` (boolean) - Selects the newest created image when true.
	//       This is most useful for selecting a daily distro build.
	//
	//   You may set this in place of `source_ami` or in conjunction with it. If you
	//   set this in conjunction with `source_ami`, the `source_ami` will be added
	//   to the filter. The provided `source_ami` must meet all of the filtering
	//   criteria provided in `source_ami_filter`; this pins the AMI returned by the
	//   filter, but will cause Packer to fail if the `source_ami` does not exist.
	SourceAmiFilter AmiFilterOptions `mapstructure:"source_ami_filter" required:"false"`
	// a list of acceptable instance
	// types to run your build on. We will request a spot instance using the max
	// price of spot_price and the allocation strategy of "lowest price".
	// Your instance will be launched on an instance type of the lowest available
	// price that you have in your list.  This is used in place of instance_type.
	// You may only set either spot_instance_types or instance_type, not both.
	// This feature exists to help prevent situations where a Packer build fails
	// because a particular availability zone does not have capacity for the
	// specific instance_type requested in instance_type.
	SpotInstanceTypes []string `mapstructure:"spot_instance_types" required:"false"`
	// With Spot Instances, you pay the Spot price that's in effect for the
	// time period your instances are running. Spot Instance prices are set by
	// Amazon EC2 and adjust gradually based on long-term trends in supply and
	// demand for Spot Instance capacity.
	//
	// When this field is set, it represents the maximum hourly price you are
	// willing to pay for a spot instance. If you do not set this value, it
	// defaults to a maximum price equal to the on demand price of the
	// instance. In the situation where the current Amazon-set spot price
	// exceeds the value set in this field, Packer will not launch an instance
	// and the build will error. In the situation where the Amazon-set spot
	// price is less than the value set in this field, Packer will launch and
	// you will pay the Amazon-set spot price, not this maximum value.
	// For more information, see the Amazon docs on
	// [spot pricing](https://aws.amazon.com/ec2/spot/pricing/).
	SpotPrice string `mapstructure:"spot_price" required:"false"`
	// Required if spot_price is set to
	// auto. This tells Packer what sort of AMI you're launching to find the
	// best spot price. This must be one of: Linux/UNIX, SUSE Linux,
	// Windows, Linux/UNIX (Amazon VPC), SUSE Linux (Amazon VPC),
	// Windows (Amazon VPC)
	SpotPriceAutoProduct string `mapstructure:"spot_price_auto_product" required:"false" undocumented:"true"`
	// Requires spot_price to be set. Key/value pair tags to apply tags to the
	// spot request that is issued.
	SpotTags map[string]string `mapstructure:"spot_tags" required:"false"`
	// Same as [`spot_tags`](#spot_tags) but defined as a singular repeatable block
	// containing a `key` and a `value` field. In HCL2 mode the
	// [`dynamic_block`](/docs/templates/hcl_templates/expressions#dynamic-blocks)
	// will allow you to create those programatically.
	SpotTag config.KeyValues `mapstructure:"spot_tag" required:"false"`
	// Filters used to populate the `subnet_id` field.
	//
	// HCL2 example:
	//
	// “`hcl
	// source "amazon-ebs" "basic-example" {
	//   subnet_filter {
	//     filters = {
	//           "tag:Class": "build"
	//     }
	//     most_free = true
	//     random = false
	//   }
	// }
	// “`
	//
	// JSON Example:
	// “`json
	// "builders" [
	//   {
	//     "type": "amazon-ebs",
	//     "subnet_filter": {
	//       "filters": {
	//         "tag:Class": "build"
	//       },
	//       "most_free": true,
	//       "random": false
	//     }
	//   }
	// ]
	// “`
	//
	//   This selects the Subnet with tag `Class` with the value `build`, which has
	//   the most free IP addresses. NOTE: This will fail unless *exactly* one
	//   Subnet is returned. By using `most_free` or `random` one will be selected
	//   from those matching the filter.
	//
	//   -   `filters` (map of strings) - filters used to select a `subnet_id`.
	//       NOTE: This will fail unless *exactly* one Subnet is returned. Any
	//       filter described in the docs for
	//       [DescribeSubnets](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeSubnets.html)
	//       is valid.
	//
	//   -   `most_free` (boolean) - The Subnet with the most free IPv4 addresses
	//       will be used if multiple Subnets matches the filter.
	//
	//   -   `random` (boolean) - A random Subnet will be used if multiple Subnets
	//       matches the filter. `most_free` have precendence over this.
	//
	//   `subnet_id` take precedence over this.
	SubnetFilter SubnetFilterOptions `mapstructure:"subnet_filter" required:"false"`
	// If using VPC, the ID of the subnet, such as
	// subnet-12345def, where Packer will launch the EC2 instance. This field is
	// required if you are using an non-default VPC.
	SubnetId string `mapstructure:"subnet_id" required:"false"`
	// [Tenancy](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/dedicated-instance.html) used
	// when Packer launches the EC2 instance, allowing it to be launched on dedicated hardware.
	//
	// The default is "default", meaning shared tenancy. Allowed values are "default",
	// "dedicated" and "host".
	Tenancy string `mapstructure:"tenancy" required:"false"`
	// A list of IPv4 CIDR blocks to be authorized access to the instance, when
	// packer is creating a temporary security group.
	//
	// The default is [`0.0.0.0/0`] (i.e., allow any IPv4 source). This is only
	// used when `security_group_id` or `security_group_ids` is not specified.
	TemporarySGSourceCidrs []string `mapstructure:"temporary_security_group_source_cidrs" 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"`
	// Filters used to populate the `vpc_id` field.
	//
	// HCL2 example:
	// “`hcl
	// source "amazon-ebs" "basic-example" {
	//   vpc_filter {
	//     filters = {
	//       "tag:Class": "build",
	//       "isDefault": "false",
	//       "cidr": "/24"
	//     }
	//   }
	// }
	// “`
	//
	// JSON Example:
	// “`json
	// "builders" [
	//   {
	//     "type": "amazon-ebs",
	//     "vpc_filter": {
	//       "filters": {
	//         "tag:Class": "build",
	//         "isDefault": "false",
	//         "cidr": "/24"
	//       }
	//     }
	//   }
	// ]
	// “`
	//
	// This selects the VPC with tag `Class` with the value `build`, which is not
	// the default VPC, and have a IPv4 CIDR block of `/24`. NOTE: This will fail
	// unless *exactly* one VPC is returned.
	//
	// -   `filters` (map of strings) - filters used to select a `vpc_id`. NOTE:
	//     This will fail unless *exactly* one VPC is returned. Any filter
	//     described in the docs for
	//     [DescribeVpcs](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeVpcs.html)
	//     is valid.
	//
	// `vpc_id` take precedence over this.
	VpcFilter VpcFilterOptions `mapstructure:"vpc_filter" required:"false"`
	// If launching into a VPC subnet, Packer needs the VPC ID
	// in order to create a temporary security group within the VPC. Requires
	// subnet_id to be set. If this field is left blank, Packer will try to get
	// the VPC ID from the subnet_id.
	VpcId string `mapstructure:"vpc_id" required:"false"`
	// The timeout for waiting for a Windows
	// password for Windows instances. Defaults to 20 minutes. Example value:
	// 10m
	WindowsPasswordTimeout time.Duration `mapstructure:"windows_password_timeout" required:"false"`

	// [Metadata Settings](#metadata-settings)
	Metadata MetadataOptions `mapstructure:"metadata_options" required:"false"`

	// Communicator settings
	Comm communicator.Config `mapstructure:",squash"`

	// One of `public_ip`, `private_ip`, `public_dns`, `private_dns` or `session_manager`.
	//    If set, either the public IP address, private IP address, public DNS name
	//    or private DNS name will be used as the host for SSH. The default behaviour
	//    if inside a VPC is to use the public IP address if available, otherwise
	//    the private IP address will be used. If not in a VPC the public DNS name
	//    will be used. Also works for WinRM.
	//
	//    Where Packer is configured for an outbound proxy but WinRM traffic
	//    should be direct, `ssh_interface` must be set to `private_dns` and
	//    `<region>.compute.internal` included in the `NO_PROXY` environment
	//    variable.
	//
	//    When using `session_manager` the machine running Packer must have
	//	  the AWS Session Manager Plugin installed and within the users' system path.
	//    Connectivity via the `session_manager` interface establishes a secure tunnel
	//    between the local host and the remote host on an available local port to the specified `ssh_port`.
	//    See [Session Manager Connections](#session-manager-connections) for more information.
	//    - Session manager connectivity is currently only implemented for the SSH communicator, not the WinRM communicator.
	//    - Upon termination the secure tunnel will be terminated automatically, if however there is a failure in
	//    terminating the tunnel it will automatically terminate itself after 20 minutes of inactivity.
	SSHInterface string `mapstructure:"ssh_interface"`

	// The time to wait before establishing the Session Manager session.
	// The value of this should be a duration. Examples are
	// `5s` and `1m30s` which will cause Packer to wait five seconds and one
	// minute 30 seconds, respectively. If no set, defaults to 10 seconds.
	// This option is useful when the remote port takes longer to become available.
	PauseBeforeSSM time.Duration `mapstructure:"pause_before_ssm"`

	// Which port to connect the local end of the session tunnel to. If
	// left blank, Packer will choose a port for you from available ports.
	// This option is only used when `ssh_interface` is set `session_manager`.
	SessionManagerPort int `mapstructure:"session_manager_port"`
}

RunConfig contains configuration for running an instance from a source AMI and details on how to access that launched image.

func (*RunConfig) IsSpotInstance added in v1.1.3

func (c *RunConfig) IsSpotInstance() bool

func (*RunConfig) Prepare

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

func (*RunConfig) SSMAgentEnabled added in v1.6.0

func (c *RunConfig) SSMAgentEnabled() bool

type SecurityGroupFilterOptions added in v1.3.2

type SecurityGroupFilterOptions struct {
	config.NameValueFilter `mapstructure:",squash"`
}

func (*SecurityGroupFilterOptions) FlatMapstructure added in v1.4.5

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

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

type StateChangeConf

type StateChangeConf struct {
	Pending   []string
	Refresh   StateRefreshFunc
	StepState multistep.StateBag
	Target    string
}

StateChangeConf is the configuration struct used for `WaitForState`.

type StateRefreshFunc added in v0.2.3

type StateRefreshFunc func() (result interface{}, state string, err error)

StateRefreshFunc is a function type used for StateChangeConf that is responsible for refreshing the item being watched for a state change.

It returns three results. `result` is any object that will be returned as the final object after waiting for state change. This allows you to return the final updated object, for example an EC2 instance after refreshing it.

`state` is the latest state of that object. And `err` is any error that may have happened while refreshing the state.

type Statement added in v1.4.5

type Statement struct {
	Effect   string   `mapstructure:"Effect" required:"false"`
	Action   []string `mapstructure:"Action" required:"false"`
	Resource []string `mapstructure:"Resource" required:"false"`
}

func (*Statement) FlatMapstructure added in v1.4.5

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

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

type StepAMIRegionCopy added in v0.3.5

type StepAMIRegionCopy struct {
	AccessConfig      *AccessConfig
	Regions           []string
	AMIKmsKeyId       string
	RegionKeyIds      map[string]string
	EncryptBootVolume config.Trilean // nil means preserve
	Name              string
	OriginalRegion    string

	AMISkipCreateImage bool
	AMISkipBuildRegion bool
	// contains filtered or unexported fields
}

func (*StepAMIRegionCopy) Cleanup added in v0.3.5

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

func (*StepAMIRegionCopy) DeduplicateRegions added in v1.4.3

func (s *StepAMIRegionCopy) DeduplicateRegions(intermediary bool)

func (*StepAMIRegionCopy) Run added in v0.3.5

type StepCleanupVolumes added in v1.3.0

type StepCleanupVolumes struct {
	LaunchMappings BlockDevices
}

stepCleanupVolumes cleans up any orphaned volumes that were not designated to remain after termination of the instance. These volumes are typically ones that are marked as "delete on terminate:false" in the source_ami of a build.

func (*StepCleanupVolumes) Cleanup added in v1.3.0

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

func (*StepCleanupVolumes) Run added in v1.3.0

type StepCreateSSMTunnel added in v1.6.0

type StepCreateSSMTunnel struct {
	AWSSession       *session.Session
	Region           string
	LocalPortNumber  int
	RemotePortNumber int
	SSMAgentEnabled  bool
	PauseBeforeSSM   time.Duration
	// contains filtered or unexported fields
}

func (*StepCreateSSMTunnel) Cleanup added in v1.6.0

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

Cleanup terminates an active session on AWS, which in turn terminates the associated tunnel process running on the local machine.

func (*StepCreateSSMTunnel) ConfigureLocalHostPort added in v1.6.0

func (s *StepCreateSSMTunnel) ConfigureLocalHostPort(ctx context.Context) error

ConfigureLocalHostPort finds an available port on the localhost that can be used for the remote tunnel. Defaults to using s.LocalPortNumber if it is set.

func (*StepCreateSSMTunnel) Run added in v1.6.0

Run executes the Packer build step that creates a session tunnel.

type StepCreateTags added in v0.2.3

type StepCreateTags struct {
	AMISkipCreateImage bool

	Tags         map[string]string
	SnapshotTags map[string]string
	Ctx          interpolate.Context
}

func (*StepCreateTags) Cleanup added in v0.2.3

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

func (*StepCreateTags) Run added in v0.2.3

type StepDeregisterAMI added in v0.8.0

type StepDeregisterAMI struct {
	AccessConfig        *AccessConfig
	ForceDeregister     bool
	ForceDeleteSnapshot bool
	AMIName             string
	Regions             []string
}

func (*StepDeregisterAMI) Cleanup added in v0.8.0

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

func (*StepDeregisterAMI) Run added in v0.8.0

type StepGetPassword added in v0.8.0

type StepGetPassword struct {
	Debug     bool
	Comm      *communicator.Config
	Timeout   time.Duration
	BuildName string
}

StepGetPassword reads the password from a Windows server and sets it on the WinRM config.

func (*StepGetPassword) Cleanup added in v0.8.0

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

func (*StepGetPassword) Run added in v0.8.0

type StepIamInstanceProfile added in v1.4.5

type StepIamInstanceProfile struct {
	IamInstanceProfile                        string
	SkipProfileValidation                     bool
	TemporaryIamInstanceProfilePolicyDocument *PolicyDocument
	// contains filtered or unexported fields
}

func (*StepIamInstanceProfile) Cleanup added in v1.4.5

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

func (*StepIamInstanceProfile) Run added in v1.4.5

type StepKeyPair

type StepKeyPair struct {
	Debug        bool
	Comm         *communicator.Config
	DebugKeyPath string
	// contains filtered or unexported fields
}

func (*StepKeyPair) Cleanup

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

func (*StepKeyPair) Run

type StepModifyAMIAttributes added in v0.3.0

type StepModifyAMIAttributes struct {
	AMISkipCreateImage bool

	Users          []string
	Groups         []string
	SnapshotUsers  []string
	SnapshotGroups []string
	ProductCodes   []string
	Description    string
	Ctx            interpolate.Context

	GeneratedData *packerbuilderdata.GeneratedData
}

func (*StepModifyAMIAttributes) Cleanup added in v0.3.0

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

func (*StepModifyAMIAttributes) Run added in v0.3.0

type StepModifyEBSBackedInstance added in v0.12.0

type StepModifyEBSBackedInstance struct {
	Skip                     bool
	EnableAMIENASupport      confighelper.Trilean
	EnableAMISriovNetSupport bool
}

func (*StepModifyEBSBackedInstance) Cleanup added in v0.12.0

func (*StepModifyEBSBackedInstance) Run added in v0.12.0

type StepNetworkInfo added in v1.3.2

type StepNetworkInfo struct {
	VpcId               string
	VpcFilter           VpcFilterOptions
	SubnetId            string
	SubnetFilter        SubnetFilterOptions
	AvailabilityZone    string
	SecurityGroupIds    []string
	SecurityGroupFilter SecurityGroupFilterOptions
}

StepNetworkInfo queries AWS for information about VPC's and Subnets that is used throughout the AMI creation process.

Produces (adding them to the state bag):

vpc_id string - the VPC ID
subnet_id string - the Subnet ID
availability_zone string - the AZ name

func (*StepNetworkInfo) Cleanup added in v1.3.2

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

func (*StepNetworkInfo) Run added in v1.3.2

type StepPreValidate added in v0.8.0

type StepPreValidate struct {
	DestAmiName        string
	ForceDeregister    bool
	AMISkipBuildRegion bool
	VpcId              string
	SubnetId           string
	HasSubnetFilter    bool
}

StepPreValidate provides an opportunity to pre-validate any configuration for the build before actually doing any time consuming work

func (*StepPreValidate) Cleanup added in v0.8.0

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

Cleanup ...

func (*StepPreValidate) Run added in v0.8.0

type StepRunSourceInstance

type StepRunSourceInstance struct {
	PollingConfig                     *AWSPollingConfig
	AssociatePublicIpAddress          bool
	LaunchMappings                    EC2BlockDeviceMappingsBuilder
	Comm                              *communicator.Config
	Ctx                               interpolate.Context
	Debug                             bool
	EbsOptimized                      bool
	EnableT2Unlimited                 bool
	ExpectedRootDevice                string
	HttpEndpoint                      string
	HttpTokens                        string
	HttpPutResponseHopLimit           int64
	InstanceInitiatedShutdownBehavior string
	InstanceType                      string
	IsRestricted                      bool
	SourceAMI                         string
	Tags                              map[string]string
	Tenancy                           string
	UserData                          string
	UserDataFile                      string
	VolumeTags                        map[string]string
	NoEphemeral                       bool
	// contains filtered or unexported fields
}

func (*StepRunSourceInstance) Cleanup

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

func (*StepRunSourceInstance) Run

type StepRunSpotInstance added in v1.1.1

type StepRunSpotInstance struct {
	PollingConfig                     *AWSPollingConfig
	AssociatePublicIpAddress          bool
	LaunchMappings                    EC2BlockDeviceMappingsBuilder
	BlockDurationMinutes              int64
	Debug                             bool
	Comm                              *communicator.Config
	EbsOptimized                      bool
	ExpectedRootDevice                string
	HttpEndpoint                      string
	HttpTokens                        string
	HttpPutResponseHopLimit           int64
	InstanceInitiatedShutdownBehavior string
	InstanceType                      string
	Region                            string
	SourceAMI                         string
	SpotPrice                         string
	SpotTags                          map[string]string
	SpotInstanceTypes                 []string
	Tags                              map[string]string
	VolumeTags                        map[string]string
	UserData                          string
	UserDataFile                      string
	Ctx                               interpolate.Context
	NoEphemeral                       bool
	// contains filtered or unexported fields
}

func (*StepRunSpotInstance) Cleanup added in v1.1.1

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

func (*StepRunSpotInstance) CreateTemplateData added in v1.4.2

func (*StepRunSpotInstance) LoadUserData added in v1.4.2

func (s *StepRunSpotInstance) LoadUserData() (string, error)

func (*StepRunSpotInstance) Run added in v1.1.1

type StepSecurityGroup

type StepSecurityGroup struct {
	CommConfig             *communicator.Config
	SecurityGroupFilter    SecurityGroupFilterOptions
	SecurityGroupIds       []string
	TemporarySGSourceCidrs []string
	SkipSSHRuleCreation    bool
	// contains filtered or unexported fields
}

func (*StepSecurityGroup) Cleanup

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

func (*StepSecurityGroup) Run

type StepSetGeneratedData added in v1.6.2

type StepSetGeneratedData struct {
	GeneratedData *packerbuilderdata.GeneratedData
}

func (*StepSetGeneratedData) Cleanup added in v1.6.2

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

func (*StepSetGeneratedData) Run added in v1.6.2

type StepSourceAMIInfo added in v0.6.1

type StepSourceAMIInfo struct {
	SourceAmi                string
	EnableAMISriovNetSupport bool
	EnableAMIENASupport      confighelper.Trilean
	AMIVirtType              string
	AmiFilters               AmiFilterOptions
}

StepSourceAMIInfo extracts critical information from the source AMI that is used throughout the AMI creation process.

Produces:

source_image *ec2.Image - the source AMI info

func (*StepSourceAMIInfo) Cleanup added in v0.6.1

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

func (*StepSourceAMIInfo) Run added in v0.6.1

type StepStopEBSBackedInstance added in v0.12.0

type StepStopEBSBackedInstance struct {
	PollingConfig       *AWSPollingConfig
	Skip                bool
	DisableStopInstance bool
}

func (*StepStopEBSBackedInstance) Cleanup added in v0.12.0

func (*StepStopEBSBackedInstance) Run added in v0.12.0

type SubnetFilterOptions added in v1.3.2

type SubnetFilterOptions struct {
	config.NameValueFilter `mapstructure:",squash"`
	MostFree               bool `mapstructure:"most_free"`
	Random                 bool `mapstructure:"random"`
}

func (*SubnetFilterOptions) FlatMapstructure added in v1.4.5

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

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

type TagMap added in v1.2.0

type TagMap map[string]string

func (TagMap) EC2Tags added in v1.2.0

func (t TagMap) EC2Tags(ictx interpolate.Context, region string, state multistep.StateBag) (EC2Tags, error)

type VaultAWSEngineOptions added in v1.3.5

type VaultAWSEngineOptions struct {
	Name    string `mapstructure:"name"`
	RoleARN string `mapstructure:"role_arn"`
	// Specifies the TTL for the use of the STS token. This
	// is specified as a string with a duration suffix. Valid only when
	// credential_type is assumed_role or federation_token. When not
	// specified, the default_sts_ttl set for the role will be used. If that
	// is also not set, then the default value of 3600s will be used. AWS
	// places limits on the maximum TTL allowed. See the AWS documentation on
	// the DurationSeconds parameter for AssumeRole (for assumed_role
	// credential types) and GetFederationToken (for federation_token
	// credential types) for more details.
	TTL        string `mapstructure:"ttl" required:"false"`
	EngineName string `mapstructure:"engine_name"`
}

func (*VaultAWSEngineOptions) Empty added in v1.3.5

func (v *VaultAWSEngineOptions) Empty() bool

func (*VaultAWSEngineOptions) FlatMapstructure added in v1.4.5

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

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

type VpcFilterOptions added in v1.3.2

type VpcFilterOptions struct {
	config.NameValueFilter `mapstructure:",squash"`
}

func (*VpcFilterOptions) FlatMapstructure added in v1.4.5

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

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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