Documentation
¶
Index ¶
- Variables
- func ConvertToEC2Tags(tags map[string]string, region, sourceAmiId string, ctx interpolate.Context) ([]*ec2.Tag, error)
- func GetInstanceMetaData(path string) (contents []byte, err error)
- func SSHConfig(useAgent bool, username, password string) func(multistep.StateBag) (*ssh.ClientConfig, error)
- func SSHHost(e ec2Describer, private bool) func(multistep.StateBag) (string, error)
- func SleepSeconds() (seconds int)
- func TimeoutSeconds() (seconds int)
- func ValidateRegion(region string) bool
- func WaitForState(conf *StateChangeConf) (i interface{}, err error)
- type AMIBlockDevices
- type AMIConfig
- type AccessConfig
- type AmiFilterOptions
- type Artifact
- type BlockDevice
- type BlockDevices
- type BuildInfoTemplate
- type CLIConfig
- type LaunchBlockDevices
- type RunConfig
- type StateChangeConf
- type StateRefreshFunc
- func AMIStateRefreshFunc(conn *ec2.EC2, imageId string) StateRefreshFunc
- func ImportImageRefreshFunc(conn *ec2.EC2, importTaskId string) StateRefreshFunc
- func InstanceStateRefreshFunc(conn *ec2.EC2, instanceId string) StateRefreshFunc
- func SpotRequestStateRefreshFunc(conn *ec2.EC2, spotRequestId string) StateRefreshFunc
- type StepAMIRegionCopy
- type StepCreateEncryptedAMICopy
- type StepCreateTags
- type StepDeregisterAMI
- type StepGetPassword
- type StepKeyPair
- type StepModifyAMIAttributes
- type StepModifyEBSBackedInstance
- type StepPreValidate
- type StepRunSourceInstance
- type StepSecurityGroup
- type StepSourceAMIInfo
- type StepStopEBSBackedInstance
- type StepTagEBSVolumes
Constants ¶
This section is empty.
Variables ¶
var TemplateFuncs = template.FuncMap{
"clean_ami_name": templateCleanAMIName,
}
Functions ¶
func ConvertToEC2Tags ¶ added in v0.12.1
func GetInstanceMetaData ¶ added in v0.8.0
func SSHConfig ¶
func SSHConfig(useAgent bool, username, password string) func(multistep.StateBag) (*ssh.ClientConfig, error)
SSHConfig returns a function that can be used for the SSH communicator config for connecting to the instance created over SSH using the private key or password.
func SSHHost ¶ added in v0.8.0
SSHHost returns a function that can be given to the SSH communicator for determining the SSH address based on the instance DNS name.
func SleepSeconds ¶ added in v0.12.0
func SleepSeconds() (seconds int)
Returns 2 seconds by default AWS async operations sometimes takes long times, if there are multiple parallel builds, polling at 2 second frequency will exceed the request limit. Allow 2 seconds to be overwritten with AWS_POLL_DELAY_SECONDS
func TimeoutSeconds ¶ added in v0.7.2
func TimeoutSeconds() (seconds int)
Returns 300 seconds (5 minutes) by default Some AWS operations, like copying an AMI to a distant region, take a very long time Allow user to override with AWS_TIMEOUT_SECONDS environment variable
func ValidateRegion ¶ added in v0.8.0
ValidateRegion returns true if the supplied region is a valid AWS region and false if it's not.
func WaitForState ¶
func WaitForState(conf *StateChangeConf) (i interface{}, err error)
WaitForState watches an object and waits for it to achieve a certain state.
Types ¶
type AMIBlockDevices ¶ added in v0.11.0
type AMIBlockDevices struct {
AMIMappings []BlockDevice `mapstructure:"ami_block_device_mappings"`
}
func (*AMIBlockDevices) BuildAMIDevices ¶ added in v0.11.0
func (b *AMIBlockDevices) BuildAMIDevices() []*ec2.BlockDeviceMapping
type AMIConfig ¶ added in v0.3.0
type AMIConfig struct {
AMIName string `mapstructure:"ami_name"`
AMIDescription string `mapstructure:"ami_description"`
AMIVirtType string `mapstructure:"ami_virtualization_type"`
AMIUsers []string `mapstructure:"ami_users"`
AMIGroups []string `mapstructure:"ami_groups"`
AMIProductCodes []string `mapstructure:"ami_product_codes"`
AMIRegions []string `mapstructure:"ami_regions"`
AMISkipRegionValidation bool `mapstructure:"skip_region_validation"`
AMITags map[string]string `mapstructure:"tags"`
AMIEnhancedNetworking bool `mapstructure:"enhanced_networking"`
AMIForceDeregister bool `mapstructure:"force_deregister"`
AMIForceDeleteSnapshot bool `mapstructure:"force_delete_snapshot"`
AMIEncryptBootVolume bool `mapstructure:"encrypt_boot"`
AMIKmsKeyId string `mapstructure:"kms_key_id"`
SnapshotTags map[string]string `mapstructure:"snapshot_tags"`
SnapshotUsers []string `mapstructure:"snapshot_users"`
SnapshotGroups []string `mapstructure:"snapshot_groups"`
}
AMIConfig is for common configuration related to creating AMIs.
type AccessConfig ¶
type AccessConfig struct {
AccessKey string `mapstructure:"access_key"`
SecretKey string `mapstructure:"secret_key"`
RawRegion string `mapstructure:"region"`
SkipValidation bool `mapstructure:"skip_region_validation"`
Token string `mapstructure:"token"`
ProfileName string `mapstructure:"profile"`
}
AccessConfig is for common configuration related to AWS access
func (*AccessConfig) Config ¶ added in v0.8.0
func (c *AccessConfig) Config() (*aws.Config, 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) Prepare ¶
func (c *AccessConfig) Prepare(ctx *interpolate.Context) []error
func (*AccessConfig) Region ¶ added in v0.2.2
func (c *AccessConfig) Region() (string, error)
Region returns the aws.Region object for access to AWS services, requesting the region from the instance metadata if possible.
type AmiFilterOptions ¶ added in v0.12.0
type AmiFilterOptions struct {
Filters map[*string]*string
Owners []*string
MostRecent bool `mapstructure:"most_recent"`
}
func (*AmiFilterOptions) Empty ¶ added in v0.12.0
func (d *AmiFilterOptions) Empty() 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
// EC2 connection for performing API stuff.
Conn *ec2.EC2
}
Artifact is an artifact implementation that contains built AMIs.
type BlockDevice ¶ added in v0.3.2
type BlockDevice struct {
DeleteOnTermination bool `mapstructure:"delete_on_termination"`
DeviceName string `mapstructure:"device_name"`
Encrypted bool `mapstructure:"encrypted"`
IOPS int64 `mapstructure:"iops"`
NoDevice bool `mapstructure:"no_device"`
SnapshotId string `mapstructure:"snapshot_id"`
VirtualName string `mapstructure:"virtual_name"`
VolumeType string `mapstructure:"volume_type"`
VolumeSize int64 `mapstructure:"volume_size"`
}
BlockDevice
type BlockDevices ¶ added in v0.3.2
type BlockDevices struct {
AMIBlockDevices `mapstructure:",squash"`
LaunchBlockDevices `mapstructure:",squash"`
}
func (*BlockDevices) Prepare ¶ added in v0.7.0
func (b *BlockDevices) Prepare(ctx *interpolate.Context) []error
type BuildInfoTemplate ¶ added in v0.12.3
type CLIConfig ¶ added in v0.9.0
type CLIConfig struct {
ProfileName string
SourceProfile string
AssumeRoleInput *sts.AssumeRoleInput
SourceCredentials *credentials.Credentials
// contains filtered or unexported fields
}
func NewFromProfile ¶ added in v0.9.0
Return a new CLIConfig with stored profile settings
func (*CLIConfig) CredentialsFromProfile ¶ added in v0.9.0
func (c *CLIConfig) CredentialsFromProfile(conf *aws.Config) (*credentials.Credentials, error)
Return AWS Credentials using current profile. Must supply source config.
type LaunchBlockDevices ¶ added in v0.11.0
type LaunchBlockDevices struct {
LaunchMappings []BlockDevice `mapstructure:"launch_block_device_mappings"`
}
func (*LaunchBlockDevices) BuildLaunchDevices ¶ added in v0.11.0
func (b *LaunchBlockDevices) BuildLaunchDevices() []*ec2.BlockDeviceMapping
type RunConfig ¶
type RunConfig struct {
AssociatePublicIpAddress bool `mapstructure:"associate_public_ip_address"`
AvailabilityZone string `mapstructure:"availability_zone"`
EbsOptimized bool `mapstructure:"ebs_optimized"`
IamInstanceProfile string `mapstructure:"iam_instance_profile"`
InstanceType string `mapstructure:"instance_type"`
RunTags map[string]string `mapstructure:"run_tags"`
SourceAmi string `mapstructure:"source_ami"`
SourceAmiFilter AmiFilterOptions `mapstructure:"source_ami_filter"`
SpotPrice string `mapstructure:"spot_price"`
SpotPriceAutoProduct string `mapstructure:"spot_price_auto_product"`
DisableStopInstance bool `mapstructure:"disable_stop_instance"`
SecurityGroupId string `mapstructure:"security_group_id"`
SecurityGroupIds []string `mapstructure:"security_group_ids"`
SubnetId string `mapstructure:"subnet_id"`
TemporaryKeyPairName string `mapstructure:"temporary_key_pair_name"`
UserData string `mapstructure:"user_data"`
UserDataFile string `mapstructure:"user_data_file"`
WindowsPasswordTimeout time.Duration `mapstructure:"windows_password_timeout"`
VpcId string `mapstructure:"vpc_id"`
InstanceInitiatedShutdownBehavior string `mapstructure:"shutdown_behavior"`
// Communicator settings
Comm communicator.Config `mapstructure:",squash"`
SSHKeyPairName string `mapstructure:"ssh_keypair_name"`
SSHPrivateIp bool `mapstructure:"ssh_private_ip"`
}
RunConfig contains configuration for running an instance from a source AMI and details on how to access that launched image.
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
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.
func AMIStateRefreshFunc ¶ added in v0.3.8
func AMIStateRefreshFunc(conn *ec2.EC2, imageId string) StateRefreshFunc
AMIStateRefreshFunc returns a StateRefreshFunc that is used to watch an AMI for state changes.
func ImportImageRefreshFunc ¶ added in v0.9.0
func ImportImageRefreshFunc(conn *ec2.EC2, importTaskId string) StateRefreshFunc
func InstanceStateRefreshFunc ¶ added in v0.2.2
func InstanceStateRefreshFunc(conn *ec2.EC2, instanceId string) StateRefreshFunc
InstanceStateRefreshFunc returns a StateRefreshFunc that is used to watch an EC2 instance.
func SpotRequestStateRefreshFunc ¶ added in v0.7.0
func SpotRequestStateRefreshFunc(conn *ec2.EC2, spotRequestId string) StateRefreshFunc
SpotRequestStateRefreshFunc returns a StateRefreshFunc that is used to watch a spot request for state changes.
type StepAMIRegionCopy ¶ added in v0.3.5
type StepAMIRegionCopy struct {
AccessConfig *AccessConfig
Regions []string
Name string
}
func (*StepAMIRegionCopy) Cleanup ¶ added in v0.3.5
func (s *StepAMIRegionCopy) Cleanup(state multistep.StateBag)
func (*StepAMIRegionCopy) Run ¶ added in v0.3.5
func (s *StepAMIRegionCopy) Run(state multistep.StateBag) multistep.StepAction
type StepCreateEncryptedAMICopy ¶ added in v0.12.3
type StepCreateEncryptedAMICopy struct {
KeyID string
EncryptBootVolume bool
Name string
// contains filtered or unexported fields
}
func (*StepCreateEncryptedAMICopy) Cleanup ¶ added in v0.12.3
func (s *StepCreateEncryptedAMICopy) Cleanup(state multistep.StateBag)
func (*StepCreateEncryptedAMICopy) Run ¶ added in v0.12.3
func (s *StepCreateEncryptedAMICopy) Run(state multistep.StateBag) multistep.StepAction
type StepCreateTags ¶ added in v0.2.3
type StepCreateTags struct {
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
func (s *StepCreateTags) Run(state multistep.StateBag) multistep.StepAction
type StepDeregisterAMI ¶ added in v0.8.0
func (*StepDeregisterAMI) Cleanup ¶ added in v0.8.0
func (s *StepDeregisterAMI) Cleanup(state multistep.StateBag)
func (*StepDeregisterAMI) Run ¶ added in v0.8.0
func (s *StepDeregisterAMI) Run(state multistep.StateBag) multistep.StepAction
type StepGetPassword ¶ added in v0.8.0
type StepGetPassword struct {
Debug bool
Comm *communicator.Config
Timeout time.Duration
}
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
func (s *StepGetPassword) Run(state multistep.StateBag) multistep.StepAction
type StepKeyPair ¶
type StepKeyPair struct {
Debug bool
SSHAgentAuth bool
DebugKeyPath string
TemporaryKeyPairName string
KeyPairName string
PrivateKeyFile string
// contains filtered or unexported fields
}
func (*StepKeyPair) Cleanup ¶
func (s *StepKeyPair) Cleanup(state multistep.StateBag)
func (*StepKeyPair) Run ¶
func (s *StepKeyPair) Run(state multistep.StateBag) multistep.StepAction
type StepModifyAMIAttributes ¶ added in v0.3.0
type StepModifyAMIAttributes struct {
Users []string
Groups []string
SnapshotUsers []string
SnapshotGroups []string
ProductCodes []string
Description string
Ctx interpolate.Context
}
func (*StepModifyAMIAttributes) Cleanup ¶ added in v0.3.0
func (s *StepModifyAMIAttributes) Cleanup(state multistep.StateBag)
func (*StepModifyAMIAttributes) Run ¶ added in v0.3.0
func (s *StepModifyAMIAttributes) Run(state multistep.StateBag) multistep.StepAction
type StepModifyEBSBackedInstance ¶ added in v0.12.0
type StepModifyEBSBackedInstance struct {
EnableEnhancedNetworking bool
}
func (*StepModifyEBSBackedInstance) Cleanup ¶ added in v0.12.0
func (s *StepModifyEBSBackedInstance) Cleanup(state multistep.StateBag)
func (*StepModifyEBSBackedInstance) Run ¶ added in v0.12.0
func (s *StepModifyEBSBackedInstance) Run(state multistep.StateBag) multistep.StepAction
type StepPreValidate ¶ added in v0.8.0
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)
func (*StepPreValidate) Run ¶ added in v0.8.0
func (s *StepPreValidate) Run(state multistep.StateBag) multistep.StepAction
type StepRunSourceInstance ¶
type StepRunSourceInstance struct {
AssociatePublicIpAddress bool
AvailabilityZone string
BlockDevices BlockDevices
Debug bool
EbsOptimized bool
ExpectedRootDevice string
IamInstanceProfile string
InstanceInitiatedShutdownBehavior string
InstanceType string
SourceAMI string
SpotPrice string
SpotPriceProduct string
SubnetId string
Tags map[string]string
UserData string
UserDataFile string
Ctx interpolate.Context
// contains filtered or unexported fields
}
func (*StepRunSourceInstance) Cleanup ¶
func (s *StepRunSourceInstance) Cleanup(state multistep.StateBag)
func (*StepRunSourceInstance) Run ¶
func (s *StepRunSourceInstance) Run(state multistep.StateBag) multistep.StepAction
type StepSecurityGroup ¶
type StepSecurityGroup struct {
CommConfig *communicator.Config
SecurityGroupIds []string
VpcId string
// contains filtered or unexported fields
}
func (*StepSecurityGroup) Cleanup ¶
func (s *StepSecurityGroup) Cleanup(state multistep.StateBag)
func (*StepSecurityGroup) Run ¶
func (s *StepSecurityGroup) Run(state multistep.StateBag) multistep.StepAction
type StepSourceAMIInfo ¶ added in v0.6.1
type StepSourceAMIInfo struct {
SourceAmi string
EnhancedNetworking bool
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
func (s *StepSourceAMIInfo) Run(state multistep.StateBag) multistep.StepAction
type StepStopEBSBackedInstance ¶ added in v0.12.0
func (*StepStopEBSBackedInstance) Cleanup ¶ added in v0.12.0
func (s *StepStopEBSBackedInstance) Cleanup(multistep.StateBag)
func (*StepStopEBSBackedInstance) Run ¶ added in v0.12.0
func (s *StepStopEBSBackedInstance) Run(state multistep.StateBag) multistep.StepAction
type StepTagEBSVolumes ¶ added in v0.12.3
type StepTagEBSVolumes struct {
VolumeRunTags map[string]string
Ctx interpolate.Context
}
func (*StepTagEBSVolumes) Cleanup ¶ added in v0.12.3
func (s *StepTagEBSVolumes) Cleanup(state multistep.StateBag)
func (*StepTagEBSVolumes) Run ¶ added in v0.12.3
func (s *StepTagEBSVolumes) Run(state multistep.StateBag) multistep.StepAction
Source Files
¶
- access_config.go
- ami_config.go
- artifact.go
- block_device.go
- cli_config.go
- interpolate_build_info.go
- regions.go
- run_config.go
- ssh.go
- state.go
- step_ami_region_copy.go
- step_create_tags.go
- step_deregister_ami.go
- step_encrypted_ami.go
- step_get_password.go
- step_key_pair.go
- step_modify_ami_attributes.go
- step_modify_ebs_instance.go
- step_pre_validate.go
- step_run_source_instance.go
- step_security_group.go
- step_source_ami_info.go
- step_stop_ebs_instance.go
- step_tag_ebs_volumes.go
- template_funcs.go