Plenty of writes now works and an expanded example exists in the terraform directory

This commit is contained in:
Joachim Friberg committed 2026-08-25 20:25:08 +02:00
1 parent a6f1019175
commit fb8d468943
15 files changed
+1344 -74

No files matched your search

+51 -14
View File
@@ -1,17 +1,54 @@
# All 13 read-only extractors are now ported as data sources -- see
# ~/code/experiments/hpe/terraform-provider-hpe1810/internal/provider/data_source_*.go
# Eventually resource "hpe1810_locator" once actions/locator.py is ported.
#
# 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
}
data "hpe1810_system_description" "this" {}
data "hpe1810_network_setup" "this" {}
data "hpe1810_port_summary" "this" {}
data "hpe1810_lldp_statistics" "this" {}
data "hpe1810_buffered_log" "this" {}
data "hpe1810_mac_table" "this" {}
data "hpe1810_trunk_status" "this" {}
data "hpe1810_loop_protection_status" "this" {}
data "hpe1810_dual_image_status" "this" {}
data "hpe1810_clock" "this" {}
data "hpe1810_sntp" "this" {}
data "hpe1810_log_configuration" "this" {}
data "hpe1810_backup_manager" "this" {}
# 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" {}