From b7c2dbe79e174f126c184619e9324a2c42b5ca87 Mon Sep 17 00:00:00 2001 From: Romit Girdhar Date: Tue, 2 Apr 2019 21:53:17 -0700 Subject: [PATCH 1/7] Added Data source for Express route Circuit --- azurerm/data_source_express_route_circuit.go | 204 ++++++++++++++++++ .../data_source_express_route_circuit_test.go | 53 +++++ 2 files changed, 257 insertions(+) create mode 100644 azurerm/data_source_express_route_circuit.go create mode 100644 azurerm/data_source_express_route_circuit_test.go diff --git a/azurerm/data_source_express_route_circuit.go b/azurerm/data_source_express_route_circuit.go new file mode 100644 index 000000000000..e8f20aa8d497 --- /dev/null +++ b/azurerm/data_source_express_route_circuit.go @@ -0,0 +1,204 @@ +package azurerm + +import ( + "fmt" + + "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" +) + +func dataSourceArmExpressRouteCircuit() *schema.Resource { + return &schema.Resource{ + Read: dataSourceArmExpressRouteCircuitRead, + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validate.NoEmptyStrings, + }, + + "resource_group_name": resourceGroupNameForDataSourceSchema(), + + "peerings": { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "peering_type": { + Type: schema.TypeString, + Computed: true, + }, + "azure_asn": { + Type: schema.TypeInt, + Computed: true, + }, + "peer_asn": { + Type: schema.TypeInt, + Computed: true, + }, + "vlan_id": { + Type: schema.TypeInt, + Computed: true, //Ram: express route API does not expose primary and secondary subnet?? + }, + "shared_key": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + + "service_key": { + Type: schema.TypeString, + Computed: true, + }, + + "service_provider_properties": { + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "service_provider_name": { + Type: schema.TypeString, + Computed: true, + }, + "peering_location": { + Type: schema.TypeString, + Computed: true, + }, + "bandwidth_in_mbps": { + Type: schema.TypeInt, + Computed: true, + }, + }, + }, + }, + + "service_provider_provisioning_state": { + Type: schema.TypeString, + Computed: true, + }, + + "sku": { + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "tier": { + Type: schema.TypeString, + Computed: true, + }, + + "family": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, + }, + } +} + +func dataSourceArmExpressRouteCircuitRead(d *schema.ResourceData, meta interface{}) error { + ctx := meta.(*ArmClient).StopContext + client := meta.(*ArmClient).expressRouteCircuitClient + + name := d.Get("name").(string) + resourceGroup := d.Get("resource_group_name").(string) + + resp, err := client.Get(ctx, resourceGroup, name) + if err != nil { + if utils.ResponseWasNotFound(resp.Response) { + return fmt.Errorf("Error: Express Route Circuit %q (Resource Group %q) was not found", name, resourceGroup) + } + return fmt.Errorf("Error making Read request on the Express Route Circuit %q (Resource Group %q): %+v", name, resourceGroup, err) + } + + d.SetId(*resp.ID) + + if properties := resp.ExpressRouteCircuitPropertiesFormat; properties != nil { + peerings := flattenExpressRouteCircuitPeerings(properties.Peerings) + if err := d.Set("peerings", peerings); err != nil { + return err + } + + d.Set("service_key", properties.ServiceKey) + d.Set("service_provider_provisioning_state", properties.ServiceProviderProvisioningState) + + if serviceProviderProperties := flattenExpressRouteCircuitServiceProviderProperties(properties.ServiceProviderProperties); serviceProviderProperties != nil { + if err := d.Set("service_provider_properties", serviceProviderProperties); err != nil { + return fmt.Errorf("Error setting `service_provider_properties`: %+v", err) + } + } + + } + + if resp.Sku != nil { + sku := flattenExpressRouteCircuitSku(resp.Sku) + if err := d.Set("sku", sku); err != nil { + return fmt.Errorf("Error setting `sku`: %+v", err) + } + } + + return nil +} + +func flattenExpressRouteCircuitPeerings(input *[]network.ExpressRouteCircuitPeering) []interface{} { + peerings := make([]interface{}, 0) + + if input != nil { + for _, peering := range *input { + props := peering.ExpressRouteCircuitPeeringPropertiesFormat + p := make(map[string]interface{}) + + p["peering_type"] = string(props.PeeringType) + + if azureAsn := props.AzureASN; azureAsn != nil { + p["azure_asn"] = *azureAsn + } + + if peerAsn := props.PeerASN; peerAsn != nil { + p["peer_asn"] = *peerAsn + } + + if vlanID := props.VlanID; vlanID != nil { + p["vlan_id"] = *vlanID + } + + if sharedKey := props.SharedKey; sharedKey != nil { + p["shared_key"] = *sharedKey + } + + peerings = append(peerings, p) + } + } + + return peerings +} + +func flattenExpressRouteCircuitServiceProviderProperties(input *network.ExpressRouteCircuitServiceProviderProperties) []interface{} { + serviceProviderProperties := make([]interface{}, 0) + + if input != nil { + p := make(map[string]interface{}) + + if serviceProviderName := input.ServiceProviderName; serviceProviderName != nil { + p["service_provider_name"] = *serviceProviderName + } + + if peeringLocation := input.PeeringLocation; peeringLocation != nil { + p["peering_location"] = *peeringLocation + } + + if bandwidthInMbps := input.BandwidthInMbps; bandwidthInMbps != nil { + p["bandwidth_in_mbps"] = *bandwidthInMbps + } + + serviceProviderProperties = append(serviceProviderProperties, p) + } + + return serviceProviderProperties +} diff --git a/azurerm/data_source_express_route_circuit_test.go b/azurerm/data_source_express_route_circuit_test.go new file mode 100644 index 000000000000..56f903ded284 --- /dev/null +++ b/azurerm/data_source_express_route_circuit_test.go @@ -0,0 +1,53 @@ +package azurerm + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform/helper/resource" + "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" +) + +func TestAccDataSourceAzureRMExpressRoute_basic(t *testing.T) { + dataSourceName := "data.azurerm_express_route_circuit.test" + ri := tf.AccRandTimeInt() + location := testLocation() + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMExpressRouteCircuitDestroy, + Steps: []resource.TestStep{ + { + Config: testAccDataSourceAzureRMExpressRoute_basic(ri, location), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr(dataSourceName, "service_provider_properties.0.service_provider_name", "Equinix Test"), + resource.TestCheckResourceAttr(dataSourceName, "service_provider_properties.0.peering_location", "Silicon Valley Test"), + resource.TestCheckResourceAttr(dataSourceName, "service_provider_properties.0.bandwidth_in_mbps", "50"), + resource.TestCheckResourceAttr(dataSourceName, "sku.0.tier", "Standard"), + resource.TestCheckResourceAttr(dataSourceName, "sku.0.family", "MeteredData"), + resource.TestCheckResourceAttr(dataSourceName, "service_provider_provisioning_state", "NotProvisioned"), + ), + }, + }, + }) +} + +/*func TestAccDataSourceAzureRMExpressRoute_complete(t *testing.T) { + dataSourceName := "data.azurerm_express_route_circuit.test" + ri := tf.AccRandTimeInt() + +}*/ + +func testAccDataSourceAzureRMExpressRoute_basic(rInt int, location string) string { + config := testAccAzureRMExpressRouteCircuit_basicMeteredConfig(rInt, location) + + return fmt.Sprintf(` + %s + + data "azurerm_express_route_circuit" test { + resource_group_name = "${azurerm_resource_group.test.name}" + name = "${azurerm_express_route_circuit.test.name}" + } + `, config) +} From 7153e5f1eec06bfd808266a05524656601f7a7d2 Mon Sep 17 00:00:00 2001 From: Romit Girdhar Date: Tue, 2 Apr 2019 22:06:59 -0700 Subject: [PATCH 2/7] Updating provider.go with the express route circuit data source function --- azurerm/provider.go | 1 + 1 file changed, 1 insertion(+) diff --git a/azurerm/provider.go b/azurerm/provider.go index d2cf7aa3f1d9..a830b06f43be 100644 --- a/azurerm/provider.go +++ b/azurerm/provider.go @@ -121,6 +121,7 @@ func Provider() terraform.ResourceProvider { "azurerm_dev_test_lab": dataSourceArmDevTestLab(), "azurerm_dns_zone": dataSourceArmDnsZone(), "azurerm_eventhub_namespace": dataSourceEventHubNamespace(), + "azurerm_express_route_circuit": dataSourceArmExpressRouteCircuit(), "azurerm_image": dataSourceArmImage(), "azurerm_key_vault_access_policy": dataSourceArmKeyVaultAccessPolicy(), "azurerm_key_vault_key": dataSourceArmKeyVaultKey(), From 4aa43810990c7392e0fc733b7d84f12a9bbd2dd5 Mon Sep 17 00:00:00 2001 From: Romit Girdhar Date: Tue, 2 Apr 2019 22:33:38 -0700 Subject: [PATCH 3/7] ran go fmt on the data source --- azurerm/data_source_express_route_circuit.go | 2 +- .../data_source_express_route_circuit_test.go | 32 ++++++++++++++++++- azurerm/provider.go | 2 +- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/azurerm/data_source_express_route_circuit.go b/azurerm/data_source_express_route_circuit.go index e8f20aa8d497..77b367bd5266 100644 --- a/azurerm/data_source_express_route_circuit.go +++ b/azurerm/data_source_express_route_circuit.go @@ -40,7 +40,7 @@ func dataSourceArmExpressRouteCircuit() *schema.Resource { }, "vlan_id": { Type: schema.TypeInt, - Computed: true, //Ram: express route API does not expose primary and secondary subnet?? + Computed: true, }, "shared_key": { Type: schema.TypeString, diff --git a/azurerm/data_source_express_route_circuit_test.go b/azurerm/data_source_express_route_circuit_test.go index 56f903ded284..0afb4fc68822 100644 --- a/azurerm/data_source_express_route_circuit_test.go +++ b/azurerm/data_source_express_route_circuit_test.go @@ -40,7 +40,7 @@ func TestAccDataSourceAzureRMExpressRoute_basic(t *testing.T) { }*/ func testAccDataSourceAzureRMExpressRoute_basic(rInt int, location string) string { - config := testAccAzureRMExpressRouteCircuit_basicMeteredConfig(rInt, location) + config := testAccAzureRMExpressRouteCircuit_MeteredBasic(rInt, location) return fmt.Sprintf(` %s @@ -51,3 +51,33 @@ func testAccDataSourceAzureRMExpressRoute_basic(rInt int, location string) strin } `, config) } + +func testAccAzureRMExpressRouteCircuit_MeteredBasic(rInt int, location string) string { + return fmt.Sprintf(` +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_express_route_circuit" "test" { + name = "acctest-erc-%d" + location = "${azurerm_resource_group.test.location}" + resource_group_name = "${azurerm_resource_group.test.name}" + service_provider_name = "Equinix Test" + peering_location = "Silicon Valley Test" + bandwidth_in_mbps = 50 + + sku { + tier = "Standard" + family = "MeteredData" + } + + allow_classic_operations = false + + tags = { + Environment = "production" + Purpose = "AcceptanceTests" + } +} +`, rInt, location, rInt) +} diff --git a/azurerm/provider.go b/azurerm/provider.go index a830b06f43be..f30fb86fefc0 100644 --- a/azurerm/provider.go +++ b/azurerm/provider.go @@ -121,7 +121,7 @@ func Provider() terraform.ResourceProvider { "azurerm_dev_test_lab": dataSourceArmDevTestLab(), "azurerm_dns_zone": dataSourceArmDnsZone(), "azurerm_eventhub_namespace": dataSourceEventHubNamespace(), - "azurerm_express_route_circuit": dataSourceArmExpressRouteCircuit(), + "azurerm_express_route_circuit": dataSourceArmExpressRouteCircuit(), "azurerm_image": dataSourceArmImage(), "azurerm_key_vault_access_policy": dataSourceArmKeyVaultAccessPolicy(), "azurerm_key_vault_key": dataSourceArmKeyVaultKey(), From f7f3f252effdad805270f8919463a624df0ddb70 Mon Sep 17 00:00:00 2001 From: Romit Girdhar Date: Wed, 10 Apr 2019 16:41:35 -0700 Subject: [PATCH 4/7] Updated the ER Data Source based on feedback. Additionally, added in the flag for ExpressRouteGatewayBypass to VNETGatewayConnection Resource --- azurerm/data_source_express_route_circuit.go | 26 ++++++- .../data_source_express_route_circuit_test.go | 40 +--------- ..._arm_virtual_network_gateway_connection.go | 11 +++ website/azurerm.erb | 4 + .../d/express_route_circuit.html.markdown | 73 +++++++++++++++++++ ...l_network_gateway_connection.html.markdown | 2 + 6 files changed, 116 insertions(+), 40 deletions(-) create mode 100644 website/docs/d/express_route_circuit.html.markdown diff --git a/azurerm/data_source_express_route_circuit.go b/azurerm/data_source_express_route_circuit.go index 77b367bd5266..6e7868d74c21 100644 --- a/azurerm/data_source_express_route_circuit.go +++ b/azurerm/data_source_express_route_circuit.go @@ -21,6 +21,8 @@ func dataSourceArmExpressRouteCircuit() *schema.Resource { "resource_group_name": resourceGroupNameForDataSourceSchema(), + "location": locationForDataSourceSchema(), + "peerings": { Type: schema.TypeList, Computed: true, @@ -30,6 +32,14 @@ func dataSourceArmExpressRouteCircuit() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "primary_peer_address_prefix": { + Type: schema.TypeString, + Computed: true, + }, + "secondary_peer_address_prefix": { + Type: schema.TypeString, + Computed: true, + }, "azure_asn": { Type: schema.TypeInt, Computed: true, @@ -56,7 +66,7 @@ func dataSourceArmExpressRouteCircuit() *schema.Resource { }, "service_provider_properties": { - Type: schema.TypeSet, + Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -82,7 +92,7 @@ func dataSourceArmExpressRouteCircuit() *schema.Resource { }, "sku": { - Type: schema.TypeSet, + Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -119,6 +129,10 @@ func dataSourceArmExpressRouteCircuitRead(d *schema.ResourceData, meta interface d.SetId(*resp.ID) + if location := resp.Location; location != nil { + d.Set("location", azureRMNormalizeLocation(*location)) + } + if properties := resp.ExpressRouteCircuitPropertiesFormat; properties != nil { peerings := flattenExpressRouteCircuitPeerings(properties.Peerings) if err := d.Set("peerings", peerings); err != nil { @@ -156,6 +170,14 @@ func flattenExpressRouteCircuitPeerings(input *[]network.ExpressRouteCircuitPeer p["peering_type"] = string(props.PeeringType) + if primaryPeerAddressPrefix := props.PrimaryPeerAddressPrefix; primaryPeerAddressPrefix != nil { + p["primary_peer_address_prefix"] = *primaryPeerAddressPrefix + } + + if secondaryPeerAddressPrefix := props.SecondaryPeerAddressPrefix; secondaryPeerAddressPrefix != nil { + p["secondary_peer_address_prefix"] = *secondaryPeerAddressPrefix + } + if azureAsn := props.AzureASN; azureAsn != nil { p["azure_asn"] = *azureAsn } diff --git a/azurerm/data_source_express_route_circuit_test.go b/azurerm/data_source_express_route_circuit_test.go index 0afb4fc68822..9240afb8c9d3 100644 --- a/azurerm/data_source_express_route_circuit_test.go +++ b/azurerm/data_source_express_route_circuit_test.go @@ -8,7 +8,7 @@ import ( "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" ) -func TestAccDataSourceAzureRMExpressRoute_basic(t *testing.T) { +func testAccDataSourceAzureRMExpressRoute_basicMetered(t *testing.T) { dataSourceName := "data.azurerm_express_route_circuit.test" ri := tf.AccRandTimeInt() location := testLocation() @@ -33,14 +33,8 @@ func TestAccDataSourceAzureRMExpressRoute_basic(t *testing.T) { }) } -/*func TestAccDataSourceAzureRMExpressRoute_complete(t *testing.T) { - dataSourceName := "data.azurerm_express_route_circuit.test" - ri := tf.AccRandTimeInt() - -}*/ - func testAccDataSourceAzureRMExpressRoute_basic(rInt int, location string) string { - config := testAccAzureRMExpressRouteCircuit_MeteredBasic(rInt, location) + config := testAccAzureRMExpressRouteCircuit_basicMeteredConfig(rInt, location) return fmt.Sprintf(` %s @@ -51,33 +45,3 @@ func testAccDataSourceAzureRMExpressRoute_basic(rInt int, location string) strin } `, config) } - -func testAccAzureRMExpressRouteCircuit_MeteredBasic(rInt int, location string) string { - return fmt.Sprintf(` -resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" - location = "%s" -} - -resource "azurerm_express_route_circuit" "test" { - name = "acctest-erc-%d" - location = "${azurerm_resource_group.test.location}" - resource_group_name = "${azurerm_resource_group.test.name}" - service_provider_name = "Equinix Test" - peering_location = "Silicon Valley Test" - bandwidth_in_mbps = 50 - - sku { - tier = "Standard" - family = "MeteredData" - } - - allow_classic_operations = false - - tags = { - Environment = "production" - Purpose = "AcceptanceTests" - } -} -`, rInt, location, rInt) -} diff --git a/azurerm/resource_arm_virtual_network_gateway_connection.go b/azurerm/resource_arm_virtual_network_gateway_connection.go index 33ad6bfb7a3a..e7deb59fc3f2 100644 --- a/azurerm/resource_arm_virtual_network_gateway_connection.go +++ b/azurerm/resource_arm_virtual_network_gateway_connection.go @@ -108,6 +108,12 @@ func resourceArmVirtualNetworkGatewayConnection() *schema.Resource { Sensitive: true, }, + "express_route_gateway_bypass": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, + "ipsec_policy": { Type: schema.TypeList, Optional: true, @@ -350,6 +356,10 @@ func resourceArmVirtualNetworkGatewayConnectionRead(d *schema.ResourceData, meta d.Set("shared_key", conn.SharedKey) } + if conn.ExpressRouteGatewayBypass != nil { + d.Set("express_route_gateway_bypass", conn.ExpressRouteGatewayBypass) + } + if conn.IpsecPolicies != nil { ipsecPolicies := flattenArmVirtualNetworkGatewayConnectionIpsecPolicies(conn.IpsecPolicies) @@ -390,6 +400,7 @@ func getArmVirtualNetworkGatewayConnectionProperties(d *schema.ResourceData) (*n props := &network.VirtualNetworkGatewayConnectionPropertiesFormat{ ConnectionType: connectionType, EnableBgp: utils.Bool(d.Get("enable_bgp").(bool)), + ExpressRouteGatewayBypass: utils.Bool(d.Get("express_route_gateway_bypass").(bool)), UsePolicyBasedTrafficSelectors: utils.Bool(d.Get("use_policy_based_traffic_selectors").(bool)), } diff --git a/website/azurerm.erb b/website/azurerm.erb index b02e67b5ce54..3704a170dba8 100644 --- a/website/azurerm.erb +++ b/website/azurerm.erb @@ -151,6 +151,10 @@ azurerm_eventhub_namespace + > + azurerm_express_route_circuit + + > azurerm_image diff --git a/website/docs/d/express_route_circuit.html.markdown b/website/docs/d/express_route_circuit.html.markdown new file mode 100644 index 000000000000..bdaa225666e2 --- /dev/null +++ b/website/docs/d/express_route_circuit.html.markdown @@ -0,0 +1,73 @@ +--- +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_express_route_circuit" +sidebar_current: "docs-azurerm-datasource-express-route-circuit" +description: |- + Gets information about an existing ExpressRoute circuit. +--- + +# Data Source: azurerm_express_route_circuit + +Use this data source to access information about an existing ExpressRoute circuit. + +## Example Usage + +```hcl +data "azurerm_express_route_circuit" test { + resource_group_name = "${azurerm_resource_group.test.name}" + name = "${azurerm_express_route_circuit.test.name}" +} + +output "express_route_circuit_id" { + value = "${data.azurerm_express_route_circuit.test.id}" +} + +output "service_key" { + value = "${data.azurerm_express_route_circuit.test.service_key}" +} +``` + +## Argument Reference + +* `name` - (Required) The name of the ExpressRoute circuit. +* `resource_group_name` - (Required) The Name of the Resource Group where the ExpressRoute circuit exists. + +## Attributes Reference + +* `id` - The ID of the ExpressRoute circuit. + +* `location` - The Azure location where the ExpressRoute circuit exists + +* `peerings` - A `peerings` block for the ExpressRoute circuit as documented below + +* `service_provider_provisioning_state` - The ExpressRoute circuit provisioning state from your chosen service provider. Possible values are "NotProvisioned", "Provisioning", "Provisioned", and "Deprovisioning". + +* `service_key` - The string needed by the service provider to provision the ExpressRoute circuit. + +* `service_provider_properties` - A `service_provider_properties` block for the ExpressRoute circuit as documented below + +* `sku` - A `sku` block for the ExpressRoute circuit as documented below. + +--- + +`service_provider_properties` supports the following: + +* `service_provider_name` - The name of the ExpressRoute Service Provider. +* `peering_location` - The name of the peering location and **not** the Azure resource location. +* `bandwidth_in_mbps` - The bandwidth in Mbps of the ExpressRoute circuit. + +`peerings` supports the following: + +* `peering_type` - The type of the ExpressRoute Circuit Peering. Acceptable values include `AzurePrivatePeering`, `AzurePublicPeering` and `MicrosoftPeering`. Changing this forces a new resource to be created. +~> **NOTE:** only one Peering of each Type can be created per ExpressRoute circuit. +* `primary_peer_address_prefix` - A `/30` subnet for the primary link. +* `secondary_peer_address_prefix` - A `/30` subnet for the secondary link. +* `vlan_id` - A valid VLAN ID to establish this peering on. +* `shared_key` - The shared key. Can be a maximum of 25 characters. +* `azure_asn` - The Either a 16-bit or a 32-bit ASN for Azure. +* `peer_asn` - The Either a 16-bit or a 32-bit ASN. Can either be public or private. + +`sku` supports the following: + +* `tier` - The service tier. Possible values are `Standard` or `Premium`. +* `family` - The billing mode for bandwidth. Possible values are `MeteredData` or `UnlimitedData`. \ No newline at end of file diff --git a/website/docs/r/virtual_network_gateway_connection.html.markdown b/website/docs/r/virtual_network_gateway_connection.html.markdown index 6291f947868b..bb4079b01af1 100644 --- a/website/docs/r/virtual_network_gateway_connection.html.markdown +++ b/website/docs/r/virtual_network_gateway_connection.html.markdown @@ -247,6 +247,8 @@ The following arguments are supported: * `enable_bgp` - (Optional) If `true`, BGP (Border Gateway Protocol) is enabled for this connection. Defaults to `false`. +* `express_route_gateway_bypass` - (Optional) If `true`, data packets will bypass ExpressRoute Gateway for data forwarding This is only valid for ExpressRoute connections. + * `use_policy_based_traffic_selectors` - (Optional) If `true`, policy-based traffic selectors are enabled for this connection. Enabling policy-based traffic selectors requires an `ipsec_policy` block. Defaults to `false`. From 98c66cace38d51c28d63e6e49cdfd1e09efc1ff9 Mon Sep 17 00:00:00 2001 From: Tom Harvey Date: Tue, 16 Apr 2019 10:40:17 +0200 Subject: [PATCH 5/7] fixing the import so this builds --- azurerm/data_source_express_route_circuit.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azurerm/data_source_express_route_circuit.go b/azurerm/data_source_express_route_circuit.go index 6e7868d74c21..d733e9d96dfe 100644 --- a/azurerm/data_source_express_route_circuit.go +++ b/azurerm/data_source_express_route_circuit.go @@ -3,7 +3,7 @@ package azurerm import ( "fmt" - "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/validate" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" From a79361afd79ee08a3c50da532d7a8b4939cd6916 Mon Sep 17 00:00:00 2001 From: Tom Harvey Date: Tue, 16 Apr 2019 10:42:23 +0200 Subject: [PATCH 6/7] adding the data source test to the runable test --- azurerm/resource_arm_express_route_circuit_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/azurerm/resource_arm_express_route_circuit_test.go b/azurerm/resource_arm_express_route_circuit_test.go index 218e77a53b2a..0e3a61596352 100644 --- a/azurerm/resource_arm_express_route_circuit_test.go +++ b/azurerm/resource_arm_express_route_circuit_test.go @@ -25,6 +25,7 @@ func TestAccAzureRMExpressRouteCircuit(t *testing.T) { "premiumUnlimited": testAccAzureRMExpressRouteCircuit_premiumUnlimited, "allowClassicOperationsUpdate": testAccAzureRMExpressRouteCircuit_allowClassicOperationsUpdate, "requiresImport": testAccAzureRMExpressRouteCircuit_requiresImport, + "data_basic": testAccDataSourceAzureRMExpressRoute_basicMetered, }, "PrivatePeering": { "azurePrivatePeering": testAccAzureRMExpressRouteCircuitPeering_azurePrivatePeering, From ca4fa3cd971e3eb183f31c985ec7a9352372a9c5 Mon Sep 17 00:00:00 2001 From: Tom Harvey Date: Tue, 16 Apr 2019 20:31:43 +0200 Subject: [PATCH 7/7] updating the test expectation to match the response --- azurerm/data_source_express_route_circuit_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azurerm/data_source_express_route_circuit_test.go b/azurerm/data_source_express_route_circuit_test.go index 9240afb8c9d3..d2932c4816b3 100644 --- a/azurerm/data_source_express_route_circuit_test.go +++ b/azurerm/data_source_express_route_circuit_test.go @@ -21,8 +21,8 @@ func testAccDataSourceAzureRMExpressRoute_basicMetered(t *testing.T) { { Config: testAccDataSourceAzureRMExpressRoute_basic(ri, location), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr(dataSourceName, "service_provider_properties.0.service_provider_name", "Equinix Test"), - resource.TestCheckResourceAttr(dataSourceName, "service_provider_properties.0.peering_location", "Silicon Valley Test"), + resource.TestCheckResourceAttr(dataSourceName, "service_provider_properties.0.service_provider_name", "Equinix"), + resource.TestCheckResourceAttr(dataSourceName, "service_provider_properties.0.peering_location", "Silicon Valley"), resource.TestCheckResourceAttr(dataSourceName, "service_provider_properties.0.bandwidth_in_mbps", "50"), resource.TestCheckResourceAttr(dataSourceName, "sku.0.tier", "Standard"), resource.TestCheckResourceAttr(dataSourceName, "sku.0.family", "MeteredData"),