Skip to content

Commit

Permalink
[Deprecation] azurerm_express_route_connection - Remove `private_li…
Browse files Browse the repository at this point in the history
…nk_fast_path_enabled` (hashicorp#28161)

* deprecate `private_link_fast_path_enabled`

* update deprecate message

* remove private_link_fast_path_enabled from doc

* update deprecate msg

* update documentation
  • Loading branch information
xuzhang3 authored Jan 7, 2025
1 parent 4a33e95 commit 1387a8b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 25 deletions.
35 changes: 12 additions & 23 deletions internal/services/network/express_route_connection_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2024-03-01/expressrouteconnections"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/network/validate"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation"
Expand All @@ -23,7 +24,7 @@ import (
)

func resourceExpressRouteConnection() *pluginsdk.Resource {
return &pluginsdk.Resource{
resource := &pluginsdk.Resource{
Create: resourceExpressRouteConnectionCreate,
Read: resourceExpressRouteConnectionRead,
Update: resourceExpressRouteConnectionUpdate,
Expand Down Expand Up @@ -75,11 +76,6 @@ func resourceExpressRouteConnection() *pluginsdk.Resource {
Optional: true,
},

"private_link_fast_path_enabled": {
Type: pluginsdk.TypeBool,
Optional: true,
},

"express_route_gateway_bypass_enabled": {
Type: pluginsdk.TypeBool,
Optional: true,
Expand Down Expand Up @@ -157,6 +153,16 @@ func resourceExpressRouteConnection() *pluginsdk.Resource {
},
},
}

if !features.FivePointOhBeta() {
resource.Schema["private_link_fast_path_enabled"] = &pluginsdk.Schema{
Type: pluginsdk.TypeBool,
Optional: true,
Deprecated: "'private_link_fast_path_enabled' has been deprecated as it is no longer supported by the resource and will be removed in v5.0 of the AzureRM Provider",
}
}

return resource
}

func resourceExpressRouteConnectionCreate(d *pluginsdk.ResourceData, meta interface{}) error {
Expand Down Expand Up @@ -195,14 +201,6 @@ func resourceExpressRouteConnectionCreate(d *pluginsdk.ResourceData, meta interf
},
}

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))
}
Expand Down Expand Up @@ -243,7 +241,6 @@ func resourceExpressRouteConnectionRead(d *pluginsdk.ResourceData, meta interfac
d.Set("routing_weight", props.RoutingWeight)
d.Set("authorization_key", props.AuthorizationKey)
d.Set("enable_internet_security", props.EnableInternetSecurity)
d.Set("private_link_fast_path_enabled", pointer.From(props.EnablePrivateLinkFastPath))

if props.ExpressRouteGatewayBypass != nil {
d.Set("express_route_gateway_bypass_enabled", props.ExpressRouteGatewayBypass)
Expand Down Expand Up @@ -295,14 +292,6 @@ func resourceExpressRouteConnectionUpdate(d *pluginsdk.ResourceData, meta interf
},
}

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))
}
Expand Down
4 changes: 4 additions & 0 deletions website/docs/5.0-upgrade-guide.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ Please follow the format in the example below for listing breaking changes in re

* The `minimum_tls_version` property no longer accepts `1.0` and `1.1` as a value.

### `azurerm_express_route_connection`

* The deprecated `private_link_fast_path_enabled` property has been removed as it is no longer supported by the resource.

### `azurerm_logic_app_standard`

* The deprecated `site_config.public_network_access_enabled` property has been removed and superseded by the `public_network_access` property.
Expand Down
2 changes: 0 additions & 2 deletions website/docs/r/express_route_connection.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ 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`.

* `routing` - (Optional) A `routing` block as defined below.

* `routing_weight` - (Optional) The routing weight associated to the Express Route Connection. Possible value is between `0` and `32000`. Defaults to `0`.
Expand Down

0 comments on commit 1387a8b

Please sign in to comment.