Skip to content

Commit

Permalink
Fix Virtual Server 0.0.0.0 Mask Conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
ramaniprateek committed Jan 11, 2024
1 parent 49ea65c commit e7d183b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion bigip/resource_bigip_ltm_virtual_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,9 @@ func resourceBigipLtmVirtualServerRead(ctx context.Context, d *schema.ResourceDa
_ = d.Set("ip_protocol", vs.IPProtocol)
_ = d.Set("name", name)
_ = d.Set("pool", vs.Pool)
_ = d.Set("mask", vs.Mask)
if _, ok := d.GetOk("mask"); !ok {
_ = d.Set("mask", vs.Mask)
}

// /* Service port is provided by the API in the destination attribute "/partition_name/virtual_server_address[%route_domain]:(port)"
// so we need to extract it
Expand Down
8 changes: 4 additions & 4 deletions bigip/resource_bigip_ltm_virtual_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ resource "bigip_ltm_policy" "http_to_https_redirect" {
}
resource "bigip_ltm_virtual_server" "test-vs" {
name = "` + TestVsName + `"
destination = "10.255.255.254"
destination = "0.0.0.0"
description = "VirtualServer-test"
port = 9999
mask = "255.255.255.255"
mask = "0.0.0.0"
source_address_translation = "automap"
ip_protocol = "tcp"
irules = [bigip_ltm_irule.test-rule-vstc1.name]
Expand Down Expand Up @@ -99,10 +99,10 @@ func TestAccBigipLtmVirtualServerCreateV4V6(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testCheckVSExists(TestVsName),
resource.TestCheckResourceAttr("bigip_ltm_virtual_server.test-vs", "name", TestVsName),
resource.TestCheckResourceAttr("bigip_ltm_virtual_server.test-vs", "destination", "10.255.255.254"),
resource.TestCheckResourceAttr("bigip_ltm_virtual_server.test-vs", "destination", "0.0.0.0"),
resource.TestCheckResourceAttr("bigip_ltm_virtual_server.test-vs", "port", "9999"),
resource.TestCheckResourceAttr("bigip_ltm_virtual_server.test-vs", "state", "enabled"),
resource.TestCheckResourceAttr("bigip_ltm_virtual_server.test-vs", "mask", "255.255.255.255"),
resource.TestCheckResourceAttr("bigip_ltm_virtual_server.test-vs", "mask", "0.0.0.0"),
resource.TestCheckResourceAttr("bigip_ltm_virtual_server.test-vs", "source", "0.0.0.0/0"),
resource.TestCheckResourceAttr("bigip_ltm_virtual_server.test-vs", "source_address_translation", "automap"),
resource.TestCheckResourceAttr("bigip_ltm_virtual_server.test-vs", "ip_protocol", "tcp"),
Expand Down

0 comments on commit e7d183b

Please sign in to comment.