github.com/kevinklinger/open_terraform@v1.3.6/noninternal/moduledeps/dependencies.go (about)

     1  package moduledeps
     2  
     3  import (
     4  	"github.com/kevinklinger/open_terraform/noninternal/addrs"
     5  	"github.com/kevinklinger/open_terraform/noninternal/plugin/discovery"
     6  )
     7  
     8  // Providers describes a set of provider dependencies for a given module.
     9  //
    10  // Each named provider instance can have one version constraint.
    11  type Providers map[addrs.Provider]ProviderDependency
    12  
    13  // ProviderDependency describes the dependency for a particular provider
    14  // instance, including both the set of allowed versions and the reason for
    15  // the dependency.
    16  type ProviderDependency struct {
    17  	Constraints discovery.Constraints
    18  	Reason      ProviderDependencyReason
    19  }
    20  
    21  // ProviderDependencyReason is an enumeration of reasons why a dependency might be
    22  // present.
    23  type ProviderDependencyReason int
    24  
    25  const (
    26  	// ProviderDependencyExplicit means that there is an explicit "provider"
    27  	// block in the configuration for this module.
    28  	ProviderDependencyExplicit ProviderDependencyReason = iota
    29  
    30  	// ProviderDependencyImplicit means that there is no explicit "provider"
    31  	// block but there is at least one resource that uses this provider.
    32  	ProviderDependencyImplicit
    33  
    34  	// ProviderDependencyInherited is a special case of
    35  	// ProviderDependencyImplicit where a parent module has defined a
    36  	// configuration for the provider that has been inherited by at least one
    37  	// resource in this module.
    38  	ProviderDependencyInherited
    39  
    40  	// ProviderDependencyFromState means that this provider is not currently
    41  	// referenced by configuration at all, but some existing instances in
    42  	// the state still depend on it.
    43  	ProviderDependencyFromState
    44  )