Documentation ¶
Index ¶
Constants ¶
const Extension = ".hcl"
Extension is the extension used by module files
Variables ¶
This section is empty.
Functions ¶
func ImportGraph ¶
ImportGraph creates a DAG graph of the module imports for a given module. The resulting DAG graph can be used to determine the proper ordering of modules and also to detect whether we have circular imports in our modules.
Types ¶
type Config ¶
type Config struct { // Module path Path string // Configuration settings for the resources ResourceConfig *resource.Config }
Config type contains configuration options for the module
type DiscoveredRegistry ¶
DiscoveredRegistry type contains discovered modules as returned by the Discover() function. Keys of the map are the module names and their values are the absolute path to the discovered module files.
func Discover ¶
func Discover(root string) (DiscoveredRegistry, error)
Discover is used to discover valid modules in a given module path
type Import ¶
type Import struct { // Name of the module that is imported Name string `hcl:"name"` // Path to the module file Path string `hcl:"path"` }
Import type represents an import declaration
type LoadedRegistry ¶
LoadedRegistry type is a map which keys are the discovered modules from a given module path and their values are the actual loaded modules.
func DiscoverAndLoad ¶
func DiscoverAndLoad(config *Config) (LoadedRegistry, error)
DiscoverAndLoad discovers valid modules from a given module path and attemps to load each valid module file.
type Module ¶
type Module struct { // Name of the module Name string // Resources loaded from the module Resources []resource.Resource // Module imports Imports []Import // Configuration settings for the module Config *Config // Unknown keys found in the module UnknownKeys []string }
Module type represents a collection of resources and module imports
type ResourceMap ¶
ResourceMap type is a map which keys are the resource ids and their values are the actual resources
func ResourceCollection ¶
func ResourceCollection(modules []*Module) (ResourceMap, error)
ResourceCollection creates a map of the unique resources contained within the provided modules.
func (ResourceMap) DependencyGraph ¶
func (rm ResourceMap) DependencyGraph() (*graph.Graph, error)
DependencyGraph builds a dependency graph for the resource collection