From 0f2db7fe42561973c74c18a0d79d135e38cb7804 Mon Sep 17 00:00:00 2001 From: Ian Wahbe Date: Tue, 11 Jul 2023 11:02:12 +0200 Subject: [PATCH] Support SchemaFunc --- pkg/tfshim/sdk-v2/resource.go | 6 +++--- pkg/tfshim/sdk-v2/schema.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/tfshim/sdk-v2/resource.go b/pkg/tfshim/sdk-v2/resource.go index 129ab2fe3e..f0b5955820 100644 --- a/pkg/tfshim/sdk-v2/resource.go +++ b/pkg/tfshim/sdk-v2/resource.go @@ -21,7 +21,7 @@ func NewResource(r *schema.Resource) shim.Resource { } func (r v2Resource) Schema() shim.SchemaMap { - return v2SchemaMap(r.tf.Schema) + return v2SchemaMap(r.tf.SchemaMap()) } func (r v2Resource) SchemaVersion() int { @@ -87,8 +87,8 @@ func (r v2Resource) InstanceState(id string, object, meta map[string]interface{} // them into their TF attribute form. The result is our set of TF attributes. config := &terraform.ResourceConfig{Raw: object, Config: object} attributes := map[string]string{} - reader := &schema.ConfigFieldReader{Config: config, Schema: r.tf.Schema} - for k := range r.tf.Schema { + reader := &schema.ConfigFieldReader{Config: config, Schema: r.tf.SchemaMap()} + for k := range r.tf.SchemaMap() { // Elide nil values. if v, ok := object[k]; ok && v == nil { continue diff --git a/pkg/tfshim/sdk-v2/schema.go b/pkg/tfshim/sdk-v2/schema.go index 49cb10bb52..365e5281f3 100644 --- a/pkg/tfshim/sdk-v2/schema.go +++ b/pkg/tfshim/sdk-v2/schema.go @@ -134,7 +134,7 @@ func makeUnknownElement(elem interface{}) interface{} { case *schema.Resource: // If the element uses a resource schema, fill in unknown values for any required properties. res := make(map[string]interface{}) - for k, v := range e.Schema { + for k, v := range e.SchemaMap() { if v.Required { res[k] = v2Schema{v}.UnknownValue() }