terraform: provisioners should be cached with the provisioner name

This commit is contained in:
Mitchell Hashimoto 2015-02-20 10:50:36 -08:00
parent 523639b5cd
commit 85e2bef179
1 changed files with 10 additions and 2 deletions

View File

@ -167,7 +167,11 @@ func (ctx *BuiltinEvalContext) InitProvisioner(
return nil, err
}
ctx.ProvisionerCache[PathCacheKey(ctx.Path())] = p
provPath := make([]string, len(ctx.Path())+1)
copy(provPath, ctx.Path())
provPath[len(provPath)-1] = n
ctx.ProvisionerCache[PathCacheKey(provPath)] = p
return p, nil
}
@ -177,7 +181,11 @@ func (ctx *BuiltinEvalContext) Provisioner(n string) ResourceProvisioner {
ctx.ProvisionerLock.Lock()
defer ctx.ProvisionerLock.Unlock()
return ctx.ProvisionerCache[PathCacheKey(ctx.Path())]
provPath := make([]string, len(ctx.Path())+1)
copy(provPath, ctx.Path())
provPath[len(provPath)-1] = n
return ctx.ProvisionerCache[PathCacheKey(provPath)]
}
func (ctx *BuiltinEvalContext) Interpolate(