terraform/builtin/providers/test/resource_computed_set_test.go

53 lines
1.1 KiB
Go

package test
import (
"strings"
"testing"
"github.com/hashicorp/terraform/helper/resource"
)
func TestResourceComputedSet_update(t *testing.T) {
resource.UnitTest(t, resource.TestCase{
Providers: testAccProviders,
CheckDestroy: testAccCheckResourceDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: strings.TrimSpace(`
resource "test_resource_computed_set" "foo" {
}
`),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(
"test_resource_computed_set.foo", "string_set.#", "3",
),
),
},
resource.TestStep{
Config: strings.TrimSpace(`
resource "test_resource_computed_set" "foo" {
set_count = 5
}
`),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(
"test_resource_computed_set.foo", "string_set.#", "5",
),
),
},
resource.TestStep{
Config: strings.TrimSpace(`
resource "test_resource_computed_set" "foo" {
set_count = 2
}
`),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(
"test_resource_computed_set.foo", "string_set.#", "2",
),
),
},
},
})
}