github.com/hashicorp/terraform-plugin-sdk@v1.17.2/internal/earlyconfig/config.go (about) 1 package earlyconfig 2 3 import ( 4 version "github.com/hashicorp/go-version" 5 "github.com/hashicorp/terraform-config-inspect/tfconfig" 6 "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" 7 ) 8 9 // A Config is a node in the tree of modules within a configuration. 10 // 11 // The module tree is constructed by following ModuleCall instances recursively 12 // through the root module transitively into descendent modules. 13 type Config struct { 14 // RootModule points to the Config for the root module within the same 15 // module tree as this module. If this module _is_ the root module then 16 // this is self-referential. 17 Root *Config 18 19 // ParentModule points to the Config for the module that directly calls 20 // this module. If this is the root module then this field is nil. 21 Parent *Config 22 23 // Path is a sequence of module logical names that traverse from the root 24 // module to this config. Path is empty for the root module. 25 // 26 // This should only be used to display paths to the end-user in rare cases 27 // where we are talking about the static module tree, before module calls 28 // have been resolved. In most cases, an addrs.ModuleInstance describing 29 // a node in the dynamic module tree is better, since it will then include 30 // any keys resulting from evaluating "count" and "for_each" arguments. 31 Path addrs.Module 32 33 // ChildModules points to the Config for each of the direct child modules 34 // called from this module. The keys in this map match the keys in 35 // Module.ModuleCalls. 36 Children map[string]*Config 37 38 // Module points to the object describing the configuration for the 39 // various elements (variables, resources, etc) defined by this module. 40 Module *tfconfig.Module 41 42 // CallPos is the source position for the header of the module block that 43 // requested this module. 44 // 45 // This field is meaningless for the root module, where its contents are undefined. 46 CallPos tfconfig.SourcePos 47 48 // SourceAddr is the source address that the referenced module was requested 49 // from, as specified in configuration. 50 // 51 // This field is meaningless for the root module, where its contents are undefined. 52 SourceAddr string 53 54 // Version is the specific version that was selected for this module, 55 // based on version constraints given in configuration. 56 // 57 // This field is nil if the module was loaded from a non-registry source, 58 // since versions are not supported for other sources. 59 // 60 // This field is meaningless for the root module, where it will always 61 // be nil. 62 Version *version.Version 63 }