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
5aced3f3
Commit
5aced3f3
authored
Jul 16, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/amazon/common: AccessConfig for standard access config
parent
980841b6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
5 deletions
+24
-5
builder/amazon/common/access_config.go
builder/amazon/common/access_config.go
+21
-0
builder/amazon/ebs/builder.go
builder/amazon/ebs/builder.go
+3
-4
builder/amazon/instance/builder_test.go
builder/amazon/instance/builder_test.go
+0
-1
No files found.
builder/amazon/common/access_config.go
0 → 100644
View file @
5aced3f3
package
common
import
(
"github.com/mitchellh/goamz/aws"
)
// AccessConfig is for common configuration related to AWS access
type
AccessConfig
struct
{
AccessKey
string
`mapstructure:"access_key"`
SecretKey
string
`mapstructure:"secret_key"`
}
// Auth returns a valid aws.Auth object for access to AWS services, or
// an error if the authentication couldn't be resolved.
func
(
c
*
AccessConfig
)
Auth
()
(
aws
.
Auth
,
error
)
{
return
aws
.
GetAuth
(
c
.
AccessKey
,
c
.
SecretKey
)
}
func
(
c
*
AccessConfig
)
Validate
()
[]
error
{
return
nil
}
builder/amazon/ebs/builder.go
View file @
5aced3f3
...
...
@@ -11,6 +11,7 @@ import (
"github.com/mitchellh/goamz/aws"
"github.com/mitchellh/goamz/ec2"
"github.com/mitchellh/multistep"
awscommon
"github.com/mitchellh/packer/builder/amazon/common"
"github.com/mitchellh/packer/builder/common"
"github.com/mitchellh/packer/packer"
"log"
...
...
@@ -22,9 +23,7 @@ import (
const
BuilderId
=
"mitchellh.amazonebs"
type
config
struct
{
// Access information
AccessKey
string
`mapstructure:"access_key"`
SecretKey
string
`mapstructure:"secret_key"`
awscommon
.
AccessConfig
`mapstructure:",squash"`
// Information for the source instance
Region
string
...
...
@@ -123,7 +122,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
panic
(
"region not found"
)
}
auth
,
err
:=
aws
.
GetAuth
(
b
.
config
.
AccessKey
,
b
.
config
.
SecretKey
)
auth
,
err
:=
b
.
config
.
AccessConfig
.
Auth
(
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
builder/amazon/instance/builder_test.go
View file @
5aced3f3
...
...
@@ -12,4 +12,3 @@ func TestBuilder_ImplementsBuilder(t *testing.T) {
t
.
Fatalf
(
"Builder should be a builder"
)
}
}
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