Skip to content

Commit

Permalink
Add EnablePrivateLinkFastPath as private_link_fast_path_enabled` to…
Browse files Browse the repository at this point in the history
… Virtual Network Gateway Connection

In relation to hashicorp#25596 this
is needed also on the Virtual Network Gateway Connection, for users who
connect their Express Routes via VNGs.

This option is only available, when the
`VirtualNetworkGatewayConnectionType` is `ExpressRoute` and when
`expressRouteGatewayBypass` is set, thus guarding for that.
  • Loading branch information
fjaeckel committed Apr 17, 2024
1 parent 9050633 commit ad7774e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ func dataSourceVirtualNetworkGatewayConnection() *pluginsdk.Resource {
Computed: true,
},

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

"resource_guid": {
Type: pluginsdk.TypeString,
Computed: true,
Expand Down Expand Up @@ -227,6 +232,7 @@ func dataSourceVirtualNetworkGatewayConnectionRead(d *pluginsdk.ResourceData, me
d.Set("egress_bytes_transferred", gwc.EgressBytesTransferred)
d.Set("use_policy_based_traffic_selectors", gwc.UsePolicyBasedTrafficSelectors)
d.Set("express_route_gateway_bypass", gwc.ExpressRouteGatewayBypass)
d.Set("private_link_fast_path_enabled", gwc.EnablePrivateLinkFastPath)
d.Set("type", string(gwc.ConnectionType))
d.Set("connection_protocol", string(gwc.ConnectionProtocol))
d.Set("routing_weight", gwc.RoutingWeight)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ func resourceVirtualNetworkGatewayConnection() *pluginsdk.Resource {
Computed: true,
},

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

"connection_protocol": {
Type: pluginsdk.TypeString,
Optional: true,
Expand Down Expand Up @@ -521,6 +527,10 @@ func resourceVirtualNetworkGatewayConnectionRead(d *pluginsdk.ResourceData, meta
d.Set("express_route_gateway_bypass", conn.ExpressRouteGatewayBypass)
}

if conn.EnablePrivateLinkFastPath != nil {
d.Set("private_link_fast_path_enabled", conn.EnablePrivateLinkFastPath)
}

if conn.IpsecPolicies != nil {
ipsecPolicies := flattenVirtualNetworkGatewayConnectionIpsecPolicies(conn.IpsecPolicies)

Expand Down Expand Up @@ -586,6 +596,7 @@ func getVirtualNetworkGatewayConnectionProperties(d *pluginsdk.ResourceData, vir
ConnectionType: connectionType,
ConnectionMode: connectionMode,
EnableBgp: utils.Bool(d.Get("enable_bgp").(bool)),
EnablePrivateLinkFastPath: utils.Bool(d.Get("private_link_fast_path_enabled").(bool)),
ExpressRouteGatewayBypass: utils.Bool(d.Get("express_route_gateway_bypass").(bool)),
UsePolicyBasedTrafficSelectors: utils.Bool(d.Get("use_policy_based_traffic_selectors").(bool)),
}
Expand Down Expand Up @@ -699,6 +710,9 @@ func getVirtualNetworkGatewayConnectionProperties(d *pluginsdk.ResourceData, vir
if props.Peer == nil || props.Peer.ID == nil {
return nil, fmt.Errorf("`express_route_circuit_id` must be specified when `type` is set to `ExpressRoute`")
}
if d.Get("private_link_fast_path_enabled").(bool) && !d.Get("express_route_gateway_bypass_enabled").(bool) {
return nil, fmt.Errorf("`express_route_gateway_bypass_enabled` must be enabled when `private_link_fast_path_enabled` is set to `true`")
}
}

if props.ConnectionType == network.VirtualNetworkGatewayConnectionTypeIPsec {
Expand Down

0 comments on commit ad7774e

Please sign in to comment.