Terraform-provider-azurerm: azurerm_app_service returns 409 error "Unknown service error"

Created on 13 Nov 2017  ·  5Comments  ·  Source: terraform-providers/terraform-provider-azurerm

Hi,

I cannot create an Azure App Service using terraform and azure cli. I have tested both v1 (nodejs) and v2 (python) of Azure CLI.
The App Service Plan (and Resource Group) is correctly created.

Terraform Version

Terraform v0.10.6
provider.azurerm: version = "~> 0.3"

Azure CLI 2.0

azure-cli (2.0.20)
...
appservice (0.1.19)
...
resource (2.0.17)

Affected Resource(s)

  • azurerm_app_service

Terraform Configuration Files

variable "default_location" {
   default = "West Europe"
}

variable "appserviceplan_name" {
   default =   "api"
}

variable "appservice_name" {
   default =   "api"
}

resource "azurerm_resource_group" "test" {
  name     = "testResourceGroup1"
  location = "${var.default_location}"
}

locals {
    suffix_asp = "${replace(format("%.24s", lower(base64sha256("${azurerm_resource_group.test.id}/${var.appserviceplan_name}"))),"/[+-_]","")}"
    appserviceplan_name = "${lower(format("asp-%s-%s",var.appserviceplan_name,local.suffix_asp))}"
    suffix_as = "${replace(format("%.24s", lower(base64sha256("${azurerm_resource_group.test.id}/${var.appservice_name}"))),"/[+-_]","")}"
    appservice_name = "${substr(lower(format("as-%s-%s",var.appservice_name,local.suffix_as)),0,24)}"
}

resource "azurerm_app_service_plan" "test" {
  name                = "${local.appserviceplan_name}"
  location            = "${azurerm_resource_group.test.location}"
  resource_group_name = "${azurerm_resource_group.test.name}"
  sku {
    tier = "Free"
    size = "F1"
  }
}

resource "azurerm_app_service" "test" {
  name                = "${local.appservice_name}"
  location            = "${azurerm_resource_group.test.location}"
  resource_group_name = "${azurerm_resource_group.test.name}"
  app_service_plan_id = "${azurerm_app_service_plan.test.id}"
  site_config {
     dotnet_framework_version = "v4.0"
  }
}

Debug Output

https://gist.github.com/r3dlin3/fca830182646459bc40242a3ed2f76ce

Expected Behavior

I would expect the creation of an app service over the app service plan.

Actual Behavior

Based on the provided terraform file, the RG and the App Service Plan are created without the App Service.

Steps to Reproduce

  1. terraform apply

Important Factoids

I'm trying to use a Free plan.

bug

All 5 comments

Hey @r3dlin3

Thanks for opening this issue.

Taking a look into this - this appears to be a duplicate of #394 where the Azure API returns a 409 if always_on is specified in the request when using a non-Premium SKU; as such I'm going to close this issue in favour of #394 to be able to keep updates in a single issue.

Thanks!

Hi,
Thanks for your reply.
I confirm that instanciating an App Service over a S1 App Service Plan works. So this is a duplicate.

@r3dlin3 I took a look into this issue today and discovered this is to do with the use_32_bit_worker_process field - which needs to be set to true for a Free/Shared tier SKU (as been detailed in #394) - would you be able to take a look and see if that solves your issue? I've opened PR #550 (which has since been merged) to update the documentation to explain this.

Thanks!

Hi,
Sorry for the delay!
I confirm you that with use_32_bit_worker_process = true on the app service over a Free app service plan, it works.
However, I do not know the consequences of this setting...

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