Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arm_public_ip: public_ips can be dynamic for ipv6 addresses #6140

Merged
merged 1 commit into from
Mar 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions azurerm/internal/services/network/resource_arm_public_ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,6 @@ func resourceArmPublicIpCreateUpdate(d *schema.ResourceData, meta interface{}) e
ipVersion := network.IPVersion(d.Get("ip_version").(string))
ipAllocationMethod := d.Get("allocation_method").(string)

if strings.EqualFold(string(ipVersion), string(network.IPv6)) {
if strings.EqualFold(ipAllocationMethod, "static") {
return fmt.Errorf("Cannot specify publicIpAllocationMethod as Static for IPv6 PublicIp")
}
}

if strings.EqualFold(sku, "standard") {
if !strings.EqualFold(ipAllocationMethod, "static") {
return fmt.Errorf("Static IP allocation must be used when creating Standard SKU public IP addresses.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func TestAccAzureRMPublicIpStatic_basic_withDNSLabel(t *testing.T) {
})
}

func TestAccAzureRMPublicIpStatic_standard_withIPv6_fails(t *testing.T) {
fabianofranz marked this conversation as resolved.
Show resolved Hide resolved
func TestAccAzureRMPublicIpStatic_standard_withIPv6(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_public_ip", "test")

resource.ParallelTest(t, resource.TestCase{
Expand All @@ -121,9 +121,13 @@ func TestAccAzureRMPublicIpStatic_standard_withIPv6_fails(t *testing.T) {
CheckDestroy: testCheckAzureRMPublicIpDestroy,
Steps: []resource.TestStep{
{
Config: testAccAzureRMPublicIPStatic_standard_withIPVersion(data, "IPv6"),
ExpectError: regexp.MustCompile("Cannot specify publicIpAllocationMethod as Static for IPv6 PublicIp"),
Config: testAccAzureRMPublicIPStatic_standard_withIPVersion(data, "IPv6"),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMPublicIpExists(data.ResourceName),
resource.TestCheckResourceAttr(data.ResourceName, "ip_version", "IPv6"),
),
},
data.ImportStep(),
},
})
}
Expand Down Expand Up @@ -168,6 +172,7 @@ func TestAccAzureRMPublicIpStatic_basic_defaultsToIPv4(t *testing.T) {
},
})
}

func TestAccAzureRMPublicIpStatic_basic_withIPv4(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_public_ip", "test")
ipVersion := "IPv4"
Expand Down