From 1a4dd60149469bf4287487cd726a0946950ac802 Mon Sep 17 00:00:00 2001 From: Rohit Upadhyay Date: Fri, 29 Dec 2023 11:05:59 +0530 Subject: [PATCH] Added mtu attribute to vlan resource --- bigip/resource_bigip_net_vlan.go | 12 +++++++++++- bigip/resource_bigip_net_vlan_test.go | 2 ++ docs/resources/bigip_net_vlan.md | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/bigip/resource_bigip_net_vlan.go b/bigip/resource_bigip_net_vlan.go index 6a6f60af2..fe66a3633 100644 --- a/bigip/resource_bigip_net_vlan.go +++ b/bigip/resource_bigip_net_vlan.go @@ -53,7 +53,6 @@ func resourceBigipNetVlan() *schema.Resource { Optional: true, Description: "Vlan name", }, - "tagged": { Type: schema.TypeBool, Optional: true, @@ -62,6 +61,13 @@ func resourceBigipNetVlan() *schema.Resource { }, }, }, + "mtu": { + Type: schema.TypeInt, + Optional: true, + Description: "Maximum Transmission Unit (MTU) for the VLAN", + Default: 1500, + ValidateFunc: validation.IntBetween(576, 9198), + }, "cmp_hash": { Type: schema.TypeString, Optional: true, @@ -79,6 +85,7 @@ func resourceBigipNetVlanCreate(ctx context.Context, d *schema.ResourceData, met name := d.Get("name").(string) tag := d.Get("tag").(int) + mtu := d.Get("mtu").(int) log.Printf("[INFO] Creating VLAN %s", name) @@ -87,6 +94,7 @@ func resourceBigipNetVlanCreate(ctx context.Context, d *schema.ResourceData, met r := &bigip.Vlan{ Name: name, Tag: tag, + MTU: mtu, CMPHash: d.Get("cmp_hash").(string), } @@ -135,6 +143,7 @@ func resourceBigipNetVlanRead(ctx context.Context, d *schema.ResourceData, meta _ = d.Set("name", vlan.FullPath) _ = d.Set("tag", vlan.Tag) _ = d.Set("cmp_hash", vlan.CMPHash) + _ = d.Set("mtu", vlan.MTU) log.Printf("[DEBUG] Reading VLAN %s Interfaces", name) @@ -178,6 +187,7 @@ func resourceBigipNetVlanUpdate(ctx context.Context, d *schema.ResourceData, met r := &bigip.Vlan{ Name: name, Tag: d.Get("tag").(int), + MTU: d.Get("mtu").(int), CMPHash: d.Get("cmp_hash").(string), } diff --git a/bigip/resource_bigip_net_vlan_test.go b/bigip/resource_bigip_net_vlan_test.go index 959430a12..3eda57e5e 100644 --- a/bigip/resource_bigip_net_vlan_test.go +++ b/bigip/resource_bigip_net_vlan_test.go @@ -26,6 +26,7 @@ resource "bigip_net_vlan" "test-vlan" { vlanport = 1.1 tagged = true } + mtu = 900 } ` @@ -45,6 +46,7 @@ func TestAccBigipNetvlan_create(t *testing.T) { resource.TestCheckResourceAttr("bigip_net_vlan.test-vlan", "tag", "101"), resource.TestCheckResourceAttr("bigip_net_vlan.test-vlan", "interfaces.0.vlanport", "1.1"), resource.TestCheckResourceAttr("bigip_net_vlan.test-vlan", "interfaces.0.tagged", "true"), + resource.TestCheckResourceAttr("bigip_net_vlan.test-vlan", "mtu", "900"), ), }, }, diff --git a/docs/resources/bigip_net_vlan.md b/docs/resources/bigip_net_vlan.md index 931caf34f..0d727fb1b 100644 --- a/docs/resources/bigip_net_vlan.md +++ b/docs/resources/bigip_net_vlan.md @@ -42,3 +42,5 @@ resource "bigip_net_vlan" "vlan1" { * `cmp_hash` - (Optional,type `string`) Specifies how the traffic on the VLAN will be disaggregated. The value selected determines the traffic disaggregation method. possible options: [`default`, `src-ip`, `dst-ip`] * `tagged` - Specifies a list of tagged interfaces or trunks associated with this VLAN. Note that you can associate tagged interfaces or trunks with any number of VLANs. + +* `mtu` - Specifies the maximum transmission unit (MTU) for traffic on this VLAN. The default value is `1500`.