terraform: component uid includes the path
This commit is contained in:
parent
0b00bbde4e
commit
89e8656c6b
|
@ -80,19 +80,18 @@ func (ctx *BuiltinEvalContext) InitProvider(n string) (ResourceProvider, error)
|
||||||
ctx.ProviderLock.Lock()
|
ctx.ProviderLock.Lock()
|
||||||
defer ctx.ProviderLock.Unlock()
|
defer ctx.ProviderLock.Unlock()
|
||||||
|
|
||||||
typeName := strings.SplitN(n, ".", 2)[0]
|
providerPath := make([]string, len(ctx.Path())+1)
|
||||||
uid := n
|
copy(providerPath, ctx.Path())
|
||||||
|
providerPath[len(providerPath)-1] = n
|
||||||
|
key := PathCacheKey(providerPath)
|
||||||
|
|
||||||
p, err := ctx.Components.ResourceProvider(typeName, uid)
|
typeName := strings.SplitN(n, ".", 2)[0]
|
||||||
|
p, err := ctx.Components.ResourceProvider(typeName, key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
providerPath := make([]string, len(ctx.Path())+1)
|
ctx.ProviderCache[key] = p
|
||||||
copy(providerPath, ctx.Path())
|
|
||||||
providerPath[len(providerPath)-1] = n
|
|
||||||
|
|
||||||
ctx.ProviderCache[PathCacheKey(providerPath)] = p
|
|
||||||
return p, nil
|
return p, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,16 +225,17 @@ func (ctx *BuiltinEvalContext) InitProvisioner(
|
||||||
ctx.ProvisionerLock.Lock()
|
ctx.ProvisionerLock.Lock()
|
||||||
defer ctx.ProvisionerLock.Unlock()
|
defer ctx.ProvisionerLock.Unlock()
|
||||||
|
|
||||||
p, err := ctx.Components.ResourceProvisioner(n, n)
|
provPath := make([]string, len(ctx.Path())+1)
|
||||||
|
copy(provPath, ctx.Path())
|
||||||
|
provPath[len(provPath)-1] = n
|
||||||
|
key := PathCacheKey(provPath)
|
||||||
|
|
||||||
|
p, err := ctx.Components.ResourceProvisioner(n, key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
provPath := make([]string, len(ctx.Path())+1)
|
ctx.ProvisionerCache[key] = p
|
||||||
copy(provPath, ctx.Path())
|
|
||||||
provPath[len(provPath)-1] = n
|
|
||||||
|
|
||||||
ctx.ProvisionerCache[PathCacheKey(provPath)] = p
|
|
||||||
return p, nil
|
return p, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue