ebssurrogate

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Overview

The ebssurrogate package contains a packer.Builder implementation that builds a new EBS-backed AMI using an ephemeral instance.

Index

Constants

View Source
const BuilderId = "mitchellh.amazon.ebssurrogate"

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockDevice added in v1.4.4

type BlockDevice struct {
	awscommon.BlockDevice `mapstructure:",squash"`

	// If true, this block device will not be snapshotted and the created AMI
	// will not contain block device mapping information for this volume. If
	// false, the block device will be mapped into the final created AMI. Set
	// this option to true if you need a block device mounted in the surrogate
	// AMI but not in the final created AMI.
	OmitFromArtifact bool `mapstructure:"omit_from_artifact"`
}

func (BlockDevice) BuildEC2BlockDeviceMapping added in v1.4.4

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

type BlockDevices added in v1.4.4

type BlockDevices []BlockDevice

func (BlockDevices) BuildEC2BlockDeviceMappings added in v1.4.4

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

func (BlockDevices) Common added in v1.4.4

func (bds BlockDevices) Common() []awscommon.BlockDevice

func (BlockDevices) GetOmissions added in v1.4.4

func (b BlockDevices) GetOmissions() map[string]bool

func (BlockDevices) Prepare added in v1.4.4

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

type Builder

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

func (*Builder) Prepare

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

func (*Builder) Run

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

type Config

type Config struct {
	common.PackerConfig    `mapstructure:",squash"`
	awscommon.AccessConfig `mapstructure:",squash"`
	awscommon.RunConfig    `mapstructure:",squash"`
	awscommon.AMIConfig    `mapstructure:",squash"`

	// Add one or more block device mappings to the AMI. These will be attached
	// when booting a new instance from your AMI. To add a block device during
	// the Packer build see `launch_block_device_mappings` below. Your options
	// here may vary depending on the type of VM you use. See the
	// [BlockDevices](#block-devices-configuration) documentation for fields.
	AMIMappings awscommon.BlockDevices `mapstructure:"ami_block_device_mappings" required:"false"`
	// Add one or more block devices before the Packer build starts. If you add
	// instance store volumes or EBS volumes in addition to the root device
	// volume, the created AMI will contain block device mapping information
	// for those volumes. Amazon creates snapshots of the source instance's
	// root volume and any other EBS volumes described here. When you launch an
	// instance from this new AMI, the instance automatically launches with
	// these additional volumes, and will restore them from snapshots taken
	// from the source instance. See the
	// [BlockDevices](#block-devices-configuration) documentation for fields.
	LaunchMappings BlockDevices `mapstructure:"launch_block_device_mappings" required:"false"`
	// A block device mapping describing the root device of the AMI. This looks
	// like the mappings in `ami_block_device_mapping`, except with an
	// additional field:
	//
	// -   `source_device_name` (string) - The device name of the block device on
	//     the source instance to be used as the root device for the AMI. This
	//     must correspond to a block device in `launch_block_device_mapping`.
	RootDevice RootBlockDevice `mapstructure:"ami_root_device" required:"true"`
	// Tags to apply to the volumes that are *launched* to create the AMI.
	// These tags are *not* applied to the resulting AMI unless they're
	// duplicated in `tags`. This is a [template
	// engine](/docs/templates/engine.html), see [Build template
	// data](#build-template-data) for more information.
	VolumeRunTags awscommon.TagMap `mapstructure:"run_volume_tags"`
	// what architecture to use when registering the
	// final AMI; valid options are "x86_64" or "arm64". Defaults to "x86_64".
	Architecture string `mapstructure:"ami_architecture" required:"false"`
	// contains filtered or unexported fields
}

type RootBlockDevice

type RootBlockDevice struct {
	SourceDeviceName string `mapstructure:"source_device_name"`
	// 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 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 number of I/O operations per second (IOPS) that
	// the volume supports. See the documentation on
	// IOPs
	// for more information
	IOPS int64 `mapstructure:"iops" required:"false"`
	// The volume type. gp2 for General Purpose
	// (SSD) volumes, io1 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"`
}

func (*RootBlockDevice) Prepare

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

type StepRegisterAMI

type StepRegisterAMI struct {
	RootDevice               RootBlockDevice
	AMIDevices               []*ec2.BlockDeviceMapping
	LaunchDevices            []*ec2.BlockDeviceMapping
	EnableAMIENASupport      confighelper.Trilean
	EnableAMISriovNetSupport bool
	Architecture             string

	LaunchOmitMap map[string]bool
	// contains filtered or unexported fields
}

StepRegisterAMI creates the AMI.

func (*StepRegisterAMI) Cleanup

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

func (*StepRegisterAMI) Run

type StepSnapshotVolumes added in v1.2.3

type StepSnapshotVolumes struct {
	LaunchDevices []*ec2.BlockDeviceMapping

	SnapshotOmitMap map[string]bool
	// contains filtered or unexported fields
}

StepSnapshotVolumes creates snapshots of the created volumes.

Produces:

snapshot_ids map[string]string - IDs of the created snapshots

func (*StepSnapshotVolumes) Cleanup added in v1.2.3

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

func (*StepSnapshotVolumes) Run added in v1.2.3

Jump to

Keyboard shortcuts

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