Commit d74125d5 authored by Brendan Hay's avatar Brendan Hay

Adding the ability to specify a security_group_id for the amazonebs builder

parent 6e1aff9a
......@@ -29,12 +29,13 @@ type config struct {
SecretKey string `mapstructure:"secret_key"`
// Information for the source instance
Region string
SourceAmi string `mapstructure:"source_ami"`
InstanceType string `mapstructure:"instance_type"`
SSHUsername string `mapstructure:"ssh_username"`
SSHPort int `mapstructure:"ssh_port"`
SSHTimeout time.Duration
Region string
SourceAmi string `mapstructure:"source_ami"`
InstanceType string `mapstructure:"instance_type"`
SSHUsername string `mapstructure:"ssh_username"`
SSHPort int `mapstructure:"ssh_port"`
SSHTimeout time.Duration
SecurityGroupId string `mapstructure:"security_group_id"`
// Configuration of the resulting AMI
AMIName string `mapstructure:"ami_name"`
......
......@@ -19,6 +19,12 @@ func (s *stepSecurityGroup) Run(state map[string]interface{}) multistep.StepActi
ec2conn := state["ec2"].(*ec2.EC2)
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
ui.Say("Creating temporary security group for this instance...")
groupName := fmt.Sprintf("packer %s", hex.EncodeToString(identifier.NewUUID().Raw()))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment