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

azurerm_virtual_network_gateway_connection - shared_key is optional when type is IPSec #6565

Merged
merged 3 commits into from Apr 26, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -510,23 +510,19 @@ func getArmVirtualNetworkGatewayConnectionProperties(d *schema.ResourceData) (*n

if props.ConnectionType == network.ExpressRoute {
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")
return nil, fmt.Errorf("`express_route_circuit_id` must be specified when `type` is set to `ExpressRoute`")
}
}

if props.ConnectionType == network.IPsec {
if props.LocalNetworkGateway2 == nil || props.LocalNetworkGateway2.ID == nil {
return nil, fmt.Errorf("`local_network_gateway_id` and `shared_key` must be specified when `type` is set to `IPsec")
}

if props.SharedKey == nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add an acceptance test to ensure this use-case is supported through the API? Unfortunately ARM Templates can behave differently to the API's themselves - so an acceptance test should confirm this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

return nil, fmt.Errorf("`local_network_gateway_id` and `shared_key` must be specified when `type` is set to `IPsec")
return nil, fmt.Errorf("`local_network_gateway_id` must be specified when `type` is set to `IPsec`")
}
}

if props.ConnectionType == network.Vnet2Vnet {
if props.VirtualNetworkGateway2 == nil || props.VirtualNetworkGateway2.ID == nil {
return nil, fmt.Errorf("`peer_virtual_network_gateway_id` and `shared_key` must be specified when `type` is set to `Vnet2Vnet")
return nil, fmt.Errorf("`peer_virtual_network_gateway_id` must be specified when `type` is set to `Vnet2Vnet`")
}
}

Expand Down
Expand Up @@ -240,9 +240,8 @@ The following arguments are supported:

* `routing_weight` - (Optional) The routing weight. Defaults to `10`.

* `shared_key` - (Optional) The shared IPSec key. A key must be provided if a
Site-to-Site or VNet-to-VNet connection is created whereas ExpressRoute
connections do not need a shared key.
* `shared_key` - (Optional) The shared IPSec key. A key could be provided if a
Site-to-Site, VNet-to-VNet or ExpressRoute connection is created.

* `connection_protocol` - (Optional) The IKE protocol version to use. Possible
values are `IKEv1` and `IKEv2`. Defaults to `IKEv2`.
Expand Down