From 2a7a2ff4938832076f401f912a5cb3286180a584 Mon Sep 17 00:00:00 2001 From: Pavel Boldyrev <627562+bpg@users.noreply.github.com> Date: Mon, 12 May 2025 22:26:53 -0400 Subject: [PATCH] fix(network): adjust Linux Bridge name validator (#1961) Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com> --- .../virtual_environment_network_linux_bridge.md | 2 +- fwprovider/nodes/network/resource_linux_bridge.go | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/resources/virtual_environment_network_linux_bridge.md b/docs/resources/virtual_environment_network_linux_bridge.md index 064a11fc..9c710a5a 100644 --- a/docs/resources/virtual_environment_network_linux_bridge.md +++ b/docs/resources/virtual_environment_network_linux_bridge.md @@ -50,7 +50,7 @@ resource "proxmox_virtual_environment_network_linux_vlan" "vlan99" { ### Required -- `name` (String) The interface name. Must be `vmbrN`, where N is a number between 0 and 9999. +- `name` (String) The interface name. Commonly vmbr[N], where 0 ≤ N ≤ 4094 (vmbr0 - vmbr4094), but can be any alphanumeric string that starts with a character and is at most 10 characters long. - `node_name` (String) The name of the node. ### Optional diff --git a/fwprovider/nodes/network/resource_linux_bridge.go b/fwprovider/nodes/network/resource_linux_bridge.go index f1254f91..3ef7d9bb 100644 --- a/fwprovider/nodes/network/resource_linux_bridge.go +++ b/fwprovider/nodes/network/resource_linux_bridge.go @@ -180,13 +180,14 @@ func (r *linuxBridgeResource) Schema( Required: true, }, "name": schema.StringAttribute{ - Description: "The interface name.", - MarkdownDescription: "The interface name. Must be `vmbrN`, where N is a number between 0 and 9999.", - Required: true, + Description: "The interface name.", + MarkdownDescription: "The interface name. Commonly vmbr[N], where 0 ≤ N ≤ 4094 (vmbr0 - vmbr4094), but " + + "can be any alphanumeric string that starts with a character and is at most 10 characters long.", + Required: true, Validators: []validator.String{ stringvalidator.RegexMatches( - regexp.MustCompile(`^vmbr(\d{1,4})$`), - `must be "vmbrN", where N is a number between 0 and 9999`, + regexp.MustCompile(`^[A-Za-z][A-Za-z0-9]{0,9}$`), + `must be an alphanumeric string that starts with a character and is at most 10 characters long`, ), }, PlanModifiers: []planmodifier.String{