This commit is contained in:
Adrien Delorme 2020-03-16 12:35:25 +01:00
parent a9ed8eac2a
commit ce8d3d3747
2 changed files with 3 additions and 15 deletions

View File

@ -260,12 +260,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
var warns []string
errs = packer.MultiErrorAppend(errs, b.config.RootVolumeTag.CopyOn(b.config.RootVolumeTags)...)
for _, preparer := range []interface{ Prepare() []error }{
&b.config.SourceAmiFilter,
} {
errs = packer.MultiErrorAppend(errs, preparer.Prepare()...)
}
errs = packer.MultiErrorAppend(errs, b.config.SourceAmiFilter.Prepare()...)
errs = packer.MultiErrorAppend(errs, b.config.AccessConfig.Prepare(&b.config.ctx)...)
errs = packer.MultiErrorAppend(errs,

View File

@ -151,15 +151,8 @@ func stringInSlice(s []string, searchstr string) bool {
func (c *AMIConfig) Prepare(accessConfig *AccessConfig, ctx *interpolate.Context) []error {
var errs []error
for _, s := range []struct {
tagMap TagMap
kvs hcl2template.KeyValues
}{
{c.SnapshotTags, c.SnapshotTag},
{c.AMITags, c.AMITag},
} {
errs = append(errs, s.kvs.CopyOn(s.tagMap)...)
}
errs = append(errs, c.SnapshotTag.CopyOn(c.SnapshotTags)...)
errs = append(errs, c.AMITag.CopyOn(c.AMITags)...)
if c.AMIName == "" {
errs = append(errs, fmt.Errorf("ami_name must be specified"))