Merge pull request #5817 from brianterry/role_in_amazon_import

Added role in amazon-import
This commit is contained in:
Matthew Hooker 2018-01-25 10:39:04 -08:00 committed by GitHub
commit 00a55e209a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -34,6 +34,7 @@ type Config struct {
Users []string `mapstructure:"ami_users"`
Groups []string `mapstructure:"ami_groups"`
LicenseType string `mapstructure:"license_type"`
RoleName string `mapstructure:"role_name"`
ctx interpolate.Context
}
@ -63,6 +64,10 @@ func (p *PostProcessor) Configure(raws ...interface{}) error {
p.config.S3Key = "packer-import-{{timestamp}}.ova"
}
if p.config.RoleName == "" {
p.config.RoleName = "vmimport"
}
errs := new(packer.MultiError)
// Check and render s3_key_name
@ -164,6 +169,7 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
},
},
},
RoleName: &p.config.RoleName,
}
if p.config.LicenseType != "" {

View File

@ -70,6 +70,8 @@ Optional:
- `mfa_code` (string) - The MFA [TOTP](https://en.wikipedia.org/wiki/Time-based_One-time_Password_Algorithm)
code. This should probably be a user variable since it changes all the time.
- `role_name` (string) - The name of the role to use when not using the default role, 'vmimport'
- `s3_key_name` (string) - The name of the key in `s3_bucket_name` where the
OVA file will be copied to for import. If not specified, this will default
to "packer-import-{{timestamp}}.ova". This key (ie, the uploaded OVA) will