mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-30 10:47:14 -06:00
49e6ecfd7a
Implement the adding of provider through the module/providers map in the configuration. The way this works is that we start walking the module tree from the top, and for any instance of a provider that can accept a configuration through the parent's module/provider map, we add a proxy node that provides the real name and a pointer to the actual parent provider node. Multiple proxies can be chained back to the original provider. When connecting resources to providers, if that provider is a proxy, we can then connect the resource directly to the proxied node. The proxies are later removed by the DisabledProviderTransformer. This should re-instate the 0.11 beta inheritance behavior, but will allow us to later store the actual concrete provider used by a resource, so that it can be re-connected if it's orphaned by removing its module configuration.
19 lines
473 B
Go
19 lines
473 B
Go
package terraform
|
|
|
|
import (
|
|
"github.com/hashicorp/terraform/config"
|
|
)
|
|
|
|
// GraphNodeAttachProvider is an interface that must be implemented by nodes
|
|
// that want provider configurations attached.
|
|
type GraphNodeAttachProvider interface {
|
|
// Must be implemented to determine the path for the configuration
|
|
GraphNodeSubPath
|
|
|
|
// ProviderName with no module prefix. Example: "aws".
|
|
ProviderName() string
|
|
|
|
// Sets the configuration
|
|
AttachProvider(*config.ProviderConfig)
|
|
}
|