change snmp_enabled default from true to false so devices like resolver1 that only need ping/dns don't trigger unnecessary snmp discovery. skip sending snmp_version/snmp_port to the api when snmp_enabled is false.
3.5 KiB
3.5 KiB
| page_title | description |
|---|---|
| towerops_device Resource - TowerOps | Manages a TowerOps device. |
towerops_device (Resource)
Manages a TowerOps device. Devices represent network equipment that can be assigned to a site or directly to the organization.
Example Usage
Site-based Device with SNMP v2c
resource "towerops_device" "router" {
site_id = towerops_site.example.id
name = "Core Router"
ip_address = "192.168.1.1"
monitoring_enabled = true
snmp_enabled = true
snmp_version = "2c"
snmp_port = 161
}
Organization-level Device (Site-less)
Devices can be created without a site, assigned directly to the organization:
resource "towerops_device" "cloud_router" {
name = "Cloud Router"
ip_address = "10.0.1.1"
# No site_id - device belongs directly to organization
}
Device with SNMPv3
resource "towerops_device" "secure_switch" {
name = "Secure Switch"
ip_address = "192.168.1.10"
snmp_version = "3"
# SNMPv3 security settings
snmpv3_security_level = "authPriv"
snmpv3_username = "snmpuser"
snmpv3_auth_protocol = "SHA-256"
snmpv3_auth_password = var.snmp_auth_password
snmpv3_priv_protocol = "AES"
snmpv3_priv_password = var.snmp_priv_password
}
Ping/DNS-only Device (no SNMP)
resource "towerops_device" "resolver" {
site_id = towerops_site.example.id
name = "resolver1"
ip_address = "204.110.191.240"
}
Minimal Configuration
resource "towerops_device" "switch" {
name = "Access Switch"
ip_address = "192.168.1.2"
}
Schema
Required
ip_address(String) - The IP address of the device.
Optional
site_id(String) - The ID of the site this device belongs to. Optional iforganization_idis provided. Changing this forces a new resource.organization_id(String) - The ID of the organization this device belongs to. Defaults to the authenticated organization if not provided. Changing this forces a new resource.name(String) - The name of the device. If not provided, will be auto-discovered from SNMP.description(String) - A description of the device.monitoring_enabled(Boolean) - Whether monitoring is enabled for this device. Default:true.snmp_enabled(Boolean) - Whether SNMP polling is enabled for this device. Default:false.snmp_version(String) - The SNMP version to use (1,2c, or3). Default:"2c".snmp_port(Number) - The SNMP port to use. Default:161.
SNMPv3 Fields (only used when snmp_version = "3")
snmpv3_security_level(String) - SNMPv3 security level. Must be one of:noAuthNoPriv- No authentication or privacyauthNoPriv- Authentication without privacyauthPriv- Authentication with privacy
snmpv3_username(String) - SNMPv3 username.snmpv3_auth_protocol(String) - SNMPv3 authentication protocol. Must be one of:MD5,SHA,SHA-224,SHA-256,SHA-384,SHA-512.snmpv3_auth_password(String, Sensitive) - SNMPv3 authentication password.snmpv3_priv_protocol(String) - SNMPv3 privacy protocol. Must be one of:DES,AES,AES-192,AES-256.snmpv3_priv_password(String, Sensitive) - SNMPv3 privacy password.
Read-Only
id(String) - The unique identifier of the device.inserted_at(String) - The timestamp when the device was created.
Import
Devices can be imported using their UUID:
terraform import towerops_device.router 7c9e6679-7425-40de-944b-e07fc1f90ae7