Commit 94e2999b authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

Merge pull request #40 from justincampbell/amazon-env-vars

builder/amazonebs: Default to AWS env vars for key and secret
parents 223f573d d66c3d86
...@@ -15,6 +15,7 @@ import ( ...@@ -15,6 +15,7 @@ import (
"github.com/mitchellh/packer/builder/common" "github.com/mitchellh/packer/builder/common"
"github.com/mitchellh/packer/packer" "github.com/mitchellh/packer/packer"
"log" "log"
"os"
"text/template" "text/template"
"time" "time"
) )
...@@ -57,6 +58,22 @@ func (b *Builder) Prepare(raws ...interface{}) error { ...@@ -57,6 +58,22 @@ func (b *Builder) Prepare(raws ...interface{}) error {
} }
} }
if b.config.AccessKey == "" {
b.config.AccessKey = os.Getenv("AWS_ACCESS_KEY_ID")
}
if b.config.AccessKey == "" {
b.config.AccessKey = os.Getenv("AWS_ACCESS_KEY")
}
if b.config.SecretKey == "" {
b.config.SecretKey = os.Getenv("AWS_SECRET_ACCESS_KEY")
}
if b.config.SecretKey == "" {
b.config.SecretKey = os.Getenv("AWS_SECRET_KEY")
}
if b.config.SSHPort == 0 { if b.config.SSHPort == 0 {
b.config.SSHPort = 22 b.config.SSHPort = 22
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment