From abe43b20bdc8c1eb9390b770098d0695fa4e9702 Mon Sep 17 00:00:00 2001 From: Benjamin Bennett Date: Tue, 29 Nov 2022 16:23:14 +0000 Subject: [PATCH] Fix nesting mode for map, set and single nested attribute within data source, provider and resource schema (#561) * Fix nesting mode for map, set and single nested attribute within datasource, provider and resource schema (#560) * Adding changelog entry (#560) * Removing unneeded changelog entry (#560) --- datasource/schema/map_nested_attribute.go | 5 +++-- datasource/schema/set_nested_attribute.go | 5 +++-- datasource/schema/single_nested_attribute.go | 5 +++-- provider/schema/map_nested_attribute.go | 5 +++-- provider/schema/set_nested_attribute.go | 5 +++-- provider/schema/single_nested_attribute.go | 5 +++-- resource/schema/map_nested_attribute.go | 5 +++-- resource/schema/set_nested_attribute.go | 5 +++-- resource/schema/single_nested_attribute.go | 5 +++-- 9 files changed, 27 insertions(+), 18 deletions(-) diff --git a/datasource/schema/map_nested_attribute.go b/datasource/schema/map_nested_attribute.go index 9fc34a7b3..d5f32321a 100644 --- a/datasource/schema/map_nested_attribute.go +++ b/datasource/schema/map_nested_attribute.go @@ -3,12 +3,13 @@ package schema import ( "fmt" + "github.com/hashicorp/terraform-plugin-go/tftypes" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/internal/fwschema" "github.com/hashicorp/terraform-plugin-framework/internal/fwschema/fwxschema" "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-go/tftypes" ) // Ensure the implementation satisifies the desired interfaces. @@ -183,7 +184,7 @@ func (a MapNestedAttribute) GetNestedObject() fwschema.NestedAttributeObject { // GetNestingMode always returns NestingModeList. func (a MapNestedAttribute) GetNestingMode() fwschema.NestingMode { - return fwschema.NestingModeList + return fwschema.NestingModeMap } // GetType returns MapType of ObjectType or CustomType. diff --git a/datasource/schema/set_nested_attribute.go b/datasource/schema/set_nested_attribute.go index efb75d93a..51f759489 100644 --- a/datasource/schema/set_nested_attribute.go +++ b/datasource/schema/set_nested_attribute.go @@ -3,12 +3,13 @@ package schema import ( "fmt" + "github.com/hashicorp/terraform-plugin-go/tftypes" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/internal/fwschema" "github.com/hashicorp/terraform-plugin-framework/internal/fwschema/fwxschema" "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-go/tftypes" ) // Ensure the implementation satisifies the desired interfaces. @@ -178,7 +179,7 @@ func (a SetNestedAttribute) GetNestedObject() fwschema.NestedAttributeObject { // GetNestingMode always returns NestingModeList. func (a SetNestedAttribute) GetNestingMode() fwschema.NestingMode { - return fwschema.NestingModeList + return fwschema.NestingModeSet } // GetType returns SetType of ObjectType or CustomType. diff --git a/datasource/schema/single_nested_attribute.go b/datasource/schema/single_nested_attribute.go index 2557ac631..067b5f53d 100644 --- a/datasource/schema/single_nested_attribute.go +++ b/datasource/schema/single_nested_attribute.go @@ -3,12 +3,13 @@ package schema import ( "fmt" + "github.com/hashicorp/terraform-plugin-go/tftypes" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/internal/fwschema" "github.com/hashicorp/terraform-plugin-framework/internal/fwschema/fwxschema" "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-go/tftypes" ) // Ensure the implementation satisifies the desired interfaces. @@ -193,7 +194,7 @@ func (a SingleNestedAttribute) GetNestedObject() fwschema.NestedAttributeObject // GetNestingMode always returns NestingModeList. func (a SingleNestedAttribute) GetNestingMode() fwschema.NestingMode { - return fwschema.NestingModeList + return fwschema.NestingModeSingle } // GetType returns ListType of ObjectType or CustomType. diff --git a/provider/schema/map_nested_attribute.go b/provider/schema/map_nested_attribute.go index 5e117d723..9cf89b2d6 100644 --- a/provider/schema/map_nested_attribute.go +++ b/provider/schema/map_nested_attribute.go @@ -3,12 +3,13 @@ package schema import ( "fmt" + "github.com/hashicorp/terraform-plugin-go/tftypes" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/internal/fwschema" "github.com/hashicorp/terraform-plugin-framework/internal/fwschema/fwxschema" "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-go/tftypes" ) // Ensure the implementation satisifies the desired interfaces. @@ -176,7 +177,7 @@ func (a MapNestedAttribute) GetNestedObject() fwschema.NestedAttributeObject { // GetNestingMode always returns NestingModeList. func (a MapNestedAttribute) GetNestingMode() fwschema.NestingMode { - return fwschema.NestingModeList + return fwschema.NestingModeMap } // GetType returns MapType of ObjectType or CustomType. diff --git a/provider/schema/set_nested_attribute.go b/provider/schema/set_nested_attribute.go index 893ebf550..74824a8b8 100644 --- a/provider/schema/set_nested_attribute.go +++ b/provider/schema/set_nested_attribute.go @@ -3,12 +3,13 @@ package schema import ( "fmt" + "github.com/hashicorp/terraform-plugin-go/tftypes" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/internal/fwschema" "github.com/hashicorp/terraform-plugin-framework/internal/fwschema/fwxschema" "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-go/tftypes" ) // Ensure the implementation satisifies the desired interfaces. @@ -171,7 +172,7 @@ func (a SetNestedAttribute) GetNestedObject() fwschema.NestedAttributeObject { // GetNestingMode always returns NestingModeList. func (a SetNestedAttribute) GetNestingMode() fwschema.NestingMode { - return fwschema.NestingModeList + return fwschema.NestingModeSet } // GetType returns SetType of ObjectType or CustomType. diff --git a/provider/schema/single_nested_attribute.go b/provider/schema/single_nested_attribute.go index e0f6ccc1b..020705ab4 100644 --- a/provider/schema/single_nested_attribute.go +++ b/provider/schema/single_nested_attribute.go @@ -3,12 +3,13 @@ package schema import ( "fmt" + "github.com/hashicorp/terraform-plugin-go/tftypes" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/internal/fwschema" "github.com/hashicorp/terraform-plugin-framework/internal/fwschema/fwxschema" "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-go/tftypes" ) // Ensure the implementation satisifies the desired interfaces. @@ -186,7 +187,7 @@ func (a SingleNestedAttribute) GetNestedObject() fwschema.NestedAttributeObject // GetNestingMode always returns NestingModeList. func (a SingleNestedAttribute) GetNestingMode() fwschema.NestingMode { - return fwschema.NestingModeList + return fwschema.NestingModeSingle } // GetType returns ListType of ObjectType or CustomType. diff --git a/resource/schema/map_nested_attribute.go b/resource/schema/map_nested_attribute.go index ac0df6a05..3b937329e 100644 --- a/resource/schema/map_nested_attribute.go +++ b/resource/schema/map_nested_attribute.go @@ -3,13 +3,14 @@ package schema import ( "fmt" + "github.com/hashicorp/terraform-plugin-go/tftypes" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/internal/fwschema" "github.com/hashicorp/terraform-plugin-framework/internal/fwschema/fwxschema" "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-go/tftypes" ) // Ensure the implementation satisifies the desired interfaces. @@ -202,7 +203,7 @@ func (a MapNestedAttribute) GetNestedObject() fwschema.NestedAttributeObject { // GetNestingMode always returns NestingModeList. func (a MapNestedAttribute) GetNestingMode() fwschema.NestingMode { - return fwschema.NestingModeList + return fwschema.NestingModeMap } // GetType returns MapType of ObjectType or CustomType. diff --git a/resource/schema/set_nested_attribute.go b/resource/schema/set_nested_attribute.go index d9c1813aa..6496a3b15 100644 --- a/resource/schema/set_nested_attribute.go +++ b/resource/schema/set_nested_attribute.go @@ -3,13 +3,14 @@ package schema import ( "fmt" + "github.com/hashicorp/terraform-plugin-go/tftypes" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/internal/fwschema" "github.com/hashicorp/terraform-plugin-framework/internal/fwschema/fwxschema" "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-go/tftypes" ) // Ensure the implementation satisifies the desired interfaces. @@ -197,7 +198,7 @@ func (a SetNestedAttribute) GetNestedObject() fwschema.NestedAttributeObject { // GetNestingMode always returns NestingModeList. func (a SetNestedAttribute) GetNestingMode() fwschema.NestingMode { - return fwschema.NestingModeList + return fwschema.NestingModeSet } // GetType returns SetType of ObjectType or CustomType. diff --git a/resource/schema/single_nested_attribute.go b/resource/schema/single_nested_attribute.go index 9fdffc6cc..44eb906f2 100644 --- a/resource/schema/single_nested_attribute.go +++ b/resource/schema/single_nested_attribute.go @@ -3,13 +3,14 @@ package schema import ( "fmt" + "github.com/hashicorp/terraform-plugin-go/tftypes" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/internal/fwschema" "github.com/hashicorp/terraform-plugin-framework/internal/fwschema/fwxschema" "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" - "github.com/hashicorp/terraform-plugin-go/tftypes" ) // Ensure the implementation satisifies the desired interfaces. @@ -212,7 +213,7 @@ func (a SingleNestedAttribute) GetNestedObject() fwschema.NestedAttributeObject // GetNestingMode always returns NestingModeList. func (a SingleNestedAttribute) GetNestingMode() fwschema.NestingMode { - return fwschema.NestingModeList + return fwschema.NestingModeSingle } // GetType returns ListType of ObjectType or CustomType.