Skip to content

Commit

Permalink
updates public ip idle timeout default value to 4
Browse files Browse the repository at this point in the history
  • Loading branch information
katbyte committed Sep 14, 2018
1 parent bc31169 commit 41f0e1c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions azurestack/resource_arm_public_ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func resourceArmPublicIp() *schema.Resource {
"idle_timeout_in_minutes": {
Type: schema.TypeInt,
Optional: true,
Default: 4,
ValidateFunc: validation.IntBetween(4, 30),
},

Expand Down Expand Up @@ -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
Expand All @@ -163,10 +166,6 @@ 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 {
return fmt.Errorf("Error Creating/Updating Public IP %q (Resource Group %q): %+v", name, resGroup, err)
Expand Down
4 changes: 2 additions & 2 deletions azurestack/resource_arm_public_ip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 41f0e1c

Please sign in to comment.