Terraform v0.11.7
resource "azurerm_app_service" "wordpress" {
name = "..."
resource_group_name = "..."
location = "..."
app_service_plan_id = "${azurerm_app_service_plan.appservice.id}"
site_config {
}
lifecycle {
ignore_changes = [
"site_config"
]
}
app_settings {
"PHPMYADMIN_EXTENSION_VERSION" = "latest"
"WEBSITE_DYNAMIC_CACHE" = "0"
"APPINSIGHTS_INSTRUMENTATIONKEY" = "${azurerm_application_insights.appinsights.instrumentation_key}"
}
connection_string {
name = "defaultConnection"
type = "MySQL"
value = "Database=${azurerm_mysql_database.wordpress-db.name};Data Source=${azurerm_mysql_server.database.fqdn};User Id=${azurerm_mysql_server.database.administrator_login}@${azurerm_mysql_server.database.name};Password=${azurerm_mysql_server.database.administrator_login_password}"
}
}
2018-07-13T11:46:58.555+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: 2018/07/13 11:46:58 [DEBUG] AzureRM Response for https://management.azure.com/subscriptions/bd1eb79a-90ad-4b11-846d-378898aa9026/providers/Microsoft.Web/checknameavailability?api-version=2016-03-01:
2018-07-13T11:46:58.555+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: HTTP/1.1 200 OK
2018-07-13T11:46:58.555+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: Transfer-Encoding: chunked
2018-07-13T11:46:58.555+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: Cache-Control: no-cache
2018-07-13T11:46:58.555+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: Content-Type: application/json
2018-07-13T11:46:58.555+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: Date: Fri, 13 Jul 2018 10:46:58 GMT
2018-07-13T11:46:58.555+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: Expires: -1
2018-07-13T11:46:58.555+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: Pragma: no-cache
2018-07-13T11:46:58.555+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: Server: Microsoft-IIS/10.0
2018-07-13T11:46:58.555+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: Strict-Transport-Security: max-age=31536000; includeSubDomains
2018-07-13T11:46:58.555+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: Vary: Accept-Encoding
2018-07-13T11:46:58.555+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: X-Aspnet-Version: 4.0.30319
2018-07-13T11:46:58.555+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: X-Content-Type-Options: nosniff
2018-07-13T11:46:58.555+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: X-Ms-Correlation-Request-Id: ab8a44f1-681a-4140-ae68-ab6617292531
2018-07-13T11:46:58.555+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: X-Ms-Ratelimit-Remaining-Subscription-Reads: 14969
2018-07-13T11:46:58.555+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: X-Ms-Request-Id: b4cda202-4c7d-44bf-af72-cdbd4887cbf5
2018-07-13T11:46:58.555+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: X-Ms-Routing-Request-Id: UKWEST:20180713T104658Z:ab8a44f1-681a-4140-ae68-ab6617292531
2018-07-13T11:46:58.555+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: X-Powered-By: ASP.NET
2018-07-13T11:46:58.555+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4:
2018-07-13T11:46:58.555+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: 2f
2018-07-13T11:46:58.555+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: 0
2018-07-13T11:46:58.555+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4:
2018-07-13T11:46:58.555+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4:
2018-07-13T11:46:58.557+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: 2018/07/13 11:46:58 [DEBUG] AzureRM Request:
2018-07-13T11:46:58.557+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: PUT /subscriptions/bd1eb79a-90ad-4b11-846d-378898aa9026/resourceGroups/do0107/providers/Microsoft.Web/sites/REDACTED?api-version=2016-08-01 HTTP/1.1
2018-07-13T11:46:58.557+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: Host: management.azure.com
2018-07-13T11:46:58.557+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: User-Agent: Go/go1.9.2 (amd64-darwin) go-autorest/v10.12.0 Azure-SDK-For-Go/v18.0.0 web/2016-09-01;HashiCorp-Terraform-v0.11.3
2018-07-13T11:46:58.557+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: Content-Length: 628
2018-07-13T11:46:58.557+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: Authorization: Bearer [SNIPPED]
2018-07-13T11:46:58.557+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: Content-Type: application/json; charset=utf-8
2018-07-13T11:46:58.557+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: Accept-Encoding: gzip
2018-07-13T11:46:58.557+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4:
2018-07-13T11:47:01.106+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: 2018/07/13 11:47:01 [DEBUG] AzureRM Response for https://management.azure.com/subscriptions/bd1eb79a-90ad-4b11-846d-378898aa9026/resourceGroups/do0107/providers/Microsoft.Web/sites/REDACTED?api-version=2016-08-01:
2018-07-13T11:47:01.106+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: HTTP/1.1 409 Conflict
2018-07-13T11:47:01.106+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: Content-Length: 641
2018-07-13T11:47:01.106+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: Cache-Control: no-cache
2018-07-13T11:47:01.106+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: Content-Type: application/json; charset=utf-8
2018-07-13T11:47:01.106+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: Date: Fri, 13 Jul 2018 10:47:00 GMT
2018-07-13T11:47:01.106+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: Expires: -1
2018-07-13T11:47:01.106+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: Pragma: no-cache
2018-07-13T11:47:01.106+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: Server: Microsoft-IIS/10.0
2018-07-13T11:47:01.106+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: Strict-Transport-Security: max-age=31536000; includeSubDomains
2018-07-13T11:47:01.106+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: X-Aspnet-Version: 4.0.30319
2018-07-13T11:47:01.106+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: X-Content-Type-Options: nosniff
2018-07-13T11:47:01.106+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: X-Ms-Correlation-Request-Id: f3d9fb7e-c08c-4709-ab40-358a24c0c2bd
2018-07-13T11:47:01.106+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: X-Ms-Ratelimit-Remaining-Subscription-Resource-Requests: 499
2018-07-13T11:47:01.106+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: X-Ms-Request-Id: f3d9fb7e-c08c-4709-ab40-358a24c0c2bd
2018-07-13T11:47:01.106+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: X-Ms-Routing-Request-Id: UKWEST:20180713T104701Z:f3d9fb7e-c08c-4709-ab40-358a24c0c2bd
2018-07-13T11:47:01.106+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4: X-Powered-By: ASP.NET
2018-07-13T11:47:01.106+0100 [DEBUG] plugin.terraform-provider-azurerm_v1.9.0_x4:
Site_config is applied
Error
Error: Error applying plan:
1 error(s) occurred:
* azurerm_app_service.wordpress-test: 1 error(s) occurred:
* azurerm_app_service.wordpress-test: web.AppsClient#CreateOrUpdate: Failure sending request: StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status=<nil> <nil>
terraform apply
Removing the site_config
block allows the app service to be created. Specifying the site_config as an update to an existing site also seems to work.
Can confirm. Same error and commenting out site_config
allowed app service to be created.
terraform -version
Terraform v0.11.8
+ provider.azurerm v1.15.0
Still an issue in provider.azurerm v1.18.0
Ran into this problem as well, using the following versions;
Terraform v0.11.10
Still an issue with 1.20.0
and terraform 0.11.10
To expand a little, it seems that in my case the always_on = true
option in site_config
, which is not really supported with my Consumption plan sku, is causing the error.
So I am not sure that in my case this is due to the whole site_config
map but it rather seems like that one of its key when not supported gives out an cryptic error.
I had the exact same issue as @arichiardi. The site_config
itself isn't a problem, but the always_on = true
option is the problem. When I put other option like use_32_bit_worker_process = true/false
, it doesn't cause this issue.
Still hitting this on 0.11.11
/ 1.22.0
. Disabiling always_on
explicitly (even though I never had it enabled in the first place) does not seem to help.
One thing I found which helps, though, is first running apply
with the site_config
block commented, then uncommenting it and running apply
one more time. I also found the delta's shape a bit fishy during the second apply
when using an empty site_config {}
block - it seems to nuke a few more things than it should :
~ azurerm_app_service.fancypants_app_service
site_config.0.default_documents.#: "9" => "0"
site_config.0.default_documents.0: "Default.htm" => ""
site_config.0.default_documents.1: "Default.html" => ""
site_config.0.default_documents.2: "Default.asp" => ""
site_config.0.default_documents.3: "index.htm" => ""
site_config.0.default_documents.4: "index.html" => ""
site_config.0.default_documents.5: "iisstart.htm" => ""
site_config.0.default_documents.6: "default.aspx" => ""
site_config.0.default_documents.7: "index.php" => ""
site_config.0.default_documents.8: "hostingstart.html" => ""
site_config.0.php_version: "5.6" => ""
I think they should remain the same even if not specified under the site_config
block, since all of its properties are optional.
The issue reproduces in the v0.11.13 Terraform and v1.27.1 provider.azurerm. Also, a tier of app_service_plan was Free with size F1 but when I replaced tier with Basic the issue was gone.
Still encountering with Terraform v0.12.0 & provider.azurerm v1.28.0 when trying to deploy an app_service under a plan that utilizes the free tier.
EDIT: Manually creating the App Service, then importing it into terraform works. Once imported, it can be managed by terraform properly.
Encountered this issue today utilizing Terraform v0.12.0 and Azure RM v1.30.1 while trying to set the following site_config variable for apps on a Basic B3 service plan:
remote_debugging_enabled = true
After removing that line from the site_config, everything worked properly.
Still occurs on Azure RM v.1.31.0 and Terraform v0.12.3, using the Azure AppService Free tier.
My site_config was set to:
site_config {
dotnet_framework_version = "v4.0"
scm_type = "LocalGit"
}
Yep, still happening as of November.
Terraform v0.12.10
I had the same issue with the free plan. After changing to Basic (B1) it worked.
Was having the same issue and similar to @gerbermichi, changing it to Basic/B1 it worked:
resource "azurerm_app_service_plan" "sp" {
name = "${var.project}-${var.environment}-sp"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
kind = "Linux"
reserved = true
sku {
tier = "Basic"
size = "B1"
}
}
resource "azurerm_app_service" "as" {
name = "${var.project}-${var.environment}-as"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
app_service_plan_id = azurerm_app_service_plan.sp.id
site_config {
linux_fx_version = "PHP|5.6"
}
}
Was having the same issue and similar to @gerbermichi, changing it to Basic/B1 it worked:
resource "azurerm_app_service_plan" "sp" { name = "${var.project}-${var.environment}-sp" location = azurerm_resource_group.rg.location resource_group_name = azurerm_resource_group.rg.name kind = "Linux" reserved = true sku { tier = "Basic" size = "B1" } } resource "azurerm_app_service" "as" { name = "${var.project}-${var.environment}-as" location = azurerm_resource_group.rg.location resource_group_name = azurerm_resource_group.rg.name app_service_plan_id = azurerm_app_service_plan.sp.id site_config { linux_fx_version = "PHP|5.6" } }
Thanks that works ... "changing it to Basic/B1"
Same issue but not on a free project.
app_service_plan_id
was set to the wrong plan. Same error as here.
Not sure if its been explicitly found yet but having a sku of free/F1 doesn't allow a site_config with dotnet_framework_version set.
Using terraform: 0.12.19
And assurerm: 1.39.0
E.g.
resource "azurerm_app_service_plan" "web" {
name = "${azurerm_resource_group.web.name}-serviceplan"
location = azurerm_resource_group.web.location
resource_group_name = azurerm_resource_group.web.name
sku {
tier = "Free"
size = "F1"
}
}
resource "azurerm_app_service" "web" {
name = "${azurerm_resource_group.web.name}-webapp"
location = azurerm_resource_group.web.location
resource_group_name = azurerm_resource_group.web.name
app_service_plan_id = azurerm_app_service_plan.web.id
site_config {
dotnet_framework_version = "v4.0"
scm_type = "LocalGit"
}
}
Does not work, but this does:
resource "azurerm_app_service_plan" "web" {
name = "${azurerm_resource_group.web.name}-serviceplan"
location = azurerm_resource_group.web.location
resource_group_name = azurerm_resource_group.web.name
sku {
tier = "Basic"
size = "B1"
}
}
resource "azurerm_app_service" "web" {
name = "${azurerm_resource_group.web.name}-webapp"
location = azurerm_resource_group.web.location
resource_group_name = azurerm_resource_group.web.name
app_service_plan_id = azurerm_app_service_plan.web.id
site_config {
dotnet_framework_version = "v4.0"
scm_type = "LocalGit"
}
}
I had same problem using terraform 0.12.19 and 1.41
We are on,
_Terraform v0.12.20
For our app service plan we have a premium level set,
_sku {
tier = "Premium"
size = "P1v2"
}_
For our app service site config we are using the following,
_site_config {
linux_fx_version = "DOTNETCORE|3.1"
remote_debugging_enabled = true
remote_debugging_version = "VS2017"
}_
The original error in this ticket relates to "web.AppsClient#CreateOrUpdate",
_azurerm_app_service.wordpress-test: web.AppsClient#CreateOrUpdate: Failure sending request: StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status=
We get similar error on an apply but well after the environment has been stood up and many applys have been performed without error, our relates to "web.AppServicePlansClient#CreateOrUpdate",
_Error: Error creating/updating App Service Plan "EXAMPLE" (Resource Group "EXAMPLE"): web.AppServicePlansClient#CreateOrUpdate: Failure sending request: StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status=
The only way we can fix this so far is to destroy the target environment and rebuild from scratch. Still trying to locate the root cause of the error will advise if we locate it.
We are on
Terraform v0.12.20
provider.azurerm v1.44.0
I also experienced this issue:
Error: Error creating/updating App Service Plan "<plan_name>" (Resource Group "<resource_group>"): web.AppServicePlansClient#CreateOrUpdate: Failure sending request: StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status=<nil> <nil>
Upped the plan til it worked:
sku {
tier = "Basic"
size = "B2"
}
Before it worked for me I had to upped the plan to standard:
sku { tier = "Standard", size = "S1" }
It also looks like it's a requirement: https://azure.microsoft.com/en-us/pricing/details/app-service/plans/
I'm experiencing this bug too.
provider "azurerm" {
version = "2.13.0"
features {}
}
sku {
tier = "Free"
size = "F1"
}
site_config {
websockets_enabled = true
}
Please note that the websockets_enabled
can be set to either true or false in the Azure Portal.
=> The feature is clearly available in the Free tier.
Really doesn't like the Free/F1 for some reason
Given this is nearly 2 years old now I take it this is never getting fixed?
Same problem, but I guess it's not getting fixed? :(
Same Problem
web.AppsClient#CreateOrUpdate: Failure sending request: StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status=
@ben-lings-tessella , after tested, seems I can create app service successfully with empty site_config block and latest provider version now. So I assume your issue has gone. Could you have a try below tfconfig to check whether the issue still exists?
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "test" {
name = "acctestRG-appservice-test01"
location = "eastus2"
}
resource "azurerm_app_service_plan" "test" {
name = "acctestASP-test01"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
kind = "Linux"
reserved = true
sku {
tier = "Standard"
size = "S1"
}
}
resource "azurerm_app_service" "test" {
name = "acctestAS-test01"
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 {
}
app_settings = {
"WEBSITES_ENABLE_APP_SERVICE_STORAGE" = "false"
}
connection_string {
name = "Second"
value = "some-postgresql-connection-string"
type = "PostgreSQL"
}
lifecycle {
ignore_changes = [
site_config
]
}
}
@ben-lings-tessella , after tested, seems I can create app service successfully with empty site_config block and latest provider version now. So I assume your issue has gone. Could you have a try below tfconfig to check whether the issue still exists?
provider "azurerm" { features {} } resource "azurerm_resource_group" "test" { name = "acctestRG-appservice-test01" location = "eastus2" } resource "azurerm_app_service_plan" "test" { name = "acctestASP-test01" location = azurerm_resource_group.test.location resource_group_name = azurerm_resource_group.test.name kind = "Linux" reserved = true sku { tier = "Standard" size = "S1" } } resource "azurerm_app_service" "test" { name = "acctestAS-test01" 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 { } app_settings = { "WEBSITES_ENABLE_APP_SERVICE_STORAGE" = "false" } connection_string { name = "Second" value = "some-postgresql-connection-string" type = "PostgreSQL" } lifecycle { ignore_changes = [ site_config ] } }
You are on Standard S1 tier - it looks like the common theme seems to be a problem on Free F1 tier.
Yes, exactly @srpeirce. It was established earlier that things work fine for Standard tier @neil-yechenwei:
The issue reproduces in the v0.11.13 Terraform and v1.27.1 provider.azurerm.
Also, a tier of app_service_plan was Free with size F1 but when I replaced tier with Basic the issue was gone.
If I try something similar to my original config now, with debug logging turned on, I see the following:
{"Code":"Conflict","Message":"There was a conflict. 64 Bit worker processes cannot be used for the site as the plan does not allow it. For more information on pricing and features, please see: https://aka.ms/appservicepricingdetails ","Target":null,"Details":[{"Message":"There was a conflict. 64 Bit worker processes cannot be used for the site as the plan does not allow it. For more information on pricing and features, please see: https://aka.ms/appservicepricingdetails "},{"Code":"Conflict"},{"ErrorEntity":{"ExtendedCode":"01020","MessageTemplate":"There was a conflict. {0}","Parameters":["64 Bit worker processes cannot be used for the site as the plan does not allow it. For more information on pricing and features, please see: https://aka.ms/appservicepricingdetails "],"Code":"Conflict","Message":"There was a conflict. 64 Bit worker processes cannot be used for the site as the plan does not allow it. For more information on pricing and features, please see: https://aka.ms/appservicepricingdetails "}}],"Innererror":null}
So it looks like the problem was that if you have a site_config
block, it defaults to use_32_bit_worker_process = false
, which is incompatible with a free/shared app service plan.
This is the config that is still failing:
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "test" {
name = "acctestRG-appservice-test01"
location = "eastus2"
}
resource "azurerm_app_service_plan" "test" {
name = "acctestASP-test01"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
sku {
tier = "Shared"
size = "D1"
}
}
resource "azurerm_app_service" "test" {
name = "acctestAS-test01"
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 {
# Uncomment this line to make this work
# use_32_bit_worker_process = true
}
app_settings = {
"WEBSITES_ENABLE_APP_SERVICE_STORAGE" = "false"
}
connection_string {
name = "Second"
value = "some-postgresql-connection-string"
type = "PostgreSQL"
}
}
Would it be possible to show the Message
from the Conflict response in the Terraform error message? This would make diagnosing and fixing the problem with the config much more obvious!
There was a conflict. 64 Bit worker processes cannot be used for the site as the plan does not allow it. For more information on pricing and features, please see: https://aka.ms/appservicepricingdetails
For me this problem is still happening :)
I had the same issue deploying an Azure Function using a Premium Elastic Plan (EP1), and the problem was because under site_config{} block I had always_on key referenced, and it does not exist for that App Service Plan offering. So instead of throw a "Key doesn't exist" or something, it just failed with "Error: web.AppsClient#CreateOrUpdate: Failure sending request: StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status=
Hope this helps someone :)
Most helpful comment
Still occurs on Azure RM v.1.31.0 and Terraform v0.12.3, using the Azure AppService Free tier.
My site_config was set to: