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

Fix validation in resource azurerm_virtual_network_gateway for zone-redundant VPN gateways #3362

Merged
merged 1 commit into from
May 2, 2019
Merged
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
27 changes: 12 additions & 15 deletions azurerm/resource_arm_virtual_network_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,21 +80,15 @@ func resourceArmVirtualNetworkGateway() *schema.Resource {
Type: schema.TypeString,
Required: true,
DiffSuppressFunc: suppress.CaseDifference,
ValidateFunc: validation.StringInSlice([]string{
string(network.VirtualNetworkGatewaySkuTierBasic),
string(network.VirtualNetworkGatewaySkuTierStandard),
string(network.VirtualNetworkGatewaySkuTierHighPerformance),
string(network.VirtualNetworkGatewaySkuTierUltraPerformance),
string(network.VirtualNetworkGatewaySkuNameVpnGw1),
string(network.VirtualNetworkGatewaySkuNameVpnGw2),
string(network.VirtualNetworkGatewaySkuNameVpnGw3),
string(network.VirtualNetworkGatewaySkuNameErGw1AZ),
string(network.VirtualNetworkGatewaySkuNameErGw2AZ),
string(network.VirtualNetworkGatewaySkuNameErGw3AZ),
string(network.VirtualNetworkGatewaySkuNameVpnGw1AZ),
string(network.VirtualNetworkGatewaySkuNameVpnGw2AZ),
string(network.VirtualNetworkGatewaySkuNameVpnGw3AZ),
}, true),
// This validator checks for all possible values for the SKU regardless of the attributes vpn_type and
// type. For a validation which depends on the attributes vpn_type and type, refer to the special case
// validators validateArmVirtualNetworkGatewayPolicyBasedVpnSku, validateArmVirtualNetworkGatewayRouteBasedVpnSku
// and validateArmVirtualNetworkGatewayExpressRouteSku.
ValidateFunc: validation.Any(
validateArmVirtualNetworkGatewayPolicyBasedVpnSku(),
validateArmVirtualNetworkGatewayRouteBasedVpnSku(),
validateArmVirtualNetworkGatewayExpressRouteSku(),
),
},

"ip_configuration": {
Expand Down Expand Up @@ -773,6 +767,9 @@ func validateArmVirtualNetworkGatewayRouteBasedVpnSku() schema.SchemaValidateFun
string(network.VirtualNetworkGatewaySkuNameVpnGw1),
string(network.VirtualNetworkGatewaySkuNameVpnGw2),
string(network.VirtualNetworkGatewaySkuNameVpnGw3),
string(network.VirtualNetworkGatewaySkuNameVpnGw1AZ),
string(network.VirtualNetworkGatewaySkuNameVpnGw2AZ),
string(network.VirtualNetworkGatewaySkuNameVpnGw3AZ),
}, true)
}

Expand Down