diff --git a/terraform/eval_context_builtin.go b/terraform/eval_context_builtin.go index 1fbd871820..ff3dcf8b5b 100644 --- a/terraform/eval_context_builtin.go +++ b/terraform/eval_context_builtin.go @@ -118,12 +118,6 @@ func (ctx *BuiltinEvalContext) Input() UIInput { } func (ctx *BuiltinEvalContext) InitProvider(addr addrs.AbsProviderConfig) (providers.Interface, error) { - //if !addr.Module.Equal(ctx.Path().Module()) { - // // This indicates incorrect use of InitProvider: it should be used - // // only from the module that the provider configuration belongs to. - // panic(fmt.Sprintf("%s initialized by wrong module %s", addr, ctx.Path())) - //} - // If we already initialized, it is an error if p := ctx.Provider(addr); p != nil { return nil, fmt.Errorf("%s is already initialized", addr) @@ -159,12 +153,6 @@ func (ctx *BuiltinEvalContext) ProviderSchema(addr addrs.AbsProviderConfig) *Pro } func (ctx *BuiltinEvalContext) CloseProvider(addr addrs.AbsProviderConfig) error { - if !addr.Module.Equal(ctx.Path().Module()) { - // This indicates incorrect use of CloseProvider: it should be used - // only from the module that the provider configuration belongs to. - panic(fmt.Sprintf("%s closed by wrong module %s", addr, ctx.Path())) - } - ctx.ProviderLock.Lock() defer ctx.ProviderLock.Unlock() @@ -227,13 +215,13 @@ func (ctx *BuiltinEvalContext) ProviderInput(pc addrs.AbsProviderConfig) map[str func (ctx *BuiltinEvalContext) SetProviderInput(pc addrs.AbsProviderConfig, c map[string]cty.Value) { absProvider := pc - if !absProvider.Module.Equal(ctx.Path().Module()) { - // This indicates incorrect use of InitProvider: it should be used - // only from the module that the provider configuration belongs to. - panic(fmt.Sprintf("%s initialized by wrong module %s", absProvider, ctx.Path())) - } + //if !absProvider.Module.Equal(ctx.Path().Module()) { + // // This indicates incorrect use of InitProvider: it should be used + // // only from the module that the provider configuration belongs to. + // panic(fmt.Sprintf("%s initialized by wrong module %s", absProvider, ctx.Path())) + //} - if !ctx.Path().IsRoot() { + if !pc.Module.IsRoot() { // Only root module provider configurations can have input. log.Printf("[WARN] BuiltinEvalContext: attempt to SetProviderInput for non-root module") return diff --git a/terraform/transform_provider.go b/terraform/transform_provider.go index be47cb627e..31cb8978de 100644 --- a/terraform/transform_provider.go +++ b/terraform/transform_provider.go @@ -470,11 +470,6 @@ func (n *graphNodeCloseProvider) Name() string { return n.Addr.String() + " (close)" } -// GraphNodeModuleInstance impl. -func (n *graphNodeCloseProvider) Path() addrs.ModuleInstance { - return n.Addr.Module.UnkeyedInstanceShim() -} - // GraphNodeModulePath func (n *graphNodeCloseProvider) ModulePath() addrs.Module { return n.Addr.Module @@ -534,10 +529,6 @@ func (n *graphNodeProxyProvider) ProviderAddr() addrs.AbsProviderConfig { return n.addr } -func (n *graphNodeProxyProvider) Path() addrs.ModuleInstance { - return n.addr.Module.UnkeyedInstanceShim() -} - func (n *graphNodeProxyProvider) ModulePath() addrs.Module { return n.addr.Module }