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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better Error Handling for azurerm_app_service_virtual_network_swift_connection and azurerm_app_service_slot_virtual_network_swift_connection #9205

Open
nerddtvg opened this issue Nov 8, 2020 · 0 comments

Comments

@nerddtvg
Copy link
Contributor

nerddtvg commented Nov 8, 2020

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

Terraform (and AzureRM Provider) Version

terraform -v
Terraform v0.13.4
+ provider local/mastercard/restapi v1.13.0
+ provider registry.terraform.io/hashicorp/azuread v0.11.0
+ provider registry.terraform.io/hashicorp/azurerm v2.35.0
+ provider registry.terraform.io/hashicorp/external v2.0.0
+ provider registry.terraform.io/hashicorp/http v2.0.0
+ provider registry.terraform.io/hashicorp/null v3.0.0
+ provider registry.terraform.io/hashicorp/random v3.0.0

Affected Resource(s)

  • azurerm_app_service_virtual_network_swift_connection
  • azurerm_app_service_slot_virtual_network_swift_connection

Terraform Configuration Files

# Tie the App Services to the Virtual Network
resource "azurerm_app_service_virtual_network_swift_connection" "app_service_network" {
  app_service_id  = azurerm_app_service.app_service.id
  subnet_id       = azurerm_subnet.app_subnet.id
  depends_on      = [
    azurerm_subnet.app_subnet
  ]
}

resource "azurerm_app_service_slot_virtual_network_swift_connection" "staging_network" {
  slot_name       = azurerm_app_service_slot.staging.name
  app_service_id  = azurerm_app_service.app_service.id
  subnet_id       = azurerm_subnet.app_subnet.id

  depends_on      = [
    azurerm_subnet.app_subnet
  ]
}

resource "azurerm_subnet" "app_subnet" {
  name                                          = local.app_subnet
  resource_group_name                           = data.azurerm_resource_group.rg.name
  virtual_network_name                          = azurerm_virtual_network.vnet.name
  address_prefixes                              = ["10.0.1.0/24"]

  delegation {
    name    = "${local.app_subnet}-delegation"

    #service_delegation {
    #  name  = "Microsoft.Web/serverFarms"
    #}
  }
}

Debug Output

