diff --git a/internal/services/network/application_gateway_resource.go b/internal/services/network/application_gateway_resource.go index 2f31b168469a..6f5b3c456dca 100644 --- a/internal/services/network/application_gateway_resource.go +++ b/internal/services/network/application_gateway_resource.go @@ -512,12 +512,9 @@ func resourceApplicationGateway() *pluginsdk.Resource { Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ "status_code": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{ - string(applicationgateways.ApplicationGatewayCustomErrorStatusCodeHTTPStatusFourZeroThree), - string(applicationgateways.ApplicationGatewayCustomErrorStatusCodeHTTPStatusFiveZeroTwo), - }, false), + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice(applicationgateways.PossibleValuesForApplicationGatewayCustomErrorStatusCode(), false), }, "custom_error_page_url": { @@ -1517,12 +1514,9 @@ func resourceApplicationGateway() *pluginsdk.Resource { Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ "status_code": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{ - string(applicationgateways.ApplicationGatewayCustomErrorStatusCodeHTTPStatusFourZeroThree), - string(applicationgateways.ApplicationGatewayCustomErrorStatusCodeHTTPStatusFiveZeroTwo), - }, false), + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice(applicationgateways.PossibleValuesForApplicationGatewayCustomErrorStatusCode(), false), }, "custom_error_page_url": { diff --git a/internal/services/network/application_gateway_resource_test.go b/internal/services/network/application_gateway_resource_test.go index 0ee0de00fb24..5533f5a6a585 100644 --- a/internal/services/network/application_gateway_resource_test.go +++ b/internal/services/network/application_gateway_resource_test.go @@ -6305,10 +6305,45 @@ resource "azurerm_application_gateway" "test" { custom_error_page_url = "http://azure.com/error403_listener.html" } + custom_error_configuration { + status_code = "HttpStatus404" + custom_error_page_url = "http://azure.com/error404_listener.html" + } + + custom_error_configuration { + status_code = "HttpStatus405" + custom_error_page_url = "http://azure.com/error405_listener.html" + } + + custom_error_configuration { + status_code = "HttpStatus408" + custom_error_page_url = "http://azure.com/error408_listener.html" + } + + custom_error_configuration { + status_code = "HttpStatus400" + custom_error_page_url = "http://azure.com/error400_listener.html" + } + custom_error_configuration { status_code = "HttpStatus502" custom_error_page_url = "http://azure.com/error502_listener.html" } + + custom_error_configuration { + status_code = "HttpStatus503" + custom_error_page_url = "http://azure.com/error503_listener.html" + } + + custom_error_configuration { + status_code = "HttpStatus504" + custom_error_page_url = "http://azure.com/error504_listener.html" + } + + custom_error_configuration { + status_code = "HttpStatus500" + custom_error_page_url = "http://azure.com/error500_listener.html" + } } custom_error_configuration { @@ -6316,11 +6351,46 @@ resource "azurerm_application_gateway" "test" { custom_error_page_url = "http://azure.com/error.html" } + custom_error_configuration { + status_code = "HttpStatus404" + custom_error_page_url = "http://azure.com/error.html" + } + + custom_error_configuration { + status_code = "HttpStatus405" + custom_error_page_url = "http://azure.com/error.html" + } + + custom_error_configuration { + status_code = "HttpStatus408" + custom_error_page_url = "http://azure.com/error.html" + } + + custom_error_configuration { + status_code = "HttpStatus400" + custom_error_page_url = "http://azure.com/error.html" + } + custom_error_configuration { status_code = "HttpStatus502" custom_error_page_url = "http://azure.com/error.html" } + custom_error_configuration { + status_code = "HttpStatus503" + custom_error_page_url = "http://azure.com/error.html" + } + + custom_error_configuration { + status_code = "HttpStatus504" + custom_error_page_url = "http://azure.com/error.html" + } + + custom_error_configuration { + status_code = "HttpStatus500" + custom_error_page_url = "http://azure.com/error.html" + } + request_routing_rule { name = local.request_routing_rule_name rule_type = "Basic" diff --git a/website/docs/r/application_gateway.html.markdown b/website/docs/r/application_gateway.html.markdown index 4a28c064cb07..922347a0b228 100644 --- a/website/docs/r/application_gateway.html.markdown +++ b/website/docs/r/application_gateway.html.markdown @@ -579,7 +579,7 @@ A `exclusion` block supports the following: A `custom_error_configuration` block supports the following: -* `status_code` - (Required) Status code of the application gateway customer error. Possible values are `HttpStatus403` and `HttpStatus502` +* `status_code` - (Required) Status code of the application gateway customer error. Possible values are `HttpStatus400`, `HttpStatus403`, `HttpStatus404`, `HttpStatus405`, `HttpStatus408`, `HttpStatus500`, `HttpStatus502`, `HttpStatus503` and `HttpStatus504` * `custom_error_page_url` - (Required) Error page URL of the application gateway customer error.