Terraform-provider-azurerm: App Service Plan: uninformative error during scale down

Created on 2 Dec 2018  ·  3Comments  ·  Source: terraform-providers/terraform-provider-azurerm

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 v0.11.10
  • provider.azurerm v1.19.0

Affected Resource(s)

  • azurerm_app_service_plan

Terraform Configuration Files

provider "azurerm" {}

resource "azurerm_app_service_plan" "some-app-service-plan" {
    name                = "asp-check-bug"
    resource_group_name = "my-resource-group"
    location            = "eastus2"

    sku {
        tier = "Free"
        size = "F1"
    }
}

resource "azurerm_app_service" "some-app-service" {
    name                = "aps-check-bug"
    resource_group_name = "my-resource-group"
    location            = "eastus2"
    app_service_plan_id = "${azurerm_app_service_plan.some-app-service-plan.id}"

    site_config {
        always_on                 = true
        use_32_bit_worker_process = true
    }
}

Debug Output


https://gist.github.com/alant94/e9f8e2f1c26183b02d4e94ce67ec3b78

Expected Behavior


During scale down operation of App Service Plan from Standard to Free tier it should successfully complete or return an error, explaining why it is impossible. Like the errors specified in Activity log of resource.

In case of the configuration described above, the error should be Cannot update the site 'aps-check-bug' because it uses AlwaysOn feature which is not allowed in the target compute mode.

The same behavior is expected in case if use_32_bit_worker_process = false, meaning the error should be Cannot update the site 'aps-check-bug' because it uses x64 worker process which is not allowed in the target compute mode.

Actual Behavior

The error that is returned by terraform is kind of uninformative:

azurerm_app_service_plan.rcg-app-service-plan: Error creating/updating App Service Plan "asp-check-bug" (Resource Group "my-resource-group"): web.AppServicePlansClient#CreateOrUpdate: Failure sending request: StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status=<nil> <nil>

Steps to Reproduce

  1. terraform apply of the following configuration
provider "azurerm" {}

resource "azurerm_app_service_plan" "some-app-service-plan" {
    name                = "asp-check-bug"
    resource_group_name = "my-resource-group"
    location            = "eastus2"

    sku {
        tier = "Standard"
        size = "S1"
    }
}

resource "azurerm_app_service" "some-app-service" {
    name                = "aps-check-bug"
    resource_group_name = "my-resource-group"
    location            = "eastus2"
    app_service_plan_id = "${azurerm_app_service_plan.some-app-service-plan.id}"

    site_config {
        always_on                 = true
        use_32_bit_worker_process = true
    }
}
  1. terraform apply of changed configuration to scale down app service plan:
provider "azurerm" {}

resource "azurerm_app_service_plan" "some-app-service-plan" {
    name                = "asp-check-bug"
    resource_group_name = "my-resource-group"
    location            = "eastus2"

    sku {
        tier = "Free"
        size = "F1"
    }
}

resource "azurerm_app_service" "some-app-service" {
    name                = "aps-check-bug"
    resource_group_name = "my-resource-group"
    location            = "eastus2"
    app_service_plan_id = "${azurerm_app_service_plan.some-app-service-plan.id}"

    site_config {
        always_on                 = true
        use_32_bit_worker_process = true
    }
}

References


May be connected to (at least error is the same)

  • #1926
bug servicapp-service upstream-microsoft

Most helpful comment

@alant94 Thanks for reporting this issue.

After investigation , I think it is caused by incomplete error message returned by Azure Go SDK.

HTTP API response:

{
    "Code": "Conflict",
    "Message": "Cannot update the site 'acctestAS-8714886780103063993' because it uses AlwaysOn feature which is not allowed in the target compute mode.",
    "Target": null,
    "Details": [{
        "Message": "Cannot update the site 'acctestAS-8714886780103063993' because it uses AlwaysOn feature which is not allowed in the target compute mode."
    }, {
        "Code": "Conflict"
    }, {
        "ErrorEntity": {
            "ExtendedCode": "04068",
            "MessageTemplate": "Cannot update the site '{0}' because it uses AlwaysOn feature which is not allowed in the target compute mode.",
            "Parameters": ["acctestAS-8714886780103063993"],
            "Code": "Conflict",
            "Message": "Cannot update the site 'acctestAS-8714886780103063993' because it uses AlwaysOn feature which is not allowed in the target compute mode."
        }
    }],
    "Innererror": null
}

Error message returned by Azure Go SDK:

* azurerm_app_service_plan.test: Error creating/updating App Service Plan "acctestASP-8714886780103063993" (Resource Group "acctestRG-8714886780103063993"): web.AppServicePlansClient#CreateOrUpdate: Failure sending request:StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status=<nil> <nil>

I will open an issue for Azure Go SDK to follow up this issue.

All 3 comments

@alant94 Thanks for reporting this issue.

After investigation , I think it is caused by incomplete error message returned by Azure Go SDK.

HTTP API response:

{
    "Code": "Conflict",
    "Message": "Cannot update the site 'acctestAS-8714886780103063993' because it uses AlwaysOn feature which is not allowed in the target compute mode.",
    "Target": null,
    "Details": [{
        "Message": "Cannot update the site 'acctestAS-8714886780103063993' because it uses AlwaysOn feature which is not allowed in the target compute mode."
    }, {
        "Code": "Conflict"
    }, {
        "ErrorEntity": {
            "ExtendedCode": "04068",
            "MessageTemplate": "Cannot update the site '{0}' because it uses AlwaysOn feature which is not allowed in the target compute mode.",
            "Parameters": ["acctestAS-8714886780103063993"],
            "Code": "Conflict",
            "Message": "Cannot update the site 'acctestAS-8714886780103063993' because it uses AlwaysOn feature which is not allowed in the target compute mode."
        }
    }],
    "Innererror": null
}

Error message returned by Azure Go SDK:

* azurerm_app_service_plan.test: Error creating/updating App Service Plan "acctestASP-8714886780103063993" (Resource Group "acctestRG-8714886780103063993"): web.AppServicePlansClient#CreateOrUpdate: Failure sending request:StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status=<nil> <nil>

I will open an issue for Azure Go SDK to follow up this issue.

Closing this in favour of #6796 which is tracking the same thing

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

Was this page helpful?
0 / 5 - 0 ratings