From 40b157c742aff93a0e5041972d6f2a5cee296752 Mon Sep 17 00:00:00 2001 From: "sylvain.boily" Date: Thu, 24 May 2018 06:47:04 -0400 Subject: [PATCH] fixing dns_settings read attribute and removing last trace of vm_ properties --- azurerm/resource_arm_virtual_machine_scale_set.go | 13 +++++++++++++ .../resource_arm_virtual_machine_scale_set_test.go | 3 --- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/azurerm/resource_arm_virtual_machine_scale_set.go b/azurerm/resource_arm_virtual_machine_scale_set.go index e07cd83bd2c1f..872200d932da3 100644 --- a/azurerm/resource_arm_virtual_machine_scale_set.go +++ b/azurerm/resource_arm_virtual_machine_scale_set.go @@ -1049,6 +1049,19 @@ func flattenAzureRmVirtualMachineScaleSetNetworkProfile(profile *compute.Virtual s["network_security_group_id"] = *v.ID } + if netConfig.VirtualMachineScaleSetNetworkConfigurationProperties.DNSSettings != nil { + dnsSettings := make(map[string]interface{}) + dnsServers := make([]interface{}, 0) + if netConfig.VirtualMachineScaleSetNetworkConfigurationProperties.DNSSettings.DNSServers != nil { + for _, dnsServer := range *netConfig.VirtualMachineScaleSetNetworkConfigurationProperties.DNSSettings.DNSServers { + dnsServers = append(dnsServers, dnsServer) + } + dnsSettings["dns_servers"] = dnsServers + } + + s["dns_settings"] = dnsSettings + } + if netConfig.VirtualMachineScaleSetNetworkConfigurationProperties.IPConfigurations != nil { ipConfigs := make([]map[string]interface{}, 0, len(*netConfig.VirtualMachineScaleSetNetworkConfigurationProperties.IPConfigurations)) for _, ipConfig := range *netConfig.VirtualMachineScaleSetNetworkConfigurationProperties.IPConfigurations { diff --git a/azurerm/resource_arm_virtual_machine_scale_set_test.go b/azurerm/resource_arm_virtual_machine_scale_set_test.go index 9d7df8d266800..34ac72c71cbb2 100644 --- a/azurerm/resource_arm_virtual_machine_scale_set_test.go +++ b/azurerm/resource_arm_virtual_machine_scale_set_test.go @@ -25,9 +25,6 @@ func TestAccAzureRMVirtualMachineScaleSet_basic(t *testing.T) { Config: config, Check: resource.ComposeTestCheckFunc( testCheckAzureRMVirtualMachineScaleSetExists(resourceName), - resource.TestCheckResourceAttrSet(resourceName, "vm_hostnames"), - resource.TestCheckResourceAttrSet(resourceName, "vm_statuses"), - resource.TestCheckResourceAttrSet(resourceName, "vm_primary_private_ip_addresses"), // testing default scaleset values testCheckAzureRMVirtualMachineScaleSetSinglePlacementGroup(resourceName, true), resource.TestCheckResourceAttr(resourceName, "ip_forwarding", "false"),