From 1bc77134accb8adcbbb0766f8746503459366222 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Fri, 12 Jul 2019 16:34:03 -0400 Subject: [PATCH] dynamic set block test --- .../test/resource_nested_set_test.go | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/builtin/providers/test/resource_nested_set_test.go b/builtin/providers/test/resource_nested_set_test.go index fac38ef6d289..b7b9bd598cfb 100644 --- a/builtin/providers/test/resource_nested_set_test.go +++ b/builtin/providers/test/resource_nested_set_test.go @@ -620,3 +620,46 @@ resource "test_resource_nested_set" "bar" { }, }) } + +func TestResourceNestedSet_dynamicSetBlock(t *testing.T) { + resource.UnitTest(t, resource.TestCase{ + Providers: testAccProviders, + CheckDestroy: testAccCheckResourceDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: strings.TrimSpace(` +resource "test_resource" "a" { + required = "ok" + required_map = { + a = "b" + } +} + +resource "test_resource" "b" { + required = "ok" + required_map = { + a = "b" + } +} + +resource "test_resource_nested_set" "foo" { + dynamic "with_list" { + iterator = thing + for_each = test_resource.a.computed_list + content { + required = thing.value + list = [thing.key] + } + } +} + `), + Check: resource.ComposeTestCheckFunc( + func(s *terraform.State) error { + fmt.Println(s) + return nil + }, + ), + }, + }, + }) +}