Merge pull request #7059 from hashicorp/fix_6965

Fix 6965
This commit is contained in:
Adrien Delorme 2018-12-07 13:35:00 +01:00 committed by GitHub
commit c42b3a41a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 7 deletions

View File

@ -36,18 +36,22 @@ type Builder struct {
runner multistep.Runner
}
type EngineVarsTemplate struct {
BuildRegion string
SourceAMI string
}
func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
b.config.ctx.Funcs = awscommon.TemplateFuncs
// Create passthrough for {{ .BuildRegion }} and {{ .SourceAMI }} variables
// so we can fill them in later
b.config.ctx.Data = &EngineVarsTemplate{
BuildRegion: `{{ .BuildRegion }}`,
SourceAMI: `{{ .SourceAMI }} `,
}
err := config.Decode(&b.config, &config.DecodeOpts{
Interpolate: true,
InterpolateContext: &b.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{
Exclude: []string{
"run_tags",
"spot_tags",
"ebs_volumes",
},
},
}, raws...)
if err != nil {
return nil, err