Skip to content

Commit

Permalink
Fix the fmt issue and the nil continue issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
metacpp committed Apr 25, 2019
1 parent b5f0b78 commit 06235af
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 27 deletions.
6 changes: 3 additions & 3 deletions azurerm/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,14 +323,14 @@ func Provider() terraform.ResourceProvider {
"azurerm_mysql_firewall_rule": resourceArmMySqlFirewallRule(),
"azurerm_mysql_server": resourceArmMySqlServer(),
"azurerm_mysql_virtual_network_rule": resourceArmMySqlVirtualNetworkRule(),
"azurerm_network_interface": resourceArmNetworkInterface(),
"azurerm_network_interface_application_gateway_backend_address_pool_association": resourceArmNetworkInterfaceApplicationGatewayBackendAddressPoolAssociation(),
"azurerm_network_interface": resourceArmNetworkInterface(),
"azurerm_network_interface_application_gateway_backend_address_pool_association": resourceArmNetworkInterfaceApplicationGatewayBackendAddressPoolAssociation(),
"azurerm_network_interface_application_security_group_association": resourceArmNetworkInterfaceApplicationSecurityGroupAssociation(),
"azurerm_network_interface_backend_address_pool_association": resourceArmNetworkInterfaceBackendAddressPoolAssociation(),
"azurerm_network_interface_nat_rule_association": resourceArmNetworkInterfaceNatRuleAssociation(),
"azurerm_network_connection_monitor": resourceArmNetworkConnectionMonitor(),
"azurerm_network_ddos_protection_plan": resourceArmNetworkDDoSProtectionPlan(),
"azurerm_network_packet_capture": resourceArmNetworkPacketCapture(),
"azurerm_network_packet_capture": resourceArmNetworkPacketCapture(),
"azurerm_network_profile": resourceArmNetworkProfile(),
"azurerm_network_security_group": resourceArmNetworkSecurityGroup(),
"azurerm_network_security_rule": resourceArmNetworkSecurityRule(),
Expand Down
38 changes: 14 additions & 24 deletions azurerm/resource_arm_network_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package azurerm

import (
"fmt"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate"
"log"

"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-08-01/network"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-12-01/network"
"github.com/hashicorp/terraform/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

Expand Down Expand Up @@ -323,40 +323,30 @@ func flattenArmContainerNetworkInterfaceConfigurations(input *[]network.Containe
// if-continue is used to simplify the deeply nested if-else statement.
for _, cniConfig := range *input {
retCNIConfig := make(map[string]interface{})
cniProps := cniConfig.ContainerNetworkInterfaceConfigurationPropertiesFormat
if cniProps == nil {
continue
}

if cniConfig.Name != nil {
retCNIConfig["name"] = *cniConfig.Name
}

if cniProps.IPConfigurations == nil {
continue
}
if cniProps := cniConfig.ContainerNetworkInterfaceConfigurationPropertiesFormat; cniProps != nil && cniProps.IPConfigurations != nil {
retIPConfigs := make([]interface{}, 0)
for _, ipConfig := range *cniProps.IPConfigurations {
retIPConfig := make(map[string]interface{})

retIPConfigs := make([]interface{}, 0)
for _, ipConfig := range *cniProps.IPConfigurations {
retIPConfig := make(map[string]interface{})
ipProps := ipConfig.IPConfigurationProfilePropertiesFormat
if ipProps == nil {
continue
}
if ipConfig.Name != nil {
retIPConfig["name"] = *ipConfig.Name
}

if ipConfig.Name != nil {
retIPConfig["name"] = *ipConfig.Name
}
if ipProps := ipConfig.IPConfigurationProfilePropertiesFormat; ipProps != nil && ipProps.Subnet != nil && ipProps.Subnet.ID != nil {
retIPConfig["subnet_id"] = *ipProps.Subnet.ID
}

if ipProps.Subnet != nil && ipProps.Subnet.ID != nil {
retIPConfig["subnet_id"] = *ipProps.Subnet.ID
retIPConfigs = append(retIPConfigs, retIPConfig)
}

retIPConfigs = append(retIPConfigs, retIPConfig)
retCNIConfig["ip_configuration"] = retIPConfigs
}

retCNIConfig["ip_configuration"] = retIPConfigs

retCNIConfigs = append(retCNIConfigs, retCNIConfig)
}

Expand Down

0 comments on commit 06235af

Please sign in to comment.