From c1760da383449259e6787ac9cda7b739d886c705 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Thu, 22 Jun 2017 08:22:15 +0100 Subject: [PATCH 1/4] Fixing the NIC Bug test --- ...esource_arm_network_interface_card_test.go | 40 +++++++++---------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/azurerm/resource_arm_network_interface_card_test.go b/azurerm/resource_arm_network_interface_card_test.go index d7a39c6f0cf1..5ff440f185ca 100644 --- a/azurerm/resource_arm_network_interface_card_test.go +++ b/azurerm/resource_arm_network_interface_card_test.go @@ -126,7 +126,7 @@ func TestAccAzureRMNetworkInterface_bug7986(t *testing.T) { { Config: testAccAzureRMNetworkInterface_bug7986(rInt), Check: resource.ComposeTestCheckFunc( - testCheckAzureRMNetworkInterfaceExists("azurerm_network_interface.test"), + testCheckAzureRMNetworkInterfaceExists("azurerm_network_interface.test1"), ), }, }, @@ -505,26 +505,28 @@ resource "azurerm_network_security_group" "test" { location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" - security_rule { - name = "test123" - priority = 100 - direction = "Inbound" - access = "Allow" - protocol = "Tcp" - source_port_range = "*" - destination_port_range = "*" - source_address_prefix = "*" - destination_address_prefix = "*" - } - tags { environment = "Production" } } -resource "azurerm_network_security_rule" "test" { - name = "test" - priority = 100 +resource "azurerm_network_security_rule" "test1" { + name = "test1" + priority = 101 + direction = "Outbound" + access = "Allow" + protocol = "Tcp" + source_port_range = "*" + destination_port_range = "*" + source_address_prefix = "*" + destination_address_prefix = "*" + resource_group_name = "${azurerm_resource_group.test.name}" + network_security_group_name = "${azurerm_network_security_group.test.name}" +} + +resource "azurerm_network_security_rule" "test2" { + name = "test2" + priority = 102 direction = "Outbound" access = "Allow" protocol = "Tcp" @@ -552,12 +554,6 @@ resource "azurerm_virtual_network" "test" { address_space = ["10.0.0.0/16"] resource_group_name = "${azurerm_resource_group.test.name}" location = "${azurerm_resource_group.test.location}" - - subnet { - name = "second" - address_prefix = "10.0.3.0/24" - security_group = "${azurerm_network_security_group.test.id}" - } } resource "azurerm_subnet" "test" { From 82d7bef5ce0c1ef8641de583dd65054aee8198b6 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Thu, 22 Jun 2017 08:53:10 +0100 Subject: [PATCH 2/4] Fixing the broken subnet test --- azurerm/resource_arm_subnet_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azurerm/resource_arm_subnet_test.go b/azurerm/resource_arm_subnet_test.go index 08d8582e33d0..72d2ed135c4b 100644 --- a/azurerm/resource_arm_subnet_test.go +++ b/azurerm/resource_arm_subnet_test.go @@ -72,7 +72,7 @@ func TestAccAzureRMSubnet_bug7986(t *testing.T) { { Config: initConfig, Check: resource.ComposeTestCheckFunc( - testCheckAzureRMSubnetExists("azurerm_subnet.test"), + testCheckAzureRMSubnetExists("azurerm_subnet.first"), ), }, }, @@ -445,7 +445,7 @@ resource "azurerm_subnet" "first" { } resource "azurerm_route_table" "second" { - name = "$acctest%d-private-2" + name = "acctest%d-private-2" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" } @@ -459,7 +459,7 @@ resource "azurerm_route" "second" { } resource "azurerm_subnet" "second" { - name = "acctest%d-private-1" + name = "acctest%d-private-2" resource_group_name = "${azurerm_resource_group.test.name}" virtual_network_name = "${azurerm_virtual_network.test.name}" address_prefix = "10.0.1.0/24" From 6c689cd9efd7b4efb9f6b4f59b732458031f35f7 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Thu, 22 Jun 2017 09:27:37 +0100 Subject: [PATCH 3/4] Fixing the location field to be stored formatted --- azurerm/resource_arm_network_interface_card.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azurerm/resource_arm_network_interface_card.go b/azurerm/resource_arm_network_interface_card.go index fb0df49b8099..19c6dad5ab15 100644 --- a/azurerm/resource_arm_network_interface_card.go +++ b/azurerm/resource_arm_network_interface_card.go @@ -324,12 +324,12 @@ func resourceArmNetworkInterfaceRead(d *schema.ResourceData, meta interface{}) e d.Set("network_security_group_id", resp.NetworkSecurityGroup.ID) } + d.Set("name", resp.Name) + d.Set("resource_group_name", resGroup) + d.Set("location", azureRMNormalizeLocation(*resp.Location)) d.Set("applied_dns_servers", appliedDNSServers) d.Set("dns_servers", dnsServers) d.Set("enable_ip_forwarding", resp.EnableIPForwarding) - d.Set("location", resp.Location) - d.Set("name", resp.Name) - d.Set("resource_group_name", resGroup) flattenAndSetTags(d, resp.Tags) From 0f43a51a1486645dd355fbfb896326ad5ff58612 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Thu, 22 Jun 2017 15:14:58 +0100 Subject: [PATCH 4/4] Checking for the second item --- azurerm/resource_arm_network_interface_card_test.go | 1 + azurerm/resource_arm_subnet_test.go | 1 + 2 files changed, 2 insertions(+) diff --git a/azurerm/resource_arm_network_interface_card_test.go b/azurerm/resource_arm_network_interface_card_test.go index 5ff440f185ca..99af7f1ee54c 100644 --- a/azurerm/resource_arm_network_interface_card_test.go +++ b/azurerm/resource_arm_network_interface_card_test.go @@ -127,6 +127,7 @@ func TestAccAzureRMNetworkInterface_bug7986(t *testing.T) { Config: testAccAzureRMNetworkInterface_bug7986(rInt), Check: resource.ComposeTestCheckFunc( testCheckAzureRMNetworkInterfaceExists("azurerm_network_interface.test1"), + testCheckAzureRMNetworkInterfaceExists("azurerm_network_interface.test2"), ), }, }, diff --git a/azurerm/resource_arm_subnet_test.go b/azurerm/resource_arm_subnet_test.go index 72d2ed135c4b..3100f8a8e2cb 100644 --- a/azurerm/resource_arm_subnet_test.go +++ b/azurerm/resource_arm_subnet_test.go @@ -73,6 +73,7 @@ func TestAccAzureRMSubnet_bug7986(t *testing.T) { Config: initConfig, Check: resource.ComposeTestCheckFunc( testCheckAzureRMSubnetExists("azurerm_subnet.first"), + testCheckAzureRMSubnetExists("azurerm_subnet.second"), ), }, },