Skip to content

Commit

Permalink
Merge pull request #2433 from terraform-providers/nw_upgrade
Browse files Browse the repository at this point in the history
Upgrade `network` SDK to `2018-08-01`
  • Loading branch information
katbyte committed Dec 18, 2018
2 parents b09510a + 8badf01 commit c42061c
Show file tree
Hide file tree
Showing 123 changed files with 14,330 additions and 4,042 deletions.
2 changes: 1 addition & 1 deletion azurerm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
"github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2018-02-14/keyvault"
"github.com/Azure/azure-sdk-for-go/services/logic/mgmt/2016-06-01/logic"
"github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-08-01/network"
"github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs"
"github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql"
"github.com/Azure/azure-sdk-for-go/services/preview/apimanagement/mgmt/2018-06-01-preview/apimanagement"
Expand Down
2 changes: 1 addition & 1 deletion azurerm/data_source_public_ips.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-08-01/network"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
)
Expand Down
2 changes: 1 addition & 1 deletion azurerm/data_source_route_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package azurerm
import (
"fmt"

"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-08-01/network"
"github.com/hashicorp/terraform/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
Expand Down
2 changes: 1 addition & 1 deletion azurerm/data_source_virtual_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package azurerm
import (
"fmt"

"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-08-01/network"
"github.com/hashicorp/terraform/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
Expand Down
2 changes: 1 addition & 1 deletion azurerm/data_source_virtual_network_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"bytes"

"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-08-01/network"
"github.com/hashicorp/terraform/helper/hashcode"
"github.com/hashicorp/terraform/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate"
Expand Down
2 changes: 1 addition & 1 deletion azurerm/express_route_circuit.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package azurerm
import (
"fmt"

"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-08-01/network"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

Expand Down
42 changes: 0 additions & 42 deletions azurerm/helpers/azure/firewall.go

This file was deleted.

2 changes: 1 addition & 1 deletion azurerm/helpers/azure/network_interface.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package azure

import "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network"
import "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-08-01/network"

func FindNetworkInterfaceIPConfiguration(input *[]network.InterfaceIPConfiguration, name string) *network.InterfaceIPConfiguration {
if input == nil {
Expand Down
2 changes: 1 addition & 1 deletion azurerm/loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"regexp"
"strings"

"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-08-01/network"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/helper/schema"
)
Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_application_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"log"

"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-08-01/network"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_application_security_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"log"

"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-08-01/network"
"github.com/hashicorp/terraform/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf"
Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_express_route_circuit.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"log"

"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-08-01/network"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package azurerm
import (
"fmt"

"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-08-01/network"
"github.com/hashicorp/terraform/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_express_route_circuit_peering.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"strings"

"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-08-01/network"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/response"
Expand Down
2 changes: 1 addition & 1 deletion azurerm/resource_arm_express_route_circuit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"net/http"
"testing"

"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-08-01/network"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
Expand Down
33 changes: 26 additions & 7 deletions azurerm/resource_arm_firewall.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"regexp"

"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-08-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/validate"
Expand Down Expand Up @@ -53,9 +53,19 @@ func resourceArmFirewall() *schema.Resource {
ValidateFunc: azure.ValidateResourceID,
},
"internal_public_ip_address_id": {
Type: schema.TypeString,
Required: true,
ValidateFunc: azure.ValidateResourceID,
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: azure.ValidateResourceID,
Deprecated: "This field has been deprecated. Use `public_ip_address_id` instead.",
ConflictsWith: []string{"ip_configuration.0.public_ip_address_id"},
},
"public_ip_address_id": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: azure.ValidateResourceID,
ConflictsWith: []string{"ip_configuration.0.internal_public_ip_address_id"},
},
"private_ip_address": {
Type: schema.TypeString,
Expand Down Expand Up @@ -245,7 +255,15 @@ func expandArmFirewallIPConfigurations(d *schema.ResourceData) (*[]network.Azure
data := configRaw.(map[string]interface{})
name := data["name"].(string)
subnetId := data["subnet_id"].(string)
intPubID := data["internal_public_ip_address_id"].(string)

pubID, exist := data["internal_public_ip_address_id"].(string)
if !exist || pubID == "" {
pubID, exist = data["public_ip_address_id"].(string)
}

if !exist || pubID == "" {
return nil, nil, nil, fmt.Errorf("one of `ip_configuration.0.internal_public_ip_address_id` or `ip_configuration.0.public_ip_address_id` must be set")
}

subnetID, err := parseAzureResourceID(subnetId)
if err != nil {
Expand All @@ -269,8 +287,8 @@ func expandArmFirewallIPConfigurations(d *schema.ResourceData) (*[]network.Azure
Subnet: &network.SubResource{
ID: utils.String(subnetId),
},
InternalPublicIPAddress: &network.SubResource{
ID: utils.String(intPubID),
PublicIPAddress: &network.SubResource{
ID: utils.String(pubID),
},
},
}
Expand Down Expand Up @@ -309,6 +327,7 @@ func flattenArmFirewallIPConfigurations(input *[]network.AzureFirewallIPConfigur
if pip := props.PublicIPAddress; pip != nil {
if id := pip.ID; id != nil {
afIPConfig["internal_public_ip_address_id"] = *id
afIPConfig["public_ip_address_id"] = *id
}
}
result = append(result, afIPConfig)
Expand Down
17 changes: 2 additions & 15 deletions azurerm/resource_arm_firewall_network_rule_collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import (
"fmt"
"log"

"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-08-01/network"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)
Expand Down Expand Up @@ -94,7 +93,7 @@ func resourceArmFirewallNetworkRuleCollection() *schema.Resource {
Type: schema.TypeString,
ValidateFunc: validation.StringInSlice([]string{
string(network.Any),
string(network.ICMP),
"ICMP", // TODO(metacpp): update it after v22.0.
string(network.TCP),
string(network.UDP),
}, false),
Expand Down Expand Up @@ -134,12 +133,6 @@ func resourceArmFirewallNetworkRuleCollectionCreateUpdate(d *schema.ResourceData
}
ruleCollections := *props.NetworkRuleCollections

ipConfigurations, err := azure.FirewallFixIPConfiguration(props.IPConfigurations)
if err != nil {
return fmt.Errorf("Error fixing IP Configurations for Firewall %q (Resource Group %q): %+v", firewallName, resourceGroup, err)
}
firewall.AzureFirewallPropertiesFormat.IPConfigurations = ipConfigurations

networkRules := expandArmFirewallNetworkRules(d.Get("rule").(*schema.Set))
priority := d.Get("priority").(int)
newRuleCollection := network.AzureFirewallNetworkRuleCollection{
Expand Down Expand Up @@ -333,12 +326,6 @@ func resourceArmFirewallNetworkRuleCollectionDelete(d *schema.ResourceData, meta
}
props.NetworkRuleCollections = &networkRules

ipConfigs, err := azure.FirewallFixIPConfiguration(props.IPConfigurations)
if err != nil {
return fmt.Errorf("Error fixing IP Configuration for Firewall %q (Resource Group %q): %+v", firewallName, resourceGroup, err)
}
props.IPConfigurations = ipConfigs

future, err := client.CreateOrUpdate(ctx, resourceGroup, firewallName, firewall)
if err != nil {
return fmt.Errorf("Error deleting Network Rule Collection %q from Firewall %q (Resource Group %q): %+v", name, firewallName, resourceGroup, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import (
"fmt"
"testing"

"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-04-01/network"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-08-01/network"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
)

func TestAccAzureRMFirewallNetworkRuleCollection_basic(t *testing.T) {
Expand Down Expand Up @@ -332,12 +331,6 @@ func testCheckAzureRMFirewallNetworkRuleCollectionDisappears(resourceName string
}

read.AzureFirewallPropertiesFormat.NetworkRuleCollections = &rules
ipConfigs, err := azure.FirewallFixIPConfiguration(read.AzureFirewallPropertiesFormat.IPConfigurations)
if err != nil {
return fmt.Errorf("Error fixing IP Configuration for Firewall: err")
}

read.AzureFirewallPropertiesFormat.IPConfigurations = ipConfigs

future, err := client.CreateOrUpdate(ctx, resourceGroup, firewallName, read)
if err != nil {
Expand Down

0 comments on commit c42061c

Please sign in to comment.