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

Support for more custom error page status code for application gateway #23280

Closed
1 task done
jazzywessy opened this issue Sep 15, 2023 · 8 comments · Fixed by #27535
Closed
1 task done

Support for more custom error page status code for application gateway #23280

jazzywessy opened this issue Sep 15, 2023 · 8 comments · Fixed by #27535
Labels
enhancement sdk/requires-newer-api-version This requires upgrading the version of the API being used service/network
Milestone

Comments

@jazzywessy
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment and review the contribution guide to help.

Description

Currently, azurerm_application_gateway http_listener custom_error_configurations status_code only allow 403 and 502.

However, on azure portal other status code is allowed which will defer from terraform state and cannot be track if it is manually added on azure portal.

New or Affected Resource(s)/Data Source(s)

azurerm_application_gateway

Potential Terraform Configuration

resource "azurerm_application_gateway" "network" {
  name                = "example-appgateway"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location

  sku {
    name     = "Standard_Small"
    tier     = "Standard"
    capacity = 2
  }

  gateway_ip_configuration {
    name      = "my-gateway-ip-configuration"
    subnet_id = azurerm_subnet.frontend.id
  }

  frontend_port {
    name = local.frontend_port_name
    port = 80
  }

  frontend_ip_configuration {
    name                 = local.frontend_ip_configuration_name
    public_ip_address_id = azurerm_public_ip.example.id
  }

  backend_address_pool {
    name = local.backend_address_pool_name
  }

  backend_http_settings {
    name                  = local.http_setting_name
    cookie_based_affinity = "Disabled"
    path                  = "/path1/"
    port                  = 80
    protocol              = "Http"
    request_timeout       = 60
  }

  http_listener {
    name                           = local.listener_name
    frontend_ip_configuration_name = local.frontend_ip_configuration_name
    frontend_port_name             = local.frontend_port_name
    protocol                       = "Http"
    custom_error_configuration {
      status_code = 400custom_error_page_url = “www.example.net/400.html”
    }
  }

  request_routing_rule {
    name                       = local.request_routing_rule_name
    rule_type                  = "Basic"
    http_listener_name         = local.listener_name
    backend_address_pool_name  = local.backend_address_pool_name
    backend_http_settings_name = local.http_setting_name
  }
}

References

No response

@rcskosir
Copy link
Contributor

@jazzywessy Thank you for taking the time to open this feature request!

@psallis
Copy link

psallis commented Oct 19, 2023

Support for the full list of status_codes at both Global and Listener level
https://learn.microsoft.com/en-us/azure/application-gateway/custom-error

Adding an un-supported error page via CLI causes a terraform Apply error below,

Failure sending request: StatusCode=400 -- Original Error: Code="ApplicationGatewayCustomErrorStatusCodeIsInvalid" Message="Custom error page has an invalid HTTP status code '500', for applicationGateways /subscriptions/[removed[/resourceGroups/[removed[/providers/Microsoft.Network/applicationGateways/[removed[. Valid status codes are: '[403, 502]'." Details=[]

@StefanSchoof
Copy link
Contributor

The app gateway is using the network 2022-07-01

"github.com/tombuildsstuff/kermit/sdk/network/2022-07-01/network"

and this version has not the new options

https://github.com/tombuildsstuff/kermit/blob/f6cc716272f05bf668d07b537fa3bd6fb6fdf6ef/sdk/network/2022-07-01/network/enums.go#L115-L1119

they come with the network 2022-11-01

https://github.com/tombuildsstuff/kermit/blob/f6cc716272f05bf668d07b537fa3bd6fb6fdf6ef/sdk/network/2022-11-01/network/enums.go#L115-L136

And that takes me the hope, we will get this feature fast :(

@kristeey

This comment was marked as off-topic.

@tombuildsstuff tombuildsstuff added the sdk/requires-newer-api-version This requires upgrading the version of the API being used label Feb 9, 2024
@StefanSchoof
Copy link
Contributor

I just noticed, that setting the error pages via powershell, will result into a error (Custom error pages has invalid HTTP status code '500' for . Valid status codes are '[403, 502]') in the next apply.

@carnei-ro
Copy link

carnei-ro commented Jul 23, 2024

yeah, I tried to upgrade the API Version and still got the same error 🫠

for those who want to try:

terraform  state replace-provider hashicorp/azurerm registry.terraform.io/carnei-ro/azurerm
terraform plan

@tgermain-impirica

This comment was marked as off-topic.

Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.