From cf10fff7fa23b93e37ed3881ac4da9abea66744b Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 18 Sep 2013 13:59:23 -0700 Subject: [PATCH] builder/amazon/common: save access/secret key from env [GH-434] --- CHANGELOG.md | 2 ++ builder/amazon/common/access_config.go | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dec40d02c..ee5aad398 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ BUG FIXES: instance, etc.) disappears from under it. * builder/amazon/instance: Exclude only contents of /tmp, not /tmp itself. [GH-437] +* builder/amazon/instance: Make AccessKey/SecretKey available to bundle + command even when they come from the environment. [GH-434] * builder/virtualbox: F1-F12 and delete scancodes now work. [GH-425] * provisioner/puppet-masterless: Fix failure case when both facter vars are used and prevent_sudo. [GH-415] diff --git a/builder/amazon/common/access_config.go b/builder/amazon/common/access_config.go index 10ce2eba2..1690869d0 100644 --- a/builder/amazon/common/access_config.go +++ b/builder/amazon/common/access_config.go @@ -18,7 +18,14 @@ type AccessConfig struct { // 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) + auth, err := aws.GetAuth(c.AccessKey, c.SecretKey) + if err == nil { + // Store the accesskey and secret that we got... + c.AccessKey = auth.AccessKey + c.SecretKey = auth.SecretKey + } + + return auth, err } // Region returns the aws.Region object for access to AWS services, requesting