Adding the ability to specify a security_group_id for the amazonebs builder
This commit is contained in:
parent
6e1aff9ad5
commit
d74125d5d0
|
@ -29,12 +29,13 @@ type config struct {
|
||||||
SecretKey string `mapstructure:"secret_key"`
|
SecretKey string `mapstructure:"secret_key"`
|
||||||
|
|
||||||
// Information for the source instance
|
// Information for the source instance
|
||||||
Region string
|
Region string
|
||||||
SourceAmi string `mapstructure:"source_ami"`
|
SourceAmi string `mapstructure:"source_ami"`
|
||||||
InstanceType string `mapstructure:"instance_type"`
|
InstanceType string `mapstructure:"instance_type"`
|
||||||
SSHUsername string `mapstructure:"ssh_username"`
|
SSHUsername string `mapstructure:"ssh_username"`
|
||||||
SSHPort int `mapstructure:"ssh_port"`
|
SSHPort int `mapstructure:"ssh_port"`
|
||||||
SSHTimeout time.Duration
|
SSHTimeout time.Duration
|
||||||
|
SecurityGroupId string `mapstructure:"security_group_id"`
|
||||||
|
|
||||||
// Configuration of the resulting AMI
|
// Configuration of the resulting AMI
|
||||||
AMIName string `mapstructure:"ami_name"`
|
AMIName string `mapstructure:"ami_name"`
|
||||||
|
|
|
@ -19,6 +19,12 @@ func (s *stepSecurityGroup) Run(state map[string]interface{}) multistep.StepActi
|
||||||
ec2conn := state["ec2"].(*ec2.EC2)
|
ec2conn := state["ec2"].(*ec2.EC2)
|
||||||
ui := state["ui"].(packer.Ui)
|
ui := state["ui"].(packer.Ui)
|
||||||
|
|
||||||
|
if config.SecurityGroupId != "" {
|
||||||
|
log.Printf("Using specified security group: %s", config.SecurityGroupId)
|
||||||
|
state["securityGroupId"] = config.SecurityGroupId
|
||||||
|
return multistep.ActionContinue
|
||||||
|
}
|
||||||
|
|
||||||
// Create the group
|
// Create the group
|
||||||
ui.Say("Creating temporary security group for this instance...")
|
ui.Say("Creating temporary security group for this instance...")
|
||||||
groupName := fmt.Sprintf("packer %s", hex.EncodeToString(identifier.NewUUID().Raw()))
|
groupName := fmt.Sprintf("packer %s", hex.EncodeToString(identifier.NewUUID().Raw()))
|
||||||
|
|
Loading…
Reference in New Issue