add provider test with a nested list in a set

in some cases helper/schema misses the list counts.
This commit is contained in:
James Bardin 2018-11-16 15:11:16 -05:00
parent 3716db3865
commit eddf676c1f
2 changed files with 55 additions and 0 deletions

View File

@ -89,6 +89,27 @@ func testResourceNestedSet() *schema.Resource {
},
},
},
"with_list": {
Type: schema.TypeSet,
Optional: true,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"required": {
Type: schema.TypeString,
Required: true,
},
"list": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
},
},
},
},
}
}

View File

@ -305,3 +305,37 @@ resource "test_resource_nested_set" "foo" {
},
})
}
func TestResourceNestedSet_setWithList(t *testing.T) {
checkFunc := func(s *terraform.State) error {
return nil
}
resource.UnitTest(t, resource.TestCase{
Providers: testAccProviders,
CheckDestroy: testAccCheckResourceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: strings.TrimSpace(`
resource "test_resource_nested_set" "foo" {
with_list {
required = "bar"
list = ["initial value"]
}
}
`),
Check: checkFunc,
},
resource.TestStep{
Config: strings.TrimSpace(`
resource "test_resource_nested_set" "foo" {
with_list {
required = "bar"
list = ["second value"]
}
}
`),
Check: checkFunc,
},
},
})
}