From 7015047d012bef81b7a487587ed7522579d56391 Mon Sep 17 00:00:00 2001 From: "Benjamin M. Hughes" Date: Mon, 8 Nov 2021 18:52:06 +0000 Subject: [PATCH] fix: Netbox Boolean custom fields take a Boolean type value Netbox will accept the previous Integer values but they will be stored as Integers and not casted to Boolean. This breaks the web UI (which will show undefined) and anything that queries the API expecting a Boolean type as an Integer will be returned. --- netbox/util.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netbox/util.go b/netbox/util.go index a1253b4b3..ddbb78ed1 100644 --- a/netbox/util.go +++ b/netbox/util.go @@ -246,9 +246,9 @@ func convertCustomFieldsFromTerraformToAPI(stateCustomFields []interface{}, cust toReturn[cfName] = cfValueInt } else if cfType == CustomFieldBoolean { if cfValue == "true" { - toReturn[cfName] = 1 + toReturn[cfName] = true } else if cfValue == "false" { - toReturn[cfName] = 0 + toReturn[cfName] = false } } else if cfType == "multiple" { cfValueArray := strings.Split(cfValue, ",")