Commit c710323f authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/amazon/*: Fix failing tests from rebase of VPC

parent f94500b3
......@@ -22,7 +22,10 @@ func TestArtifactId(t *testing.T) {
amis["east"] = "foo"
amis["west"] = "bar"
a := &Artifact{amis, nil}
a := &Artifact{
Amis: amis,
}
result := a.Id()
assert.Equal(result, expected, "should match output")
}
......@@ -39,7 +42,7 @@ west: bar`
amis["east"] = "foo"
amis["west"] = "bar"
a := &Artifact{amis, nil}
a := &Artifact{Amis: amis}
result := a.String()
assert.Equal(result, expected, "should match output")
}
......@@ -12,6 +12,7 @@ type StepRunSourceInstance struct {
ExpectedRootDevice string
InstanceType string
SourceAMI string
SubnetId string
instance *ec2.Instance
}
......@@ -29,7 +30,7 @@ func (s *StepRunSourceInstance) Run(state map[string]interface{}) multistep.Step
MinCount: 0,
MaxCount: 0,
SecurityGroups: []ec2.SecurityGroup{ec2.SecurityGroup{Id: securityGroupId}},
SubnetId: config.SubnetId,
SubnetId: s.SubnetId,
}
ui.Say("Launching a source AWS instance...")
......
......@@ -13,6 +13,7 @@ import (
type StepSecurityGroup struct {
SecurityGroupId string
SSHPort int
VpcId string
createdGroupId string
}
......@@ -35,7 +36,12 @@ func (s *StepSecurityGroup) Run(state map[string]interface{}) multistep.StepActi
ui.Say("Creating temporary security group for this instance...")
groupName := fmt.Sprintf("packer %s", hex.EncodeToString(identifier.NewUUID().Raw()))
log.Printf("Temporary group name: %s", groupName)
groupResp, err := ec2conn.CreateSecurityGroup(ec2.SecurityGroup{Name: groupName, Description: "Temporary group for Packer", VpcId: config.VpcId})
group := ec2.SecurityGroup{
Name: groupName,
Description: "Temporary group for Packer",
VpcId: s.VpcId,
}
groupResp, err := ec2conn.CreateSecurityGroup(group)
if err != nil {
ui.Error(err.Error())
return multistep.ActionHalt
......
......@@ -97,6 +97,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
ExpectedRootDevice: "ebs",
InstanceType: b.config.InstanceType,
SourceAMI: b.config.SourceAmi,
SubnetId: b.config.SubnetId,
},
&common.StepConnectSSH{
SSHAddress: awscommon.SSHAddress(b.config.SSHPort),
......
......@@ -103,6 +103,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
ExpectedRootDevice: "instance-store",
InstanceType: b.config.InstanceType,
SourceAMI: b.config.SourceAmi,
SubnetId: b.config.SubnetId,
},
&common.StepConnectSSH{
SSHAddress: awscommon.SSHAddress(b.config.SSHPort),
......
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