From e3e47fb82f9ed87ff3e959a0f94bb0dc8cee6bb7 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Fri, 6 Feb 2026 14:05:15 -0600 Subject: [PATCH] fix: include SNMPv3 fields in API device responses The API was not returning SNMPv3 fields (security_level, username, auth_protocol, auth_password, priv_protocol, priv_password) in device responses, causing Terraform provider to see inconsistent state between plan and apply. Updated both format_device/1 and format_device_details/1 to include all SNMPv3 fields in JSON responses. --- .../controllers/api/v1/devices_controller.ex | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/towerops_web/controllers/api/v1/devices_controller.ex b/lib/towerops_web/controllers/api/v1/devices_controller.ex index 20a9d276..6af3e524 100644 --- a/lib/towerops_web/controllers/api/v1/devices_controller.ex +++ b/lib/towerops_web/controllers/api/v1/devices_controller.ex @@ -295,6 +295,14 @@ defmodule ToweropsWeb.Api.V1.DevicesController do organization_id: device.organization_id, monitoring_enabled: device.monitoring_enabled, snmp_enabled: device.snmp_enabled, + snmp_version: device.snmp_version, + snmp_port: device.snmp_port, + snmpv3_security_level: device.snmpv3_security_level, + snmpv3_username: device.snmpv3_username, + snmpv3_auth_protocol: device.snmpv3_auth_protocol, + snmpv3_auth_password: device.snmpv3_auth_password, + snmpv3_priv_protocol: device.snmpv3_priv_protocol, + snmpv3_priv_password: device.snmpv3_priv_password, inserted_at: device.inserted_at } end @@ -312,6 +320,12 @@ defmodule ToweropsWeb.Api.V1.DevicesController do snmp_enabled: device.snmp_enabled, snmp_version: device.snmp_version, snmp_port: device.snmp_port, + snmpv3_security_level: device.snmpv3_security_level, + snmpv3_username: device.snmpv3_username, + snmpv3_auth_protocol: device.snmpv3_auth_protocol, + snmpv3_auth_password: device.snmpv3_auth_password, + snmpv3_priv_protocol: device.snmpv3_priv_protocol, + snmpv3_priv_password: device.snmpv3_priv_password, inserted_at: device.inserted_at } end