Merge pull request #1744 from hashicorp/b-module-output-validate
config: add module raw configs to InterpolatedConfigs [GH-1448]
This commit is contained in:
commit
12a088f6c5
|
@ -570,6 +570,11 @@ func (c *Config) InterpolatedVariables() map[string][]InterpolatedVariable {
|
|||
// a human-friendly source.
|
||||
func (c *Config) rawConfigs() map[string]*RawConfig {
|
||||
result := make(map[string]*RawConfig)
|
||||
for _, m := range c.Modules {
|
||||
source := fmt.Sprintf("module '%s'", m.Name)
|
||||
result[source] = m.RawConfig
|
||||
}
|
||||
|
||||
for _, pc := range c.ProviderConfigs {
|
||||
source := fmt.Sprintf("provider config '%s'", pc.Name)
|
||||
result[source] = pc.RawConfig
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
variable "memory" { default = "foo" }
|
|
@ -0,0 +1,8 @@
|
|||
module "child" {
|
||||
source = "./child"
|
||||
}
|
||||
|
||||
module "child2" {
|
||||
source = "./child"
|
||||
memory = "${module.child.memory_max}"
|
||||
}
|
|
@ -224,6 +224,18 @@ func TestTreeValidate_badChildOutput(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestTreeValidate_badChildOutputToModule(t *testing.T) {
|
||||
tree := NewTree("", testConfig(t, "validate-bad-output-to-module"))
|
||||
|
||||
if err := tree.Load(testStorage(t), GetModeGet); err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
||||
if err := tree.Validate(); err == nil {
|
||||
t.Fatal("should error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestTreeValidate_badChildVar(t *testing.T) {
|
||||
tree := NewTree("", testConfig(t, "validate-bad-var"))
|
||||
|
||||
|
|
Loading…
Reference in New Issue