Documentation ¶
Overview ¶
Package moduledeps contains types that can be used to describe the providers required for all of the modules in a module tree.
It does not itself contain the functionality for populating such data structures; that's in Terraform core, since this package intentionally does not depend on terraform core to avoid package dependency cycles.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Module ¶
Module represents the dependencies of a single module, as well being a node in a tree of such structures representing the dependencies of an entire configuration.
func (*Module) AllPluginRequirements ¶
func (m *Module) AllPluginRequirements() discovery.PluginRequirements
AllPluginRequirements calls PluginRequirements for the receiver and all of its descendents, and merges the result into a single PluginRequirements structure that would satisfy all of the modules together.
Requirements returned by this method include only version constraints, and apply no particular SHA256 hash constraint.
func (*Module) PluginRequirements ¶
func (m *Module) PluginRequirements() discovery.PluginRequirements
PluginRequirements produces a PluginRequirements structure that can be used with discovery.PluginMetaSet.ConstrainVersions to identify suitable plugins to satisfy the module's provider dependencies.
This method only considers the direct requirements of the receiver. Use AllPluginRequirements to flatten the dependencies for the entire tree of modules.
Requirements returned by this method include only version constraints, and apply no particular SHA256 hash constraint.
func (*Module) SortChildren ¶
func (m *Module) SortChildren()
SortChildren sorts the Children slice into lexicographic order by name, in-place.
This is primarily useful prior to calling WalkTree so that the walk will proceed in a consistent order.
func (*Module) WalkTree ¶
WalkTree calls the given callback once for the receiver and then once for each descendent, in an order such that parents are called before their children and siblings are called in the order they appear in the Children slice.
When calling the callback, parent will be nil for the first call for the receiving module, and then set to the direct parent of each module for the subsequent calls.
The path given to the callback is valid only until the callback returns, after which it will be mutated and reused. Callbacks must therefore copy the path slice if they wish to retain it.
If the given callback returns an error, the walk will be aborted at that point and that error returned to the caller.
This function is not thread-safe for concurrent modifications of the data structure, so it's the caller's responsibility to arrange for that should it be needed.
It is safe for a callback to modify the descendents of the "current" module, including the ordering of the Children slice itself, but the callback MUST NOT modify the parent module.
type ProviderDependency ¶
type ProviderDependency struct { Constraints discovery.Constraints Reason ProviderDependencyReason }
ProviderDependency describes the dependency for a particular provider instance, including both the set of allowed versions and the reason for the dependency.
type ProviderDependencyReason ¶
type ProviderDependencyReason int
ProviderDependencyReason is an enumeration of reasons why a dependency might be present.
const ( // ProviderDependencyExplicit means that there is an explicit "provider" // block in the configuration for this module. ProviderDependencyExplicit ProviderDependencyReason = iota // ProviderDependencyImplicit means that there is no explicit "provider" // block but there is at least one resource that uses this provider. ProviderDependencyImplicit // ProviderDependencyInherited is a special case of // ProviderDependencyImplicit where a parent module has defined a // configuration for the provider that has been inherited by at least one // resource in this module. ProviderDependencyInherited // ProviderDependencyFromState means that this provider is not currently // referenced by configuration at all, but some existing instances in // the state still depend on it. ProviderDependencyFromState )
type ProviderInstance ¶
type ProviderInstance string
ProviderInstance describes a particular provider instance by its full name, like "null" or "aws.foo".
func (ProviderInstance) Alias ¶
func (p ProviderInstance) Alias() string
Alias returns the alias of this provider, if any. An instance named "aws.foo" has the alias "foo", while an instance named just "docker" has no alias, so the empty string would be returned.
func (ProviderInstance) Type ¶
func (p ProviderInstance) Type() string
Type returns the provider type of this instance. For example, for an instance named "aws.foo" the type is "aws".
type Providers ¶
type Providers map[ProviderInstance]ProviderDependency
Providers describes a set of provider dependencies for a given module.
Each named provider instance can have one version constraint.