mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-07-03 12:02:57 +00:00
fix(network): remove computed flag from mtu attribute (#572)
* chore(code): refactor & update network tests * fix(network): remove `computed` flag from `mtu` attribute * chore: revert accidentally committed files * chore: update docs
This commit is contained in:
parent
7d064a8b27
commit
5720fe4673
@ -50,7 +50,7 @@ resource "proxmox_virtual_environment_network_linux_bridge" "vmbr99" {
|
||||
- `gateway6` (String) Default IPv6 gateway address.
|
||||
- `mtu` (Number) The interface MTU.
|
||||
- `ports` (List of String) The interface bridge ports.
|
||||
- `vlan_aware` (Boolean) Whether the interface bridge is VLAN aware (defaults to `true`).
|
||||
- `vlan_aware` (Boolean) Whether the interface bridge is VLAN aware (defaults to `false`).
|
||||
|
||||
### Read-Only
|
||||
|
||||
|
@ -220,7 +220,6 @@ func (r *linuxBridgeResource) Schema(
|
||||
"mtu": schema.Int64Attribute{
|
||||
Description: "The interface MTU.",
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
},
|
||||
"comment": schema.StringAttribute{
|
||||
Description: "Comment for the interface.",
|
||||
@ -233,7 +232,7 @@ func (r *linuxBridgeResource) Schema(
|
||||
ElementType: types.StringType,
|
||||
},
|
||||
"vlan_aware": schema.BoolAttribute{
|
||||
Description: "Whether the interface bridge is VLAN aware (defaults to `true`).",
|
||||
Description: "Whether the interface bridge is VLAN aware (defaults to `false`).",
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
},
|
||||
|
@ -193,7 +193,6 @@ func (r *linuxVLANResource) Schema(
|
||||
"mtu": schema.Int64Attribute{
|
||||
Description: "The interface MTU.",
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
},
|
||||
"comment": schema.StringAttribute{
|
||||
Description: "Comment for the interface.",
|
||||
|
@ -56,25 +56,25 @@ func TestAccResourceLinuxBridge(t *testing.T) {
|
||||
func testAccResourceLinuxBridgeCreatedConfig(name string, ipV4cidr string) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "proxmox_virtual_environment_network_linux_bridge" "test" {
|
||||
node_name = "%s"
|
||||
name = "%s"
|
||||
address = "%s"
|
||||
comment = "created by terraform"
|
||||
vlan_aware = true
|
||||
autostart = true
|
||||
comment = "created by terraform"
|
||||
mtu = 1499
|
||||
name = "%s"
|
||||
node_name = "%s"
|
||||
vlan_aware = true
|
||||
}
|
||||
`, accTestNodeName, name, ipV4cidr)
|
||||
`, ipV4cidr, name, accTestNodeName)
|
||||
}
|
||||
|
||||
func testAccResourceLinuxBridgeCreatedCheck(name string, ipV4cidr string) resource.TestCheckFunc {
|
||||
return resource.ComposeTestCheckFunc(
|
||||
resource.TestCheckResourceAttr(accTestLinuxBridgeName, "name", name),
|
||||
resource.TestCheckResourceAttr(accTestLinuxBridgeName, "address", ipV4cidr),
|
||||
resource.TestCheckResourceAttr(accTestLinuxBridgeName, "comment", "created by terraform"),
|
||||
resource.TestCheckResourceAttr(accTestLinuxBridgeName, "vlan_aware", "true"),
|
||||
resource.TestCheckResourceAttr(accTestLinuxBridgeName, "autostart", "true"),
|
||||
resource.TestCheckResourceAttr(accTestLinuxBridgeName, "comment", "created by terraform"),
|
||||
resource.TestCheckResourceAttr(accTestLinuxBridgeName, "mtu", "1499"),
|
||||
resource.TestCheckResourceAttr(accTestLinuxBridgeName, "name", name),
|
||||
resource.TestCheckResourceAttr(accTestLinuxBridgeName, "vlan_aware", "true"),
|
||||
resource.TestCheckResourceAttrSet(accTestLinuxBridgeName, "id"),
|
||||
)
|
||||
}
|
||||
@ -82,27 +82,27 @@ func testAccResourceLinuxBridgeCreatedCheck(name string, ipV4cidr string) resour
|
||||
func testAccResourceLinuxBridgeUpdatedConfig(name string, ipV4cidr string, ipV6cidr string) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "proxmox_virtual_environment_network_linux_bridge" "test" {
|
||||
node_name = "%s"
|
||||
name = "%s"
|
||||
address = "%s"
|
||||
address6 = "%s"
|
||||
comment = "updated by terraform"
|
||||
vlan_aware = false
|
||||
autostart = false
|
||||
comment = "updated by terraform"
|
||||
mtu = null
|
||||
name = "%s"
|
||||
node_name = "%s"
|
||||
vlan_aware = false
|
||||
}
|
||||
`, accTestNodeName, name, ipV4cidr, ipV6cidr)
|
||||
`, ipV4cidr, ipV6cidr, name, accTestNodeName)
|
||||
}
|
||||
|
||||
func testAccResourceLinuxBridgeUpdatedCheck(name string, ipV4cidr string, ipV6cidr string) resource.TestCheckFunc {
|
||||
return resource.ComposeTestCheckFunc(
|
||||
resource.ComposeAggregateTestCheckFunc(
|
||||
resource.TestCheckResourceAttr(accTestLinuxBridgeName, "name", name),
|
||||
resource.TestCheckResourceAttr(accTestLinuxBridgeName, "address", ipV4cidr),
|
||||
resource.TestCheckResourceAttr(accTestLinuxBridgeName, "address6", ipV6cidr),
|
||||
resource.TestCheckResourceAttr(accTestLinuxBridgeName, "comment", "updated by terraform"),
|
||||
resource.TestCheckResourceAttr(accTestLinuxBridgeName, "vlan_aware", "false"),
|
||||
resource.TestCheckResourceAttr(accTestLinuxBridgeName, "autostart", "false"),
|
||||
resource.TestCheckResourceAttr(accTestLinuxBridgeName, "comment", "updated by terraform"),
|
||||
resource.TestCheckResourceAttr(accTestLinuxBridgeName, "name", name),
|
||||
resource.TestCheckResourceAttr(accTestLinuxBridgeName, "vlan_aware", "false"),
|
||||
resource.TestCheckNoResourceAttr(accTestLinuxBridgeName, "mtu"),
|
||||
resource.TestCheckResourceAttrSet(accTestLinuxBridgeName, "id"),
|
||||
),
|
||||
|
@ -66,20 +66,20 @@ func TestAccResourceLinuxVLAN(t *testing.T) {
|
||||
func testAccResourceLinuxVLANCreatedConfig(iface string, vlan int) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "proxmox_virtual_environment_network_linux_vlan" "test" {
|
||||
node_name = "%s"
|
||||
name = "%s.%d"
|
||||
comment = "created by terraform"
|
||||
mtu = 1499
|
||||
name = "%s.%d"
|
||||
node_name = "%s"
|
||||
}
|
||||
`, accTestNodeName, iface, vlan)
|
||||
`, iface, vlan, accTestNodeName)
|
||||
}
|
||||
|
||||
func testAccResourceLinuxVLANCreatedCheck(iface string, vlan int) resource.TestCheckFunc {
|
||||
return resource.ComposeTestCheckFunc(
|
||||
resource.TestCheckResourceAttr(accTestLinuxVLANName, "name", fmt.Sprintf("%s.%d", iface, vlan)),
|
||||
resource.TestCheckResourceAttr(accTestLinuxVLANName, "comment", "created by terraform"),
|
||||
resource.TestCheckResourceAttr(accTestLinuxVLANName, "vlan", strconv.Itoa(vlan)),
|
||||
resource.TestCheckResourceAttr(accTestLinuxVLANName, "interface", iface),
|
||||
resource.TestCheckResourceAttr(accTestLinuxVLANName, "name", fmt.Sprintf("%s.%d", iface, vlan)),
|
||||
resource.TestCheckResourceAttr(accTestLinuxVLANName, "vlan", strconv.Itoa(vlan)),
|
||||
resource.TestCheckResourceAttrSet(accTestLinuxVLANName, "id"),
|
||||
)
|
||||
}
|
||||
@ -87,24 +87,24 @@ func testAccResourceLinuxVLANCreatedCheck(iface string, vlan int) resource.TestC
|
||||
func testAccResourceLinuxVLANCustomNameCreatedConfig(name string, iface string, vlan int) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "proxmox_virtual_environment_network_linux_vlan" "%s" {
|
||||
node_name = "%s"
|
||||
name = "%s"
|
||||
interface = "%s"
|
||||
vlan = %d
|
||||
comment = "created by terraform"
|
||||
interface = "%s"
|
||||
mtu = 1499
|
||||
name = "%s"
|
||||
node_name = "%s"
|
||||
vlan = %d
|
||||
}
|
||||
`, name, accTestNodeName, name, iface, vlan)
|
||||
`, name, iface, name, accTestNodeName, vlan)
|
||||
}
|
||||
|
||||
func testAccResourceLinuxVLANCustomNameCreatedCheck(name string, iface string, vlan int) resource.TestCheckFunc {
|
||||
resourceName := fmt.Sprintf("proxmox_virtual_environment_network_linux_vlan.%s", name)
|
||||
|
||||
return resource.ComposeTestCheckFunc(
|
||||
resource.TestCheckResourceAttr(resourceName, "name", name),
|
||||
resource.TestCheckResourceAttr(resourceName, "comment", "created by terraform"),
|
||||
resource.TestCheckResourceAttr(resourceName, "vlan", strconv.Itoa(vlan)),
|
||||
resource.TestCheckResourceAttr(resourceName, "interface", iface),
|
||||
resource.TestCheckResourceAttr(resourceName, "name", name),
|
||||
resource.TestCheckResourceAttr(resourceName, "vlan", strconv.Itoa(vlan)),
|
||||
resource.TestCheckResourceAttrSet(resourceName, "id"),
|
||||
)
|
||||
}
|
||||
@ -112,24 +112,23 @@ func testAccResourceLinuxVLANCustomNameCreatedCheck(name string, iface string, v
|
||||
func testAccResourceLinuxVLANUpdatedConfig(iface string, vlan int, ipV4cidr string) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "proxmox_virtual_environment_network_linux_vlan" "test" {
|
||||
node_name = "%s"
|
||||
name = "%s.%d"
|
||||
address = "%s"
|
||||
address6 = "FE80:0000:0000:0000:0202:B3FF:FE1E:8329/64"
|
||||
comment = "updated by terraform"
|
||||
mtu = null
|
||||
name = "%s.%d"
|
||||
node_name = "%s"
|
||||
}
|
||||
`, accTestNodeName, iface, vlan, ipV4cidr)
|
||||
`, ipV4cidr, iface, vlan, accTestNodeName)
|
||||
}
|
||||
|
||||
func testAccResourceLinuxVLANUpdatedCheck(iface string, vlan int, ipV4cidr string) resource.TestCheckFunc {
|
||||
return resource.ComposeTestCheckFunc(
|
||||
resource.TestCheckResourceAttr(accTestLinuxVLANName, "name", fmt.Sprintf("%s.%d", iface, vlan)),
|
||||
resource.TestCheckResourceAttr(accTestLinuxVLANName, "vlan", strconv.Itoa(vlan)),
|
||||
resource.TestCheckResourceAttr(accTestLinuxVLANName, "interface", iface),
|
||||
resource.TestCheckResourceAttr(accTestLinuxVLANName, "address", ipV4cidr),
|
||||
resource.TestCheckResourceAttr(accTestLinuxVLANName, "address6", "FE80:0000:0000:0000:0202:B3FF:FE1E:8329/64"),
|
||||
resource.TestCheckResourceAttr(accTestLinuxVLANName, "comment", "updated by terraform"),
|
||||
resource.TestCheckResourceAttr(accTestLinuxVLANName, "interface", iface),
|
||||
resource.TestCheckResourceAttr(accTestLinuxVLANName, "name", fmt.Sprintf("%s.%d", iface, vlan)),
|
||||
resource.TestCheckResourceAttr(accTestLinuxVLANName, "vlan", strconv.Itoa(vlan)),
|
||||
resource.TestCheckNoResourceAttr(accTestLinuxVLANName, "mtu"),
|
||||
resource.TestCheckResourceAttrSet(accTestLinuxVLANName, "id"),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user