Commit bac54a66 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/amazon/common: token [GH-1236]

parent a87ce5f9
...@@ -13,6 +13,8 @@ FEATURES: ...@@ -13,6 +13,8 @@ FEATURES:
IMPROVEMENTS: IMPROVEMENTS:
* builder/amazon/all: `AWS_SECURITY_TOKEN` is read and can also be
set with the `token` configuration. [GH-1236]
* builder/amazon-instance: EBS AMIs can be used as a source. [GH-1453] * builder/amazon-instance: EBS AMIs can be used as a source. [GH-1453]
* builder/digitalocean: Can set API URL endpoint. [GH-1448] * builder/digitalocean: Can set API URL endpoint. [GH-1448]
* builder/digitalocean: Region supports variables. [GH-1452] * builder/digitalocean: Region supports variables. [GH-1452]
......
...@@ -13,6 +13,7 @@ type AccessConfig struct { ...@@ -13,6 +13,7 @@ type AccessConfig struct {
AccessKey string `mapstructure:"access_key"` AccessKey string `mapstructure:"access_key"`
SecretKey string `mapstructure:"secret_key"` SecretKey string `mapstructure:"secret_key"`
RawRegion string `mapstructure:"region"` RawRegion string `mapstructure:"region"`
Token string `mapstructure:"token"`
} }
// Auth returns a valid aws.Auth object for access to AWS services, or // Auth returns a valid aws.Auth object for access to AWS services, or
...@@ -23,6 +24,10 @@ func (c *AccessConfig) Auth() (aws.Auth, error) { ...@@ -23,6 +24,10 @@ func (c *AccessConfig) Auth() (aws.Auth, error) {
// Store the accesskey and secret that we got... // Store the accesskey and secret that we got...
c.AccessKey = auth.AccessKey c.AccessKey = auth.AccessKey
c.SecretKey = auth.SecretKey c.SecretKey = auth.SecretKey
c.Token = auth.Token
}
if auth.Token == "" && c.Token != "" {
auth.Token = c.Token
} }
return auth, err return auth, err
......
...@@ -138,6 +138,11 @@ each category, the available configuration keys are alphabetized. ...@@ -138,6 +138,11 @@ each category, the available configuration keys are alphabetized.
* `temporary_key_pair_name` (string) - The name of the temporary keypair * `temporary_key_pair_name` (string) - The name of the temporary keypair
to generate. By default, Packer generates a name with a UUID. to generate. By default, Packer generates a name with a UUID.
* `token` (string) - The access token to use. This is different from
the access key and secret key. If you're not sure what this is, then you
probably don't need it. This will also be read from the `AWS_SECURITY_TOKEN`
environmental variable.
* `user_data` (string) - User data to apply when launching the instance. * `user_data` (string) - User data to apply when launching the instance.
Note that you need to be careful about escaping characters due to the Note that you need to be careful about escaping characters due to the
templates being JSON. It is often more convenient to use `user_data_file`, templates being JSON. It is often more convenient to use `user_data_file`,
......
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