mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-10 07:35:34 -06:00
provider/azurerm: Public IP - Setting idle timeout value caused panic. (#8283)
Setting the idle_timeout_in_minutes value of the azurerm_public_ip resource always caused a panic. This fixes it and adds a test to actually test that particular attribute.
This commit is contained in:
parent
c3e46a181f
commit
7f096a677f
@ -125,7 +125,7 @@ func resourceArmPublicIpCreate(d *schema.ResourceData, meta interface{}) error {
|
||||
}
|
||||
|
||||
if v, ok := d.GetOk("idle_timeout_in_minutes"); ok {
|
||||
idle_timeout := v.(int32)
|
||||
idle_timeout := int32(v.(int))
|
||||
properties.IdleTimeoutInMinutes = &idle_timeout
|
||||
}
|
||||
|
||||
|
@ -98,6 +98,31 @@ func TestAccAzureRMPublicIpStatic_basic(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccAzureRMPublicIpStatic_idleTimeout(t *testing.T) {
|
||||
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccAzureRMVPublicIpStatic_idleTimeout, ri, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testCheckAzureRMPublicIpDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
resource.TestStep{
|
||||
Config: config,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testCheckAzureRMPublicIpExists("azurerm_public_ip.test"),
|
||||
resource.TestCheckResourceAttr(
|
||||
"azurerm_public_ip.test",
|
||||
"idle_timeout_in_minutes",
|
||||
"30",
|
||||
),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccAzureRMPublicIpStatic_withTags(t *testing.T) {
|
||||
|
||||
ri := acctest.RandInt()
|
||||
@ -267,6 +292,20 @@ resource "azurerm_public_ip" "test" {
|
||||
}
|
||||
`
|
||||
|
||||
var testAccAzureRMVPublicIpStatic_idleTimeout = `
|
||||
resource "azurerm_resource_group" "test" {
|
||||
name = "acctestrg-%d"
|
||||
location = "West US"
|
||||
}
|
||||
resource "azurerm_public_ip" "test" {
|
||||
name = "acctestpublicip-%d"
|
||||
location = "West US"
|
||||
resource_group_name = "${azurerm_resource_group.test.name}"
|
||||
public_ip_address_allocation = "static"
|
||||
idle_timeout_in_minutes = 30
|
||||
}
|
||||
`
|
||||
|
||||
var testAccAzureRMVPublicIpDynamic_basic = `
|
||||
resource "azurerm_resource_group" "test" {
|
||||
name = "acctestrg-%d"
|
||||
|
Loading…
Reference in New Issue
Block a user