Skip to content

Commit

Permalink
Application Gateway: removed validation in application gateway (#3286)
Browse files Browse the repository at this point in the history
Fixes #3285
  • Loading branch information
mcharriere authored and katbyte committed Apr 29, 2019
1 parent 29db77d commit 07327d9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
7 changes: 0 additions & 7 deletions azurerm/resource_arm_application_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -2540,18 +2540,11 @@ func flattenApplicationGatewayURLPathMaps(input *[]network.ApplicationGatewayURL
}

if ruleProps := rule.ApplicationGatewayPathRulePropertiesFormat; ruleProps != nil {
if applicationGatewayHasSubResource(props.DefaultBackendAddressPool) && applicationGatewayHasSubResource(ruleProps.RedirectConfiguration) {
return nil, fmt.Errorf("[ERROR] Conflict between `default_backend_address_pool_name` and `redirect_configuration_name` (default back-end pool not applicable when redirection specified)")
}

if applicationGatewayHasSubResource(ruleProps.BackendAddressPool) && applicationGatewayHasSubResource(ruleProps.RedirectConfiguration) {
return nil, fmt.Errorf("[ERROR] Conflict between `backend_address_pool_name` and `redirect_configuration_name` (back-end pool not applicable when redirection specified)")
}

if applicationGatewayHasSubResource(props.DefaultBackendHTTPSettings) && applicationGatewayHasSubResource(ruleProps.RedirectConfiguration) {
return nil, fmt.Errorf("[ERROR] Conflict between `default_backend_http_settings_name` and `redirect_configuration_name` (default back-end settings not applicable when redirection specified)")
}

if applicationGatewayHasSubResource(ruleProps.BackendHTTPSettings) && applicationGatewayHasSubResource(ruleProps.RedirectConfiguration) {
return nil, fmt.Errorf("[ERROR] Conflict between `backend_http_settings_name` and `redirect_configuration_name` (back-end settings not applicable when redirection specified)")
}
Expand Down
5 changes: 3 additions & 2 deletions azurerm/resource_arm_application_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1314,7 +1314,7 @@ locals {
url_path_map_name = "${azurerm_virtual_network.test.name}-urlpath1"
redirect_configuration_name = "${azurerm_virtual_network.test.name}-PathRedirect"
redirect_configuration_name2 = "${azurerm_virtual_network.test.name}-PathRedirect2"
target_url = "http://www.example.com"
target_url = "http://www.example.com"
}
resource "azurerm_application_gateway" "test" {
Expand Down Expand Up @@ -1383,7 +1383,8 @@ resource "azurerm_application_gateway" "test" {
url_path_map {
name = "${local.url_path_map_name}"
default_redirect_configuration_name = "${local.redirect_configuration_name}"
default_backend_address_pool_name = "${local.backend_address_pool_name}"
default_backend_http_settings_name = "${local.http_setting_name}"
path_rule {
name = "${local.path_rule_name}"
Expand Down
8 changes: 5 additions & 3 deletions website/docs/r/application_gateway.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -370,11 +370,12 @@ A `url_path_map` block supports the following:

* `name` - (Required) The Name of the URL Path Map.

* `default_backend_address_pool_name` - (Optional) The Name of the Default Backend Address Pool which should be used for this URL Path Map. Cannot be set if there are path_rules with re-direct configurations set.
* `default_backend_address_pool_name` - (Optional) The Name of the Default Backend Address Pool which should be used for this URL Path Map. Cannot be set if `default_redirect_configuration_name` is set.

* `default_backend_http_settings_name` - (Optional) The Name of the Default Backend HTTP Settings Collection which should be used for this URL Path Map. Cannot be set if there are path_rules with re-direct configurations set.
* `default_backend_http_settings_name` - (Optional) The Name of the Default Backend HTTP Settings Collection which should be used for this URL Path Map. Cannot be set if `default_redirect_configuration_name` is set.

* `default_redirect_configuration_name` - (Optional) The Name of the Default Redirect Configuration which should be used for this URL Path Map. Cannot be set if either `default_backend_address_pool_name` or `default_backend_http_settings_name` is set.

* `default_redirect_configuration_name` - (Optional) The Name of the Default Redirect Configuration which should be used for this URL Path Map. Cannot be set if there are path_rules with Backend Address Pool or HTTP Settings set.

* `path_rule` - (Required) One or more `path_rule` blocks as defined above.

Expand Down Expand Up @@ -453,6 +454,7 @@ The following attributes are exported:
* `custom_error_configuration` - A list of `custom_error_configuration` blocks as defined below.

* `redirect_configuration` - A list of `redirect_configuration` blocks as defined below.

---

A `authentication_certificate` block exports the following:
Expand Down

0 comments on commit 07327d9

Please sign in to comment.