Added role in amazon-import

This commit is contained in:
Brian Terry 2018-01-25 10:56:30 -05:00
parent 7f4112ba22
commit 380147200c
2 changed files with 8 additions and 0 deletions

View File

@ -34,6 +34,7 @@ type Config struct {
Users []string `mapstructure:"ami_users"` Users []string `mapstructure:"ami_users"`
Groups []string `mapstructure:"ami_groups"` Groups []string `mapstructure:"ami_groups"`
LicenseType string `mapstructure:"license_type"` LicenseType string `mapstructure:"license_type"`
RoleName string `mapstructure:"role_name"`
ctx interpolate.Context ctx interpolate.Context
} }
@ -63,6 +64,10 @@ func (p *PostProcessor) Configure(raws ...interface{}) error {
p.config.S3Key = "packer-import-{{timestamp}}.ova" p.config.S3Key = "packer-import-{{timestamp}}.ova"
} }
if p.config.RoleName == "" {
p.config.RoleName = "vmimport"
}
errs := new(packer.MultiError) errs := new(packer.MultiError)
// Check and render s3_key_name // 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 != "" { 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) - `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. 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 - `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 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 to "packer-import-{{timestamp}}.ova". This key (ie, the uploaded OVA) will