Files
hp-iac/terraform/main.tf
T

55 lines
2.2 KiB
Terraform

# All 13 read-only extractors are now ported as data sources -- see
# ~/code/experiments/hpe/terraform-provider-hpe1810/internal/provider/data_source_*.go
#
# First write resource: the locator LED. Singleton; Delete resets it to
# Disable (see resource_locator.go for why that's safe here specifically).
resource "hpe1810_locator" "draupnir01" {
enabled = false
}
# Second write resource: Green Features (EEE power-saving). Singleton;
# Delete resets to factory defaults (see resource_green_features.go).
# Values below match what's currently live on the switch, so the first
# `tofu plan` shows no drift.
resource "hpe1810_green_features" "draupnir01" {
green_mode = true
mode_led_time = 10
phy_auto_power_down = true
}
# Third write resource: per-port config, driven by for_each over var.ports
# (see variables.tf). The admin_port (default 24, see provider.tf) can
# never be written by draupnir01 resource regardless of what's in var.ports --
# see resource_port.go's guardAdminPort. Delete disables the port and
# resets Link Speed to Auto (see resource_port.go for why that's safe here).
resource "hpe1810_port" "draupnir01" {
for_each = var.ports
interface = each.key
admin_mode = each.value.admin_mode
link_speed = each.value.link_speed
}
# Fourth write resource: System Name/Location/Contact (SysDescription.html).
# Singleton; only these three fields are actually writable on that page --
# see resource_system_description.go. Delete resets all three to "".
resource "hpe1810_system_description" "draupnir01" {
name = "draupnir01"
location = "Lab"
contact = ""
}
data "hpe1810_system_description" "draupnir01" {}
data "hpe1810_network_setup" "draupnir01" {}
data "hpe1810_port_summary" "draupnir01" {}
data "hpe1810_lldp_statistics" "draupnir01" {}
data "hpe1810_buffered_log" "draupnir01" {}
data "hpe1810_mac_table" "draupnir01" {}
data "hpe1810_trunk_status" "draupnir01" {}
data "hpe1810_loop_protection_status" "draupnir01" {}
data "hpe1810_dual_image_status" "draupnir01" {}
data "hpe1810_clock" "draupnir01" {}
data "hpe1810_sntp" "draupnir01" {}
data "hpe1810_log_configuration" "draupnir01" {}
data "hpe1810_backup_manager" "draupnir01" {}