Merge pull request #40 from justincampbell/amazon-env-vars
builder/amazonebs: Default to AWS env vars for key and secret
This commit is contained in:
commit
94e2999b89
|
@ -15,6 +15,7 @@ import (
|
|||
"github.com/mitchellh/packer/builder/common"
|
||||
"github.com/mitchellh/packer/packer"
|
||||
"log"
|
||||
"os"
|
||||
"text/template"
|
||||
"time"
|
||||
)
|
||||
|
@ -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 {
|
||||
b.config.SSHPort = 22
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue