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

Bug fix - azurerm_express_route_connection - Remove private_link_fast_path_enabled default vaule #26928

Merged
merged 3 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions internal/services/network/express_route_connection_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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{
Expand All @@ -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))
}
Expand Down Expand Up @@ -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{
Expand All @@ -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))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions internal/services/network/route_map_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/express_route_connection.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
Loading