From ad595cf25475cfbe6df2c445a3e780c77498853e Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 16 Feb 2015 13:34:15 -0800 Subject: [PATCH] terraform: test case for cycle of CBD depending on non-CBD --- terraform/graph_builder_test.go | 13 +++++++++++++ .../test-fixtures/graph-builder-cbd-non-cbd/main.tf | 9 +++++++++ 2 files changed, 22 insertions(+) create mode 100644 terraform/test-fixtures/graph-builder-cbd-non-cbd/main.tf diff --git a/terraform/graph_builder_test.go b/terraform/graph_builder_test.go index a04985330..ee1dbc1f5 100644 --- a/terraform/graph_builder_test.go +++ b/terraform/graph_builder_test.go @@ -73,6 +73,19 @@ func TestBuiltinGraphBuilder(t *testing.T) { } } +// This tests a cycle we got when a CBD resource depends on a non-CBD +// resource. This cycle shouldn't happen in the general case anymore. +func TestBuiltinGraphBuilder_cbdDepNonCbd(t *testing.T) { + b := &BuiltinGraphBuilder{ + Root: testModule(t, "graph-builder-cbd-non-cbd"), + } + + _, err := b.Build(RootModulePath) + if err != nil { + t.Fatalf("err: %s", err) + } +} + /* TODO: This exposes a really bad bug we need to fix after we merge the f-ast-branch. This bug still exists in master. diff --git a/terraform/test-fixtures/graph-builder-cbd-non-cbd/main.tf b/terraform/test-fixtures/graph-builder-cbd-non-cbd/main.tf new file mode 100644 index 000000000..f478d4f33 --- /dev/null +++ b/terraform/test-fixtures/graph-builder-cbd-non-cbd/main.tf @@ -0,0 +1,9 @@ +provider "aws" {} + +resource "aws_lc" "foo" {} + +resource "aws_asg" "foo" { + lc = "${aws_lc.foo.id}" + + lifecycle { create_before_destroy = true } +}