Merge pull request #1797 from hashicorp/b-flatten-modules-cycle

core: failing test for a bad module cycle
This commit is contained in:
Mitchell Hashimoto 2015-05-05 10:54:57 -07:00
commit 803348d05f
4 changed files with 37 additions and 0 deletions

View File

@ -2443,6 +2443,26 @@ func TestContext2Validate_moduleBadResource(t *testing.T) {
} }
} }
func TestContext2Validate_moduleDepsShouldNotCycle(t *testing.T) {
m := testModule(t, "validate-module-deps-cycle")
p := testProvider("aws")
ctx := testContext2(t, &ContextOpts{
Module: m,
Providers: map[string]ResourceProviderFactory{
"aws": testProviderFuncFixed(p),
},
})
w, e := ctx.Validate()
if len(w) > 0 {
t.Fatalf("expected no warnings, got: %s", w)
}
if len(e) > 0 {
t.Fatalf("expected no errors, got: %s", e)
}
}
func TestContext2Validate_moduleProviderInherit(t *testing.T) { func TestContext2Validate_moduleProviderInherit(t *testing.T) {
m := testModule(t, "validate-module-pc-inherit") m := testModule(t, "validate-module-pc-inherit")
p := testProvider("aws") p := testProvider("aws")

View File

@ -0,0 +1,5 @@
resource "aws_instance" "a" { }
output "output" {
value = "${aws_instance.a.id}"
}

View File

@ -0,0 +1,4 @@
variable "input" {}
resource "aws_instance" "b" {
name = "${var.input}"
}

View File

@ -0,0 +1,8 @@
module "a" {
source = "./a"
}
module "b" {
source = "./b"
input = "${module.a.output}"
}