From 77b0e5e0a282542e35f7600580fb545277a0d39b Mon Sep 17 00:00:00 2001 From: kt Date: Thu, 13 Sep 2018 16:29:18 -0700 Subject: [PATCH] updates public ip idle timeout default value to 4 --- azurestack/resource_arm_public_ip.go | 7 ++++--- azurestack/resource_arm_public_ip_test.go | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/azurestack/resource_arm_public_ip.go b/azurestack/resource_arm_public_ip.go index 884a010c1..a5609bab3 100644 --- a/azurestack/resource_arm_public_ip.go +++ b/azurestack/resource_arm_public_ip.go @@ -63,6 +63,7 @@ func resourceArmPublicIp() *schema.Resource { "idle_timeout_in_minutes": { Type: schema.TypeInt, Optional: true, + Default: 4, ValidateFunc: validation.IntBetween(4, 30), }, @@ -131,12 +132,14 @@ func resourceArmPublicIpCreate(d *schema.ResourceData, meta interface{}) error { // } ipAllocationMethod := d.Get("public_ip_address_allocation").(string) + idleTimeout := d.Get("idle_timeout_in_minutes").(int) publicIp := network.PublicIPAddress{ Name: &name, Location: &location, PublicIPAddressPropertiesFormat: &network.PublicIPAddressPropertiesFormat{ PublicIPAllocationMethod: network.IPAllocationMethod(ipAllocationMethod), + IdleTimeoutInMinutes: utils.Int32(int32(idleTimeout)), }, Tags: *expandTags(tags), // Not supported for 2017-03-09 profile @@ -163,9 +166,7 @@ func resourceArmPublicIpCreate(d *schema.ResourceData, meta interface{}) error { publicIp.PublicIPAddressPropertiesFormat.DNSSettings = &dnsSettings } - if v, ok := d.GetOk("idle_timeout_in_minutes"); ok { - publicIp.PublicIPAddressPropertiesFormat.IdleTimeoutInMinutes = utils.Int32(int32(v.(int))) - } + future, err := client.CreateOrUpdate(ctx, resGroup, name, publicIp) if err != nil { diff --git a/azurestack/resource_arm_public_ip_test.go b/azurestack/resource_arm_public_ip_test.go index ddc2abd92..6288bbd00 100644 --- a/azurestack/resource_arm_public_ip_test.go +++ b/azurestack/resource_arm_public_ip_test.go @@ -3,13 +3,13 @@ package azurestack import ( "fmt" "net/http" + "os" + "regexp" "testing" "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" - "os" - "regexp" ) func TestResourceAzureStackPublicIpDomainNameLabel_validation(t *testing.T) {