Skip to content

Commit 8da6c0e

Browse files
committed
dynamic set block test
1 parent 5eb0750 commit 8da6c0e

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

builtin/providers/test/resource_nested_set_test.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,3 +620,39 @@ resource "test_resource_nested_set" "bar" {
620620
},
621621
})
622622
}
623+
624+
func TestResourceNestedSet_dynamicSetBlock(t *testing.T) {
625+
resource.UnitTest(t, resource.TestCase{
626+
Providers: testAccProviders,
627+
CheckDestroy: testAccCheckResourceDestroy,
628+
Steps: []resource.TestStep{
629+
resource.TestStep{
630+
Config: strings.TrimSpace(`
631+
resource "test_resource" "a" {
632+
required = "ok"
633+
required_map = {
634+
a = "b"
635+
}
636+
}
637+
638+
resource "test_resource_nested_set" "foo" {
639+
dynamic "with_list" {
640+
iterator = thing
641+
for_each = test_resource.a.computed_list
642+
content {
643+
required = thing.value
644+
list = [thing.key]
645+
}
646+
}
647+
}
648+
`),
649+
Check: resource.ComposeTestCheckFunc(
650+
func(s *terraform.State) error {
651+
fmt.Println(s)
652+
return nil
653+
},
654+
),
655+
},
656+
},
657+
})
658+
}

0 commit comments

Comments
 (0)