From 9c9c60aabf032c266724129e913d623d511c1068 Mon Sep 17 00:00:00 2001 From: Justin Campbell Date: Fri, 28 Jun 2013 13:45:15 -0400 Subject: [PATCH] Default to AWS_ env vars for key and secret --- builder/amazonebs/builder.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/builder/amazonebs/builder.go b/builder/amazonebs/builder.go index 149c6284e..ce17a646f 100644 --- a/builder/amazonebs/builder.go +++ b/builder/amazonebs/builder.go @@ -15,6 +15,7 @@ import ( "github.com/mitchellh/packer/builder/common" "github.com/mitchellh/packer/packer" "log" + "os" "text/template" "time" ) @@ -57,6 +58,14 @@ func (b *Builder) Prepare(raws ...interface{}) error { } } + if b.config.AccessKey == "" { + b.config.AccessKey = os.Getenv("AWS_ACCESS_KEY") + } + + if b.config.SecretKey == "" { + b.config.SecretKey = os.Getenv("AWS_SECRET_KEY") + } + if b.config.SSHPort == 0 { b.config.SSHPort = 22 }