Nathan Sullivan 2013-11-26 11:32:08 +10:00
parent 30ba7307b6
commit 31bf1f342c
4 changed files with 70 additions and 64 deletions

View File

@ -22,6 +22,7 @@ type RunConfig struct {
SecurityGroupId string `mapstructure:"security_group_id"` SecurityGroupId string `mapstructure:"security_group_id"`
SecurityGroupIds []string `mapstructure:"security_group_ids"` SecurityGroupIds []string `mapstructure:"security_group_ids"`
SubnetId string `mapstructure:"subnet_id"` SubnetId string `mapstructure:"subnet_id"`
AssociatePublicIpAddress bool `mapstructure:"associate_public_ip_address"`
TemporaryKeyPairName string `mapstructure:"temporary_key_pair_name"` TemporaryKeyPairName string `mapstructure:"temporary_key_pair_name"`
VpcId string `mapstructure:"vpc_id"` VpcId string `mapstructure:"vpc_id"`
AvailabilityZone string `mapstructure:"availability_zone"` AvailabilityZone string `mapstructure:"availability_zone"`
@ -85,15 +86,16 @@ func (c *RunConfig) Prepare(t *packer.ConfigTemplate) []error {
} }
templates := map[string]*string{ templates := map[string]*string{
"iam_instance_profile": &c.IamInstanceProfile, "iam_instance_profile": &cc.IamInstanceProfile,
"instance_type": &c.InstanceType, "instance_type": &cc.InstanceType,
"ssh_timeout": &c.RawSSHTimeout, "ssh_timeout": &cc.RawSSHTimeout,
"ssh_username": &c.SSHUsername, "ssh_username": &cc.SSHUsername,
"source_ami": &c.SourceAmi, "source_ami": &cc.SourceAmi,
"subnet_id": &c.SubnetId, "subnet_id": &cc.SubnetId,
"temporary_key_pair_name": &c.TemporaryKeyPairName, "associate_public_ip_address": &cc.AssociatePublicIpAddress,
"vpc_id": &c.VpcId, "temporary_key_pair_name": &cc.TemporaryKeyPairName,
"availability_zone": &c.AvailabilityZone, "vpc_id": &cc.VpcId,
"availability_zone": &cc.AvailabilityZone,
} }
for n, ptr := range templates { for n, ptr := range templates {

View File

@ -18,6 +18,7 @@ type StepRunSourceInstance struct {
SourceAMI string SourceAMI string
IamInstanceProfile string IamInstanceProfile string
SubnetId string SubnetId string
AssociatePublicIpAddress bool
AvailabilityZone string AvailabilityZone string
BlockDevices BlockDevices BlockDevices BlockDevices
@ -56,6 +57,7 @@ func (s *StepRunSourceInstance) Run(state multistep.StateBag) multistep.StepActi
SecurityGroups: securityGroups, SecurityGroups: securityGroups,
IamInstanceProfile: s.IamInstanceProfile, IamInstanceProfile: s.IamInstanceProfile,
SubnetId: s.SubnetId, SubnetId: s.SubnetId,
AssociatePublicIpAddress: s.AssociatePublicIpAddress,
BlockDevices: s.BlockDevices.BuildLaunchDevices(), BlockDevices: s.BlockDevices.BuildLaunchDevices(),
AvailZone: s.AvailabilityZone, AvailZone: s.AvailabilityZone,
} }

View File

@ -101,6 +101,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
SourceAMI: b.config.SourceAmi, SourceAMI: b.config.SourceAmi,
IamInstanceProfile: b.config.IamInstanceProfile, IamInstanceProfile: b.config.IamInstanceProfile,
SubnetId: b.config.SubnetId, SubnetId: b.config.SubnetId,
AssociatePublicIpAddress: b.config.AssociatePublicIpAddress,
AvailabilityZone: b.config.AvailabilityZone, AvailabilityZone: b.config.AvailabilityZone,
BlockDevices: b.config.BlockDevices, BlockDevices: b.config.BlockDevices,
}, },

View File

@ -204,6 +204,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
UserDataFile: b.config.UserDataFile, UserDataFile: b.config.UserDataFile,
SourceAMI: b.config.SourceAmi, SourceAMI: b.config.SourceAmi,
SubnetId: b.config.SubnetId, SubnetId: b.config.SubnetId,
AssociatePublicIpAddress: b.config.AssociatePublicIpAddress,
AvailabilityZone: b.config.AvailabilityZone, AvailabilityZone: b.config.AvailabilityZone,
BlockDevices: b.config.BlockDevices, BlockDevices: b.config.BlockDevices,
}, },