Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
31bf1f34
Commit
31bf1f34
authored
Nov 26, 2013
by
Nathan Sullivan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
https://github.com/mitchellh/packer/issues/578
parent
30ba7307
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
64 deletions
+70
-64
builder/amazon/common/run_config.go
builder/amazon/common/run_config.go
+25
-23
builder/amazon/common/step_run_source_instance.go
builder/amazon/common/step_run_source_instance.go
+23
-21
builder/amazon/ebs/builder.go
builder/amazon/ebs/builder.go
+11
-10
builder/amazon/instance/builder.go
builder/amazon/instance/builder.go
+11
-10
No files found.
builder/amazon/common/run_config.go
View file @
31bf1f34
...
...
@@ -11,20 +11,21 @@ import (
// RunConfig contains configuration for running an instance from a source
// AMI and details on how to access that launched image.
type
RunConfig
struct
{
SourceAmi
string
`mapstructure:"source_ami"`
IamInstanceProfile
string
`mapstructure:"iam_instance_profile"`
InstanceType
string
`mapstructure:"instance_type"`
UserData
string
`mapstructure:"user_data"`
UserDataFile
string
`mapstructure:"user_data_file"`
RawSSHTimeout
string
`mapstructure:"ssh_timeout"`
SSHUsername
string
`mapstructure:"ssh_username"`
SSHPort
int
`mapstructure:"ssh_port"`
SecurityGroupId
string
`mapstructure:"security_group_id"`
SecurityGroupIds
[]
string
`mapstructure:"security_group_ids"`
SubnetId
string
`mapstructure:"subnet_id"`
TemporaryKeyPairName
string
`mapstructure:"temporary_key_pair_name"`
VpcId
string
`mapstructure:"vpc_id"`
AvailabilityZone
string
`mapstructure:"availability_zone"`
SourceAmi
string
`mapstructure:"source_ami"`
IamInstanceProfile
string
`mapstructure:"iam_instance_profile"`
InstanceType
string
`mapstructure:"instance_type"`
UserData
string
`mapstructure:"user_data"`
UserDataFile
string
`mapstructure:"user_data_file"`
RawSSHTimeout
string
`mapstructure:"ssh_timeout"`
SSHUsername
string
`mapstructure:"ssh_username"`
SSHPort
int
`mapstructure:"ssh_port"`
SecurityGroupId
string
`mapstructure:"security_group_id"`
SecurityGroupIds
[]
string
`mapstructure:"security_group_ids"`
SubnetId
string
`mapstructure:"subnet_id"`
AssociatePublicIpAddress
bool
`mapstructure:"associate_public_ip_address"`
TemporaryKeyPairName
string
`mapstructure:"temporary_key_pair_name"`
VpcId
string
`mapstructure:"vpc_id"`
AvailabilityZone
string
`mapstructure:"availability_zone"`
// Unexported fields that are calculated from others
sshTimeout
time
.
Duration
...
...
@@ -85,15 +86,16 @@ func (c *RunConfig) Prepare(t *packer.ConfigTemplate) []error {
}
templates
:=
map
[
string
]
*
string
{
"iam_instance_profile"
:
&
c
.
IamInstanceProfile
,
"instance_type"
:
&
c
.
InstanceType
,
"ssh_timeout"
:
&
c
.
RawSSHTimeout
,
"ssh_username"
:
&
c
.
SSHUsername
,
"source_ami"
:
&
c
.
SourceAmi
,
"subnet_id"
:
&
c
.
SubnetId
,
"temporary_key_pair_name"
:
&
c
.
TemporaryKeyPairName
,
"vpc_id"
:
&
c
.
VpcId
,
"availability_zone"
:
&
c
.
AvailabilityZone
,
"iam_instance_profile"
:
&
cc
.
IamInstanceProfile
,
"instance_type"
:
&
cc
.
InstanceType
,
"ssh_timeout"
:
&
cc
.
RawSSHTimeout
,
"ssh_username"
:
&
cc
.
SSHUsername
,
"source_ami"
:
&
cc
.
SourceAmi
,
"subnet_id"
:
&
cc
.
SubnetId
,
"associate_public_ip_address"
:
&
cc
.
AssociatePublicIpAddress
,
"temporary_key_pair_name"
:
&
cc
.
TemporaryKeyPairName
,
"vpc_id"
:
&
cc
.
VpcId
,
"availability_zone"
:
&
cc
.
AvailabilityZone
,
}
for
n
,
ptr
:=
range
templates
{
...
...
builder/amazon/common/step_run_source_instance.go
View file @
31bf1f34
...
...
@@ -10,16 +10,17 @@ import (
)
type
StepRunSourceInstance
struct
{
Debug
bool
ExpectedRootDevice
string
InstanceType
string
UserData
string
UserDataFile
string
SourceAMI
string
IamInstanceProfile
string
SubnetId
string
AvailabilityZone
string
BlockDevices
BlockDevices
Debug
bool
ExpectedRootDevice
string
InstanceType
string
UserData
string
UserDataFile
string
SourceAMI
string
IamInstanceProfile
string
SubnetId
string
AssociatePublicIpAddress
bool
AvailabilityZone
string
BlockDevices
BlockDevices
instance
*
ec2
.
Instance
}
...
...
@@ -47,17 +48,18 @@ func (s *StepRunSourceInstance) Run(state multistep.StateBag) multistep.StepActi
}
runOpts
:=
&
ec2
.
RunInstances
{
KeyName
:
keyName
,
ImageId
:
s
.
SourceAMI
,
InstanceType
:
s
.
InstanceType
,
UserData
:
[]
byte
(
userData
),
MinCount
:
0
,
MaxCount
:
0
,
SecurityGroups
:
securityGroups
,
IamInstanceProfile
:
s
.
IamInstanceProfile
,
SubnetId
:
s
.
SubnetId
,
BlockDevices
:
s
.
BlockDevices
.
BuildLaunchDevices
(),
AvailZone
:
s
.
AvailabilityZone
,
KeyName
:
keyName
,
ImageId
:
s
.
SourceAMI
,
InstanceType
:
s
.
InstanceType
,
UserData
:
[]
byte
(
userData
),
MinCount
:
0
,
MaxCount
:
0
,
SecurityGroups
:
securityGroups
,
IamInstanceProfile
:
s
.
IamInstanceProfile
,
SubnetId
:
s
.
SubnetId
,
AssociatePublicIpAddress
:
s
.
AssociatePublicIpAddress
,
BlockDevices
:
s
.
BlockDevices
.
BuildLaunchDevices
(),
AvailZone
:
s
.
AvailabilityZone
,
}
ui
.
Say
(
"Launching a source AWS instance..."
)
...
...
builder/amazon/ebs/builder.go
View file @
31bf1f34
...
...
@@ -93,16 +93,17 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
VpcId
:
b
.
config
.
VpcId
,
},
&
awscommon
.
StepRunSourceInstance
{
Debug
:
b
.
config
.
PackerDebug
,
ExpectedRootDevice
:
"ebs"
,
InstanceType
:
b
.
config
.
InstanceType
,
UserData
:
b
.
config
.
UserData
,
UserDataFile
:
b
.
config
.
UserDataFile
,
SourceAMI
:
b
.
config
.
SourceAmi
,
IamInstanceProfile
:
b
.
config
.
IamInstanceProfile
,
SubnetId
:
b
.
config
.
SubnetId
,
AvailabilityZone
:
b
.
config
.
AvailabilityZone
,
BlockDevices
:
b
.
config
.
BlockDevices
,
Debug
:
b
.
config
.
PackerDebug
,
ExpectedRootDevice
:
"ebs"
,
InstanceType
:
b
.
config
.
InstanceType
,
UserData
:
b
.
config
.
UserData
,
UserDataFile
:
b
.
config
.
UserDataFile
,
SourceAMI
:
b
.
config
.
SourceAmi
,
IamInstanceProfile
:
b
.
config
.
IamInstanceProfile
,
SubnetId
:
b
.
config
.
SubnetId
,
AssociatePublicIpAddress
:
b
.
config
.
AssociatePublicIpAddress
,
AvailabilityZone
:
b
.
config
.
AvailabilityZone
,
BlockDevices
:
b
.
config
.
BlockDevices
,
},
&
common
.
StepConnectSSH
{
SSHAddress
:
awscommon
.
SSHAddress
(
ec2conn
,
b
.
config
.
SSHPort
),
...
...
builder/amazon/instance/builder.go
View file @
31bf1f34
...
...
@@ -196,16 +196,17 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
VpcId
:
b
.
config
.
VpcId
,
},
&
awscommon
.
StepRunSourceInstance
{
Debug
:
b
.
config
.
PackerDebug
,
ExpectedRootDevice
:
"instance-store"
,
InstanceType
:
b
.
config
.
InstanceType
,
IamInstanceProfile
:
b
.
config
.
IamInstanceProfile
,
UserData
:
b
.
config
.
UserData
,
UserDataFile
:
b
.
config
.
UserDataFile
,
SourceAMI
:
b
.
config
.
SourceAmi
,
SubnetId
:
b
.
config
.
SubnetId
,
AvailabilityZone
:
b
.
config
.
AvailabilityZone
,
BlockDevices
:
b
.
config
.
BlockDevices
,
Debug
:
b
.
config
.
PackerDebug
,
ExpectedRootDevice
:
"instance-store"
,
InstanceType
:
b
.
config
.
InstanceType
,
IamInstanceProfile
:
b
.
config
.
IamInstanceProfile
,
UserData
:
b
.
config
.
UserData
,
UserDataFile
:
b
.
config
.
UserDataFile
,
SourceAMI
:
b
.
config
.
SourceAmi
,
SubnetId
:
b
.
config
.
SubnetId
,
AssociatePublicIpAddress
:
b
.
config
.
AssociatePublicIpAddress
,
AvailabilityZone
:
b
.
config
.
AvailabilityZone
,
BlockDevices
:
b
.
config
.
BlockDevices
,
},
&
common
.
StepConnectSSH
{
SSHAddress
:
awscommon
.
SSHAddress
(
ec2conn
,
b
.
config
.
SSHPort
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment