From d3b2316cf7ec63e78477aa20c1dd304dde23a496 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Nie=C3=9F?= Date: Mon, 1 May 2023 23:19:46 +0200 Subject: [PATCH] fix: Value and default for object CF are not lists --- .../extras/resource_netbox_extras_custom_field_object_test.go | 4 ++-- netbox/internal/customfield/customfield.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/netbox/extras/resource_netbox_extras_custom_field_object_test.go b/netbox/extras/resource_netbox_extras_custom_field_object_test.go index cf4409df3..a69cb82ba 100644 --- a/netbox/extras/resource_netbox_extras_custom_field_object_test.go +++ b/netbox/extras/resource_netbox_extras_custom_field_object_test.go @@ -115,9 +115,9 @@ func testAccCheckNetboxExtrasCustomFieldObjectConfig(nameSuffix string, resource weight = 50 #required = true filter_logic = "disabled" - default = jsonencode([ + default = jsonencode( netbox_dcim_platform.test.id - ]) + ) {{ end }} } ` diff --git a/netbox/internal/customfield/customfield.go b/netbox/internal/customfield/customfield.go index 75cfb58f0..9969c99d4 100644 --- a/netbox/internal/customfield/customfield.go +++ b/netbox/internal/customfield/customfield.go @@ -196,7 +196,7 @@ func ConvertCustomFieldsFromTerraformToAPI(stateCustomFields []interface{}, cust toReturn[cfName] = jsonList case customFieldObject: cfValueInt, _ := strconv.Atoi(cfValue) - toReturn[cfName] = []int{cfValueInt} + toReturn[cfName] = cfValueInt case customFieldMultiObject: var jsonList []interface{} err := json.Unmarshal([]byte(cfValue), &jsonList)