diff --git a/internal/services/network/express_route_connection_resource.go b/internal/services/network/express_route_connection_resource.go index f596e3e6de71..04a1c1c88a96 100644 --- a/internal/services/network/express_route_connection_resource.go +++ b/internal/services/network/express_route_connection_resource.go @@ -78,7 +78,6 @@ func resourceExpressRouteConnection() *pluginsdk.Resource { "private_link_fast_path_enabled": { Type: pluginsdk.TypeBool, Optional: true, - Default: false, }, "express_route_gateway_bypass_enabled": { @@ -183,10 +182,6 @@ func resourceExpressRouteConnectionCreate(d *pluginsdk.ResourceData, meta interf return tf.ImportAsExistsError("azurerm_express_route_connection", id.ID()) } - if d.Get("private_link_fast_path_enabled").(bool) && !d.Get("express_route_gateway_bypass_enabled").(bool) { - return fmt.Errorf("`express_route_gateway_bypass_enabled` must be enabled when `private_link_fast_path_enabled` is set to `true`") - } - parameters := expressrouteconnections.ExpressRouteConnection{ Name: id.ExpressRouteConnectionName, Properties: &expressrouteconnections.ExpressRouteConnectionProperties{ @@ -197,10 +192,17 @@ func resourceExpressRouteConnectionCreate(d *pluginsdk.ResourceData, meta interf RoutingConfiguration: expandExpressRouteConnectionRouting(d.Get("routing").([]interface{})), RoutingWeight: pointer.To(int64(d.Get("routing_weight").(int))), ExpressRouteGatewayBypass: pointer.To(d.Get("express_route_gateway_bypass_enabled").(bool)), - EnablePrivateLinkFastPath: pointer.To(d.Get("private_link_fast_path_enabled").(bool)), }, } + privateLinkFastPath := d.GetRawConfig().AsValueMap()["private_link_fast_path_enabled"] + if !privateLinkFastPath.IsNull() { + if d.Get("private_link_fast_path_enabled").(bool) && !d.Get("express_route_gateway_bypass_enabled").(bool) { + return fmt.Errorf("`express_route_gateway_bypass_enabled` must be enabled when `private_link_fast_path_enabled` is set to `true`") + } + parameters.Properties.EnablePrivateLinkFastPath = pointer.To(d.Get("private_link_fast_path_enabled").(bool)) + } + if v, ok := d.GetOk("authorization_key"); ok { parameters.Properties.AuthorizationKey = pointer.To(v.(string)) } @@ -280,9 +282,6 @@ func resourceExpressRouteConnectionUpdate(d *pluginsdk.ResourceData, meta interf return err } - if d.Get("private_link_fast_path_enabled").(bool) && !d.Get("express_route_gateway_bypass_enabled").(bool) { - return fmt.Errorf("`express_route_gateway_bypass_enabled` must be enabled when `private_link_fast_path_enabled` is set to `true`") - } parameters := expressrouteconnections.ExpressRouteConnection{ Name: id.ExpressRouteConnectionName, Properties: &expressrouteconnections.ExpressRouteConnectionProperties{ @@ -293,10 +292,17 @@ func resourceExpressRouteConnectionUpdate(d *pluginsdk.ResourceData, meta interf RoutingConfiguration: expandExpressRouteConnectionRouting(d.Get("routing").([]interface{})), RoutingWeight: pointer.To(int64(d.Get("routing_weight").(int))), ExpressRouteGatewayBypass: pointer.To(d.Get("express_route_gateway_bypass_enabled").(bool)), - EnablePrivateLinkFastPath: pointer.To(d.Get("private_link_fast_path_enabled").(bool)), }, } + privateLinkFastPath := d.GetRawConfig().AsValueMap()["private_link_fast_path_enabled"] + if !privateLinkFastPath.IsNull() { + if d.Get("private_link_fast_path_enabled").(bool) && !d.Get("express_route_gateway_bypass_enabled").(bool) { + return fmt.Errorf("`express_route_gateway_bypass_enabled` must be enabled when `private_link_fast_path_enabled` is set to `true`") + } + parameters.Properties.EnablePrivateLinkFastPath = pointer.To(d.Get("private_link_fast_path_enabled").(bool)) + } + if v, ok := d.GetOk("authorization_key"); ok { parameters.Properties.AuthorizationKey = pointer.To(v.(string)) } diff --git a/internal/services/network/express_route_connection_resource_test.go b/internal/services/network/express_route_connection_resource_test.go index 2f35bdac4595..14e06318f805 100644 --- a/internal/services/network/express_route_connection_resource_test.go +++ b/internal/services/network/express_route_connection_resource_test.go @@ -148,7 +148,6 @@ resource "azurerm_express_route_connection" "test" { routing_weight = 2 authorization_key = "90f8db47-e25b-4b65-a68b-7743ced2a16b" enable_internet_security = true - private_link_fast_path_enabled = true express_route_gateway_bypass_enabled = true routing { @@ -220,7 +219,6 @@ resource "azurerm_express_route_connection" "test" { routing_weight = 2 authorization_key = "90f8db47-e25b-4b65-a68b-7743ced2a16b" enable_internet_security = true - private_link_fast_path_enabled = true express_route_gateway_bypass_enabled = true routing { diff --git a/internal/services/network/route_map_resource.go b/internal/services/network/route_map_resource.go index 529c37f1ffff..12e07f6caa85 100644 --- a/internal/services/network/route_map_resource.go +++ b/internal/services/network/route_map_resource.go @@ -216,7 +216,7 @@ func (r RouteMapResource) Attributes() map[string]*pluginsdk.Schema { func (r RouteMapResource) Create() sdk.ResourceFunc { return sdk.ResourceFunc{ - Timeout: 30 * time.Minute, + Timeout: 60 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { var model RouteMapModel if err := metadata.Decode(&model); err != nil { @@ -256,7 +256,7 @@ func (r RouteMapResource) Create() sdk.ResourceFunc { func (r RouteMapResource) Update() sdk.ResourceFunc { return sdk.ResourceFunc{ - Timeout: 30 * time.Minute, + Timeout: 60 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.Network.VirtualWANs @@ -333,7 +333,7 @@ func (r RouteMapResource) Read() sdk.ResourceFunc { func (r RouteMapResource) Delete() sdk.ResourceFunc { return sdk.ResourceFunc{ - Timeout: 30 * time.Minute, + Timeout: 60 * time.Minute, Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { client := metadata.Client.Network.VirtualWANs diff --git a/website/docs/r/express_route_connection.html.markdown b/website/docs/r/express_route_connection.html.markdown index d85a0b67d538..280624b60237 100644 --- a/website/docs/r/express_route_connection.html.markdown +++ b/website/docs/r/express_route_connection.html.markdown @@ -98,7 +98,7 @@ The following arguments are supported: * `express_route_gateway_bypass_enabled` - (Optional) Specified whether Fast Path is enabled for Virtual Wan Firewall Hub. Defaults to `false`. -* `private_link_fast_path_enabled` - (Optional) Bypass the Express Route gateway when accessing private-links. When enabled `express_route_gateway_bypass_enabled` must be set to `true`. Defaults to `false`. +* `private_link_fast_path_enabled` - (Optional) Bypass the Express Route gateway when accessing private-links. When enabled `express_route_gateway_bypass_enabled` must be set to `true`. * `routing` - (Optional) A `routing` block as defined below.