122 lines
4.7 KiB
Terraform
122 lines
4.7 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 = ""
|
|
}
|
|
|
|
# Fifth write resource: Time Zone Configuration. Singleton; Delete resets
|
|
# to "None" with an empty acronym (see resource_time_zone.go).
|
|
resource "hpe1810_time_zone" "draupnir01" {
|
|
zone = "(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna"
|
|
acronym = ""
|
|
}
|
|
|
|
# Sixth write resource: LLDP Global Mode settings only (LLDPConfig.html's
|
|
# per-port Interface Mode table isn't covered -- see resource_lldp_configuration.go).
|
|
# Singleton; Delete resets to factory defaults.
|
|
resource "hpe1810_lldp_configuration" "draupnir01" {
|
|
transmit_interval = 30
|
|
transmit_hold = 4
|
|
reinit_delay = 2
|
|
notification_interval = 5
|
|
}
|
|
|
|
# Seventh write resource: Daylight Saving Time. Singleton; only "Disable"
|
|
# and "Recurring" modes are supported (see resource_daylight_saving_time.go
|
|
# and client/dst_config.go -- NonRecurring uses a different field set and is
|
|
# rejected). Delete sets mode to Disable. Values below match what's
|
|
# currently live (standard EU DST rule).
|
|
resource "hpe1810_daylight_saving_time" "draupnir01" {
|
|
mode = "Recurring"
|
|
start_week = 5
|
|
start_day = "Sun"
|
|
start_month = "Mar"
|
|
start_hour = 2
|
|
start_minute = 0
|
|
end_week = 5
|
|
end_day = "Sun"
|
|
end_month = "Oct"
|
|
end_hour = 3
|
|
end_minute = 0
|
|
offset_minutes = 1
|
|
offset_acronym = ""
|
|
}
|
|
|
|
# Eighth write resource: Flow Control (SwitchConfig.html). Singleton;
|
|
# Delete resets to Enable (factory default).
|
|
resource "hpe1810_flow_control" "draupnir01" {
|
|
enabled = true
|
|
}
|
|
|
|
# Ninth write resource: Port Mirroring global settings only (FDBConfig.html's
|
|
# per-source-port Direction table isn't covered -- see resource_port_mirroring.go).
|
|
# Singleton; Delete disables mirroring and clears the destination port.
|
|
resource "hpe1810_port_mirroring" "draupnir01" {
|
|
enabled = false
|
|
destination_port = ""
|
|
}
|
|
|
|
# Tenth write resource: link aggregation (LAG). Genuinely different shape
|
|
# from everything above -- a named sub-entity with create/delete, not a
|
|
# singleton or a fixed for_each set. See resource_trunk.go and
|
|
# client/trunk.go for the full write-protocol writeup, including the
|
|
# "including the Create-section fields in a delete request creates ANOTHER
|
|
# trunk as a side effect" quirk. admin_mode/static_capability are read-only
|
|
# here (not independently verified writable). Delete removes the trunk.
|
|
# No trunk declared by default -- add one here when you actually want to
|
|
# bond ports, e.g.:
|
|
#
|
|
# resource "hpe1810_trunk" "unraid" {
|
|
# name = "unraid"
|
|
# members = ["5", "6"]
|
|
# }
|
|
|
|
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" {}
|