diff --git a/builtin/providers/test/diff_apply_test.go b/builtin/providers/test/diff_apply_test.go index 63a186d36..144e70624 100644 --- a/builtin/providers/test/diff_apply_test.go +++ b/builtin/providers/test/diff_apply_test.go @@ -131,7 +131,7 @@ func TestDiffApply_set(t *testing.T) { "id": "testID", } - attrs, err := diff.Apply(priorAttrs, schema.LegacyResourceSchema(&schema.Resource{Schema: resSchema}).CoreConfigSchema()) + attrs, err := diff.Apply(priorAttrs, (&schema.Resource{Schema: resSchema}).CoreConfigSchema()) if err != nil { t.Fatal(err) } diff --git a/builtin/providers/test/resource_config_mode.go b/builtin/providers/test/resource_config_mode.go index 82e8ff214..da0896e33 100644 --- a/builtin/providers/test/resource_config_mode.go +++ b/builtin/providers/test/resource_config_mode.go @@ -28,21 +28,6 @@ func testResourceConfigMode() *schema.Resource { }, }, }, - "resource_as_attr_dynamic": { - Type: schema.TypeList, - ConfigMode: schema.SchemaConfigModeAttr, - SkipCoreTypeCheck: true, - Optional: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "foo": { - Type: schema.TypeString, - Optional: true, - Default: "default", - }, - }, - }, - }, }, } } @@ -53,14 +38,12 @@ func testResourceConfigModeCreate(d *schema.ResourceData, meta interface{}) erro } func testResourceConfigModeRead(d *schema.ResourceData, meta interface{}) error { - for _, k := range []string{"resource_as_attr", "resource_as_attr_dynamic"} { - if l, ok := d.Get(k).([]interface{}); !ok { - return fmt.Errorf("%s should appear as []interface{}, not %T", k, l) - } else { - for i, item := range l { - if _, ok := item.(map[string]interface{}); !ok { - return fmt.Errorf("%s[%d] should appear as map[string]interface{}, not %T", k, i, item) - } + if l, ok := d.Get("resource_as_attr").([]interface{}); !ok { + return fmt.Errorf("resource_as_attr should appear as []interface{}, not %T", l) + } else { + for i, item := range l { + if _, ok := item.(map[string]interface{}); !ok { + return fmt.Errorf("resource_as_attr[%d] should appear as map[string]interface{}, not %T", i, item) } } } diff --git a/builtin/providers/test/resource_config_mode_test.go b/builtin/providers/test/resource_config_mode_test.go index 02d0c575a..46445bed5 100644 --- a/builtin/providers/test/resource_config_mode_test.go +++ b/builtin/providers/test/resource_config_mode_test.go @@ -23,22 +23,12 @@ resource "test_resource_config_mode" "foo" { foo = "resource_as_attr 1" }, ] - resource_as_attr_dynamic = [ - { - foo = "resource_as_attr_dynamic 0" - }, - { - }, - ] } `), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("test_resource_config_mode.foo", "resource_as_attr.#", "2"), resource.TestCheckResourceAttr("test_resource_config_mode.foo", "resource_as_attr.0.foo", "resource_as_attr 0"), resource.TestCheckResourceAttr("test_resource_config_mode.foo", "resource_as_attr.1.foo", "resource_as_attr 1"), - resource.TestCheckResourceAttr("test_resource_config_mode.foo", "resource_as_attr_dynamic.#", "2"), - resource.TestCheckResourceAttr("test_resource_config_mode.foo", "resource_as_attr_dynamic.0.foo", "resource_as_attr_dynamic 0"), - resource.TestCheckResourceAttr("test_resource_config_mode.foo", "resource_as_attr_dynamic.1.foo", "default"), ), }, resource.TestStep{ @@ -58,22 +48,12 @@ resource "test_resource_config_mode" "foo" { resource_as_attr { foo = "resource_as_attr 1" } - resource_as_attr_dynamic = [ - { - foo = "resource_as_attr_dynamic 0" - }, - { - }, - ] } `), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("test_resource_config_mode.foo", "resource_as_attr.#", "2"), resource.TestCheckResourceAttr("test_resource_config_mode.foo", "resource_as_attr.0.foo", "resource_as_attr 0"), resource.TestCheckResourceAttr("test_resource_config_mode.foo", "resource_as_attr.1.foo", "resource_as_attr 1"), - resource.TestCheckResourceAttr("test_resource_config_mode.foo", "resource_as_attr_dynamic.#", "2"), - resource.TestCheckResourceAttr("test_resource_config_mode.foo", "resource_as_attr_dynamic.0.foo", "resource_as_attr_dynamic 0"), - resource.TestCheckResourceAttr("test_resource_config_mode.foo", "resource_as_attr_dynamic.1.foo", "default"), ), }, resource.TestStep{ @@ -84,43 +64,21 @@ resource "test_resource_config_mode" "foo" { foo = "resource_as_attr 0 updated" }, ] - resource_as_attr_dynamic = [ - { - }, - ] } `), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("test_resource_config_mode.foo", "resource_as_attr.#", "1"), resource.TestCheckResourceAttr("test_resource_config_mode.foo", "resource_as_attr.0.foo", "resource_as_attr 0 updated"), - resource.TestCheckResourceAttr("test_resource_config_mode.foo", "resource_as_attr_dynamic.#", "1"), - resource.TestCheckResourceAttr("test_resource_config_mode.foo", "resource_as_attr_dynamic.0.foo", "default"), - ), - }, - resource.TestStep{ - Config: strings.TrimSpace(` -resource "test_resource_config_mode" "foo" { - resource_as_attr_dynamic = [ - { - }, - ] -} - `), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("test_resource_config_mode.foo", "resource_as_attr.#", "1"), - resource.TestCheckResourceAttr("test_resource_config_mode.foo", "resource_as_attr_dynamic.#", "1"), ), }, resource.TestStep{ Config: strings.TrimSpace(` resource "test_resource_config_mode" "foo" { resource_as_attr = [] - resource_as_attr_dynamic = [] } `), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("test_resource_config_mode.foo", "resource_as_attr.#", "0"), - resource.TestCheckResourceAttr("test_resource_config_mode.foo", "resource_as_attr_dynamic.#", "0"), ), }, resource.TestStep{ @@ -130,7 +88,6 @@ resource "test_resource_config_mode" "foo" { `), Check: resource.ComposeTestCheckFunc( resource.TestCheckNoResourceAttr("test_resource_config_mode.foo", "resource_as_attr.#"), - resource.TestCheckNoResourceAttr("test_resource_config_mode.foo", "resource_as_attr_dynamic.#"), ), }, },