Skip to content

Commit

Permalink
fix: Netbox Boolean custom fields take a Boolean type value
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bmhughes committed Nov 9, 2021
1 parent cc8c973 commit 7015047
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions netbox/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, ",")
Expand Down

0 comments on commit 7015047

Please sign in to comment.