From b56ded8a5b557935306e0f008bb6be27fd2b6952 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Mon, 12 Nov 2018 16:17:34 +0000 Subject: [PATCH] Public IP: ensuring the casing matches --- azurerm/resource_arm_public_ip.go | 6 ++--- azurerm/resource_arm_public_ip_test.go | 37 ++++++++++++-------------- 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/azurerm/resource_arm_public_ip.go b/azurerm/resource_arm_public_ip.go index f738ec5847f8..1ac644e1cd2b 100644 --- a/azurerm/resource_arm_public_ip.go +++ b/azurerm/resource_arm_public_ip.go @@ -230,15 +230,13 @@ func resourceArmPublicIpRead(d *schema.ResourceData, meta interface{}) error { d.Set("location", azureRMNormalizeLocation(*location)) } - d.Set("public_ip_address_allocation", strings.ToLower(string(resp.PublicIPAddressPropertiesFormat.PublicIPAllocationMethod))) - if sku := resp.Sku; sku != nil { d.Set("sku", string(sku.Name)) } if props := resp.PublicIPAddressPropertiesFormat; props != nil { - d.Set("public_ip_address_allocation", strings.ToLower(string(props.PublicIPAllocationMethod))) - d.Set("ip_version", strings.ToLower(string(props.PublicIPAddressVersion))) + d.Set("public_ip_address_allocation", string(props.PublicIPAllocationMethod)) + d.Set("ip_version", string(props.PublicIPAddressVersion)) if settings := props.DNSSettings; settings != nil { d.Set("fqdn", settings.Fqdn) diff --git a/azurerm/resource_arm_public_ip_test.go b/azurerm/resource_arm_public_ip_test.go index 93fb63cc1b8a..1d73519e8ed0 100644 --- a/azurerm/resource_arm_public_ip_test.go +++ b/azurerm/resource_arm_public_ip_test.go @@ -27,7 +27,8 @@ func TestAccAzureRMPublicIpStatic_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testCheckAzureRMPublicIpExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "ip_address"), - resource.TestCheckResourceAttr(resourceName, "public_ip_address_allocation", "static"), + resource.TestCheckResourceAttr(resourceName, "public_ip_address_allocation", "Static"), + resource.TestCheckResourceAttr(resourceName, "ip_version", "IPv4"), ), }, { @@ -53,7 +54,7 @@ func TestAccAzureRMPublicIpStatic_zones(t *testing.T) { Check: resource.ComposeTestCheckFunc( testCheckAzureRMPublicIpExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "ip_address"), - resource.TestCheckResourceAttr(resourceName, "public_ip_address_allocation", "static"), + resource.TestCheckResourceAttr(resourceName, "public_ip_address_allocation", "Static"), resource.TestCheckResourceAttr(resourceName, "zones.#", "1"), resource.TestCheckResourceAttr(resourceName, "zones.0", "1"), ), @@ -83,7 +84,7 @@ func TestAccAzureRMPublicIpStatic_basic_withDNSLabel(t *testing.T) { Check: resource.ComposeTestCheckFunc( testCheckAzureRMPublicIpExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "ip_address"), - resource.TestCheckResourceAttr(resourceName, "public_ip_address_allocation", "static"), + resource.TestCheckResourceAttr(resourceName, "public_ip_address_allocation", "Static"), resource.TestCheckResourceAttr(resourceName, "domain_name_label", dnl), ), }, @@ -128,7 +129,7 @@ func TestAccAzureRMPublicIpDynamic_basic_withIPv6(t *testing.T) { Config: config, Check: resource.ComposeTestCheckFunc( testCheckAzureRMPublicIpExists(resourceName), - resource.TestCheckResourceAttr(resourceName, "ip_version", "ipv6"), //api returns all lowercase + resource.TestCheckResourceAttr(resourceName, "ip_version", "IPv6"), ), }, { @@ -155,7 +156,7 @@ func TestAccAzureRMPublicIpStatic_basic_defaultsToIPv4(t *testing.T) { Config: config, Check: resource.ComposeTestCheckFunc( testCheckAzureRMPublicIpExists(resourceName), - resource.TestCheckResourceAttr(resourceName, "ip_version", "ipv4"), + resource.TestCheckResourceAttr(resourceName, "ip_version", "IPv4"), ), }, { @@ -181,7 +182,7 @@ func TestAccAzureRMPublicIpStatic_basic_withIPv4(t *testing.T) { Config: config, Check: resource.ComposeTestCheckFunc( testCheckAzureRMPublicIpExists(resourceName), - resource.TestCheckResourceAttr(resourceName, "ip_version", "ipv4"), + resource.TestCheckResourceAttr(resourceName, "ip_version", "IPv4"), ), }, { @@ -502,11 +503,10 @@ resource "azurerm_resource_group" "test" { } resource "azurerm_public_ip" "test" { - name = "acctestpublicip-%d" - location = "${azurerm_resource_group.test.location}" - resource_group_name = "${azurerm_resource_group.test.name}" - - public_ip_address_allocation = "static" + name = "acctestpublicip-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + public_ip_address_allocation = "Static" } `, rInt, location, rInt) } @@ -522,9 +522,8 @@ resource "azurerm_public_ip" "test" { name = "acctestpublicip-%d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" - public_ip_address_allocation = "static" - - zones = ["1"] + public_ip_address_allocation = "Static" + zones = ["1"] } `, rInt, location, rInt) } @@ -540,9 +539,8 @@ resource "azurerm_public_ip" "test" { name = "acctestpublicip-%d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" - public_ip_address_allocation = "static" - - domain_name_label = "%s" + public_ip_address_allocation = "Static" + domain_name_label = "%s" } `, rInt, location, rInt, dnsNameLabel) } @@ -558,9 +556,8 @@ resource "azurerm_public_ip" "test" { name = "acctestpublicip-%d" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" - public_ip_address_allocation = "static" - - ip_version = "%s" + public_ip_address_allocation = "Static" + ip_version = "%s" } `, rInt, location, rInt, ipVersion) }