Skip to content

Commit

Permalink
Fix nesting mode for map, set and single nested attribute within data…
Browse files Browse the repository at this point in the history
… 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)
  • Loading branch information
bendbennett committed Nov 29, 2022
1 parent 55244fe commit abe43b2
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 18 deletions.
5 changes: 3 additions & 2 deletions datasource/schema/map_nested_attribute.go
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
5 changes: 3 additions & 2 deletions datasource/schema/set_nested_attribute.go
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
5 changes: 3 additions & 2 deletions datasource/schema/single_nested_attribute.go
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
5 changes: 3 additions & 2 deletions provider/schema/map_nested_attribute.go
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
5 changes: 3 additions & 2 deletions provider/schema/set_nested_attribute.go
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
5 changes: 3 additions & 2 deletions provider/schema/single_nested_attribute.go
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
5 changes: 3 additions & 2 deletions resource/schema/map_nested_attribute.go
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
5 changes: 3 additions & 2 deletions resource/schema/set_nested_attribute.go
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
5 changes: 3 additions & 2 deletions resource/schema/single_nested_attribute.go
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit abe43b2

Please sign in to comment.