config: test to make sure that cycles are properly detected
This commit is contained in:
parent
d2c3db552a
commit
867f6b3691
|
@ -29,6 +29,18 @@ func TestConfigResourceGraph(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestConfigResourceGraph_cycle(t *testing.T) {
|
||||
c, err := Load(filepath.Join(fixtureDir, "resource_graph_cycle.tf"))
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
||||
graph := c.ResourceGraph()
|
||||
if err := graph.Validate(); err == nil {
|
||||
t.Fatal("graph should be invalid")
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewResourceVariable(t *testing.T) {
|
||||
v, err := NewResourceVariable("foo.bar.baz")
|
||||
if err != nil {
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
variable "foo" {
|
||||
default = "bar";
|
||||
description = "bar";
|
||||
}
|
||||
|
||||
provider "aws" {
|
||||
foo = "${aws_security_group.firewall.value}"
|
||||
}
|
||||
|
||||
resource "aws_security_group" "firewall" {}
|
||||
|
||||
resource "aws_instance" "web" {
|
||||
ami = "${var.foo}"
|
||||
security_groups = [
|
||||
"foo",
|
||||
"${aws_security_group.firewall.foo}"
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue