add token variable to upload bundle command template
This commit is contained in:
parent
8fe7e1a1b0
commit
4bc8e7de3d
|
@ -15,6 +15,7 @@ type uploadCmdData struct {
|
||||||
ManifestPath string
|
ManifestPath string
|
||||||
Region string
|
Region string
|
||||||
SecretKey string
|
SecretKey string
|
||||||
|
Token string
|
||||||
}
|
}
|
||||||
|
|
||||||
type StepUploadBundle struct {
|
type StepUploadBundle struct {
|
||||||
|
@ -40,11 +41,13 @@ func (s *StepUploadBundle) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
secretKey := config.SecretKey
|
secretKey := config.SecretKey
|
||||||
session, err := config.AccessConfig.Session()
|
session, err := config.AccessConfig.Session()
|
||||||
accessConfig := session.Config
|
accessConfig := session.Config
|
||||||
|
var token string
|
||||||
if err == nil && accessKey == "" && secretKey == "" {
|
if err == nil && accessKey == "" && secretKey == "" {
|
||||||
credentials, err := accessConfig.Credentials.Get()
|
credentials, err := accessConfig.Credentials.Get()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
accessKey = credentials.AccessKeyID
|
accessKey = credentials.AccessKeyID
|
||||||
secretKey = credentials.SecretAccessKey
|
secretKey = credentials.SecretAccessKey
|
||||||
|
token = credentials.SessionToken
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +58,7 @@ func (s *StepUploadBundle) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
ManifestPath: manifestPath,
|
ManifestPath: manifestPath,
|
||||||
Region: region,
|
Region: region,
|
||||||
SecretKey: secretKey,
|
SecretKey: secretKey,
|
||||||
|
Token: token,
|
||||||
}
|
}
|
||||||
config.BundleUploadCommand, err = interpolate.Render(config.BundleUploadCommand, &config.ctx)
|
config.BundleUploadCommand, err = interpolate.Render(config.BundleUploadCommand, &config.ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -457,3 +457,6 @@ sudo -i -n ec2-upload-bundle \
|
||||||
|
|
||||||
The available template variables should be self-explanatory based on the
|
The available template variables should be self-explanatory based on the
|
||||||
parameters they're used to satisfy the `ec2-upload-bundle` command.
|
parameters they're used to satisfy the `ec2-upload-bundle` command.
|
||||||
|
Additionally, `{{.Token}}` is available when overriding this command. You must
|
||||||
|
create your own bundle command with the addition of `-t {{.Token}} ` if you are
|
||||||
|
assuming a role.
|
||||||
|
|
Loading…
Reference in New Issue