Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade network SDK to 2018-08-01 #2433

Merged
merged 10 commits into from
Dec 18, 2018
2 changes: 1 addition & 1 deletion azurerm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,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/hashicorp/terraform/helper/validation"
"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/hashicorp/terraform/helper/validation"
"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/hashicorp/terraform/helper/validation"
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/utils"
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
34 changes: 27 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/hashicorp/terraform/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
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 @@ -247,7 +257,16 @@ 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)

exist := false
metacpp marked this conversation as resolved.
Show resolved Hide resolved
pubID, exist := data["internal_public_ip_address_id"].(string)
if !exist {
pubID, exist = data["public_ip_address_id"].(string)
}

if !exist {
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 @@ -271,8 +290,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 @@ -311,6 +330,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/utils"
)

Expand Down Expand Up @@ -93,7 +92,7 @@ func resourceArmFirewallNetworkRuleCollection() *schema.Resource {
Type: schema.TypeString,
ValidateFunc: validation.StringInSlice([]string{
string(network.Any),
string(network.ICMP),
metacpp marked this conversation as resolved.
Show resolved Hide resolved
"ICMP", // TODO(metacpp): update it after v22.0.
string(network.TCP),
string(network.UDP),
}, false),
Expand Down Expand Up @@ -133,12 +132,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,7 +4,7 @@ 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"
Expand Down