diff --git a/port/entity/entityResourceToPortBody.go b/port/entity/entityResourceToPortBody.go index 97f5dca3..6ff6066c 100644 --- a/port/entity/entityResourceToPortBody.go +++ b/port/entity/entityResourceToPortBody.go @@ -100,7 +100,7 @@ func entityResourceToBody(ctx context.Context, state *EntityModel, bp *cli.Bluep if state.Properties.NumberProps != nil { for propIdentifier, prop := range state.Properties.NumberProps { - properties[propIdentifier] = prop + properties[propIdentifier] = prop.ValueFloat64() } } diff --git a/port/entity/model.go b/port/entity/model.go index 375e96c9..3b6c8a49 100644 --- a/port/entity/model.go +++ b/port/entity/model.go @@ -12,11 +12,11 @@ type ArrayPropsModel struct { } type EntityPropertiesModel struct { - StringProps map[string]string `tfsdk:"string_props"` - NumberProps map[string]float64 `tfsdk:"number_props"` - BooleanProps map[string]bool `tfsdk:"boolean_props"` - ObjectProps map[string]string `tfsdk:"object_props"` - ArrayProps *ArrayPropsModel `tfsdk:"array_props"` + StringProps map[string]string `tfsdk:"string_props"` + NumberProps map[string]types.Float64 `tfsdk:"number_props"` + BooleanProps map[string]bool `tfsdk:"boolean_props"` + ObjectProps map[string]string `tfsdk:"object_props"` + ArrayProps *ArrayPropsModel `tfsdk:"array_props"` } type RelationModel struct { diff --git a/port/entity/refreshEntityState.go b/port/entity/refreshEntityState.go index 603a8b4c..76a63dee 100644 --- a/port/entity/refreshEntityState.go +++ b/port/entity/refreshEntityState.go @@ -5,6 +5,7 @@ import ( "encoding/json" "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" "github.com/port-labs/terraform-provider-port-labs/internal/cli" ) @@ -56,9 +57,9 @@ func refreshPropertiesEntityState(ctx context.Context, state *EntityModel, e *cl switch t := v.(type) { case float64: if state.Properties.NumberProps == nil { - state.Properties.NumberProps = make(map[string]float64) + state.Properties.NumberProps = make(map[string]types.Float64) } - state.Properties.NumberProps[k] = float64(t) + state.Properties.NumberProps[k] = basetypes.NewFloat64Value(t) case string: if state.Properties.StringProps == nil { state.Properties.StringProps = make(map[string]string) diff --git a/port/entity/resource_test.go b/port/entity/resource_test.go index 3a7cd43f..52f27b47 100644 --- a/port/entity/resource_test.go +++ b/port/entity/resource_test.go @@ -65,7 +65,7 @@ func TestAccPortEntity(t *testing.T) { "myStringIdentifier" = "My String Value" } "number_props" = { - "myNumberIdentifier" = 123 + "myNumberIdentifier" = 123.456 } "boolean_props" = { "myBooleanIdentifier" = true @@ -102,7 +102,7 @@ func TestAccPortEntity(t *testing.T) { resource.TestCheckResourceAttr("port_entity.microservice", "title", "TF Provider Test Entity0"), resource.TestCheckResourceAttr("port_entity.microservice", "blueprint", identifier), resource.TestCheckResourceAttr("port_entity.microservice", "properties.string_props.myStringIdentifier", "My String Value"), - resource.TestCheckResourceAttr("port_entity.microservice", "properties.number_props.myNumberIdentifier", "123"), + resource.TestCheckResourceAttr("port_entity.microservice", "properties.number_props.myNumberIdentifier", "123.456"), resource.TestCheckResourceAttr("port_entity.microservice", "properties.boolean_props.myBooleanIdentifier", "true"), resource.TestCheckResourceAttr("port_entity.microservice", "properties.object_props.myObjectIdentifier", "{\"foo\":\"bar\"}"), resource.TestCheckResourceAttr("port_entity.microservice", "properties.array_props.string_items.myStringArrayIdentifier.0", "My Array Value"),