2020-11-08T13:11:51.362-0600 [DEBUG] plugin.terraform-provider-azurerm_v2.35.0_x5.exe: PUT /subscriptions/[SUBSCRIPTON]/resourceGroups/[RESOURCE_GROUP]/providers/Microsoft.Web/sites/[APP_SERVICE]/networkConfig/virtualNetwork?api-version=2019-08-01 HTTP/1.1
2020-11-08T13:11:51.362-0600 [DEBUG] plugin.terraform-provider-azurerm_v2.35.0_x5.exe: Host: management.azure.com
2020-11-08T13:11:51.362-0600 [DEBUG] plugin.terraform-provider-azurerm_v2.35.0_x5.exe: User-Agent: Go/go1.14.5 (amd64-windows) go-autorest/v14.2.1 Azure-SDK-For-Go/v46.4.0 web/2019-08-01 HashiCorp Terraform/0.13.4 (+https://www.terraform.io) Terraform Plugin SDK/1.13.1 terraform-provider-azurerm/2.35.0 pid-222c6c49-1b0a-5959-a213-6608f9eb8820
2020-11-08T13:11:51.362-0600 [DEBUG] plugin.terraform-provider-azurerm_v2.35.0_x5.exe: Content-Length: 217
2020-11-08T13:11:51.362-0600 [DEBUG] plugin.terraform-provider-azurerm_v2.35.0_x5.exe: Content-Type: application/json; charset=utf-8
2020-11-08T13:11:51.362-0600 [DEBUG] plugin.terraform-provider-azurerm_v2.35.0_x5.exe: X-Ms-Correlation-Request-Id: 8eb2cae1-675e-44b1-85c7-855e4bb5d181
2020-11-08T13:11:51.362-0600 [DEBUG] plugin.terraform-provider-azurerm_v2.35.0_x5.exe: Accept-Encoding: gzip
2020-11-08T13:11:51.362-0600 [DEBUG] plugin.terraform-provider-azurerm_v2.35.0_x5.exe:
2020-11-08T13:11:51.362-0600 [DEBUG] plugin.terraform-provider-azurerm_v2.35.0_x5.exe: {"properties":{"subnetResourceId":"/subscriptions/[SUBSCRIPTON]/resourceGroups/[RESOURCE_GROUP]/providers/Microsoft.Network/virtualNetworks/pep-dev-fsha-01-vnet/subnets/app_subnet"}}
2020/11/08 13:11:51 [TRACE] dag/walk: vertex "root" is waiting for "provider[\"registry.terraform.io/hashicorp/azurerm\"] (close)"
2020/11/08 13:11:51 [TRACE] dag/walk: vertex "meta.count-boundary (EachMode fixup)" is waiting for "azurerm_app_service_slot_virtual_network_swift_connection.staging_network"
2020-11-08T13:11:54.985-0600 [DEBUG] plugin.terraform-provider-azurerm_v2.35.0_x5.exe: [DEBUG] AzureRM Response for https://management.azure.com/subscriptions/[SUBSCRIPTON]/resourceGroups/[RESOURCE_GROUP]/providers/Microsoft.Web/sites/[APP_SERVICE]/networkConfig/virtualNetwork?api-version=2019-08-01:
2020-11-08T13:11:54.986-0600 [DEBUG] plugin.terraform-provider-azurerm_v2.35.0_x5.exe: HTTP/2.0 500 Internal Server Error
2020-11-08T13:11:54.986-0600 [DEBUG] plugin.terraform-provider-azurerm_v2.35.0_x5.exe: Content-Length: 36
2020-11-08T13:11:54.986-0600 [DEBUG] plugin.terraform-provider-azurerm_v2.35.0_x5.exe: Cache-Control: no-cache
2020-11-08T13:11:54.986-0600 [DEBUG] plugin.terraform-provider-azurerm_v2.35.0_x5.exe: Content-Type: application/json; charset=utf-8
2020-11-08T13:11:54.986-0600 [DEBUG] plugin.terraform-provider-azurerm_v2.35.0_x5.exe: Date: Sun, 08 Nov 2020 19:11:53 GMT
2020-11-08T13:11:54.986-0600 [DEBUG] plugin.terraform-provider-azurerm_v2.35.0_x5.exe: Etag: "1D6B602EFC6938B"
2020-11-08T13:11:54.986-0600 [DEBUG] plugin.terraform-provider-azurerm_v2.35.0_x5.exe: Expires: -1
2020-11-08T13:11:54.986-0600 [DEBUG] plugin.terraform-provider-azurerm_v2.35.0_x5.exe: Pragma: no-cache
2020-11-08T13:11:54.986-0600 [DEBUG] plugin.terraform-provider-azurerm_v2.35.0_x5.exe: Server: Microsoft-IIS/10.0
2020-11-08T13:11:54.986-0600 [DEBUG] plugin.terraform-provider-azurerm_v2.35.0_x5.exe: Strict-Transport-Security: max-age=31536000; includeSubDomains
2020-11-08T13:11:54.986-0600 [DEBUG] plugin.terraform-provider-azurerm_v2.35.0_x5.exe: X-Aspnet-Version: 4.0.30319
2020-11-08T13:11:54.986-0600 [DEBUG] plugin.terraform-provider-azurerm_v2.35.0_x5.exe: X-Content-Type-Options: nosniff
2020-11-08T13:11:54.986-0600 [DEBUG] plugin.terraform-provider-azurerm_v2.35.0_x5.exe: X-Ms-Correlation-Request-Id: 8eb2cae1-675e-44b1-85c7-855e4bb5d181
2020-11-08T13:11:54.986-0600 [DEBUG] plugin.terraform-provider-azurerm_v2.35.0_x5.exe: X-Ms-Failure-Cause: service
2020-11-08T13:11:54.986-0600 [DEBUG] plugin.terraform-provider-azurerm_v2.35.0_x5.exe: X-Ms-Ratelimit-Remaining-Subscription-Writes: 1194
2020-11-08T13:11:54.986-0600 [DEBUG] plugin.terraform-provider-azurerm_v2.35.0_x5.exe: X-Ms-Request-Id: fd2f78f6-560f-4120-aad5-014dc04a4f85
2020-11-08T13:11:54.986-0600 [DEBUG] plugin.terraform-provider-azurerm_v2.35.0_x5.exe: X-Ms-Routing-Request-Id: NORTHCENTRALUS:20201108T191154Z:fd2f78f6-560f-4120-aad5-014dc04a4f85
2020-11-08T13:11:54.986-0600 [DEBUG] plugin.terraform-provider-azurerm_v2.35.0_x5.exe: X-Powered-By: ASP.NET
2020-11-08T13:11:54.986-0600 [DEBUG] plugin.terraform-provider-azurerm_v2.35.0_x5.exe:
2020-11-08T13:11:54.986-0600 [DEBUG] plugin.terraform-provider-azurerm_v2.35.0_x5.exe: {"Message":"An error has occurred."}

Panic Output

Expected Behavior

When a subnet is not delegated to Microsoft.Web/serverFarms prior to configuring the VNet integration, the ARM API returns a 500 message with a generic error (An error has occurred). The Terraform provider continually retries until the configured or default timeout occurs (30 minutes). When the 500 error is returned, the creation should fail immediately. The error message is the fault of the API, but the error handling could be better.

Actual Behavior

The Terraform provider continually retries until the configured or default timeout occurs (30 minutes).

Steps to Reproduce

  1. terraform apply

Important Factoids

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants