Skip to content

Commit

Permalink
terraform: module input to another module doesn't error [GH-659]
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Dec 16, 2014
1 parent e1201f0 commit e5f0756
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ BUG FIXES:
diffing lists. [GH-661]
* core: fix crash where module inputs weren't strings, and add more
validation around invalid types here. [GH-624]
* core: fix error when using a computed module output as an input to
another module. [GH-659]
* provider/aws: Fix crash case when internet gateway is not attached
to any VPC. [GH-664]
* provider/aws: `vpc_id` is no longer required. [GH-667]
Expand Down
5 changes: 1 addition & 4 deletions terraform/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -1623,10 +1623,7 @@ func (c *walkContext) computeModuleVariable(
// Get that module from our state
mod := c.Context.state.ModuleByPath(path)
if mod == nil {
return "", fmt.Errorf(
"Module '%s' not found for variable '%s'",
strings.Join(path[1:], "."),
v.FullKey())
return "", nil
}

value, ok := mod.Outputs[v.Field]
Expand Down
16 changes: 16 additions & 0 deletions terraform/context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4362,6 +4362,22 @@ func TestContextRefresh_moduleInputComputedOutput(t *testing.T) {
}
}

func TestContextRefresh_moduleVarModule(t *testing.T) {
m := testModule(t, "refresh-module-var-module")
p := testProvider("aws")
p.DiffFn = testDiffFn
ctx := testContext(t, &ContextOpts{
Module: m,
Providers: map[string]ResourceProviderFactory{
"aws": testProviderFuncFixed(p),
},
})

if _, err := ctx.Refresh(); err != nil {
t.Fatalf("err: %s", err)
}
}

// GH-70
func TestContextRefresh_noState(t *testing.T) {
p := testProvider("aws")
Expand Down

0 comments on commit e5f0756

Please sign in to comment.