Search code examples
azureazure-devopsazure-web-app-serviceterraformterraform-provider-azure

Terraform fails to create a 64-bit Azure App Service (Web app)


I am using terraform version 0.15.5 (and also 0.15.4) to provision an Azure Web App resource. The following configuration works fine:

 site_config {
    http2_enabled             = true
    always_on                 = false
    use_32_bit_worker_process = true
  }

But when I use use_32_bit_worker_process = false to get the script provision a 64-bit web app, it fails and I get the following error message:

2021-06-03T18:06:55.6392592Z [31m│[0m [0m[1m[31mError: [0m[0m[1mError creating App Service "gfdemogatewayapp" (Resource Group "MASKED"): web.AppsClient#CreateOrUpdate: Failure sending request: StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status=<nil> <nil>[0m
2021-06-03T18:06:55.6411094Z [31m│[0m [0m
2021-06-03T18:06:55.6426506Z [31m│[0m [0m[0m  with azurerm_app_service.gfgatewayapp,
2021-06-03T18:06:55.6427703Z [31m│[0m [0m  on main.tf line 274, in resource "azurerm_app_service" "gfgatewayapp":
2021-06-03T18:06:55.6428766Z [31m│[0m [0m 274: resource "azurerm_app_service" "gfgatewayapp" [4m{[0m[0m
2021-06-03T18:06:55.6429584Z [31m│[0m [0m
2021-06-03T18:06:55.6430461Z [31m╵[0m[0m
2021-06-03T18:06:55.6534148Z ##[error]Error: The process '/opt/hostedtoolcache/terraform/0.15.4/x64/terraform' failed with exit code 1
2021-06-03T18:06:55.6548186Z ##[section]Finishing: Terraform approve and apply

Is there something that I am missing or terraform has an issue in provisioning the 64-bit web app resource on Azure?

UPDATE: The full source code The tier is Standard and the SKU size is "F1".

resource "azurerm_app_service_plan" "gfwebappserviceplan" {
  name                = var.gatewayserviceplanname
  location            = "${azurerm_resource_group.gf.location}"
  resource_group_name = "${azurerm_resource_group.gf.name}"

  sku {
    tier = var.gatewayserviceplanskutier
    size = var.gatewayserviceplanskusize
  }
}
resource "azurerm_app_service" "gfgatewayapp" {
  name                = var.gatewayappname
  location            = "${azurerm_resource_group.gf.location}"
  resource_group_name = "${azurerm_resource_group.gf.name}"
  app_service_plan_id = azurerm_app_service_plan.gfwebappserviceplan.id
  app_settings = {
    APPINSIGHTS_INSTRUMENTATIONKEY = "${azurerm_application_insights.gfapplicationinsights.instrumentation_key}"
  }

  site_config {
    http2_enabled             = true
    always_on                 = false
    use_32_bit_worker_process = false
  }
}

output "gfgatewayhostname" {
  value = "${azurerm_app_service.gfgatewayapp.default_site_hostname}"
  description = "Gateway default host name"
}

resource "azurerm_template_deployment" "webapp-corestack" {
  # This will make it .NET CORE for Stack property, and add the dotnet core logging extension
  name                = "AspNetCoreStack"
  resource_group_name = "${azurerm_resource_group.gf.name}"
  template_body       = <<DEPLOY
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "siteName": {
            "type": "string",
            "metadata": {
                "description": "The Azure App Service Name"
            }
        },
        "extensionName": {
            "type": "string",
            "metadata": {
                "description": "The Site Extension Name."
            }
        },
        "extensionVersion": {
            "type": "string",
            "metadata": {
                "description": "The Extension Version"
            }
        }
    },
    "resources": [
        {
            "apiVersion": "2018-02-01",
            "name": "[parameters('siteName')]",
            "type": "Microsoft.Web/sites",
            "location": "[resourceGroup().location]",
            "properties": {
                "name": "[parameters('siteName')]",
                "siteConfig": {
                    "appSettings": [],
                    "metadata": [
                        {
                            "name": "CURRENT_STACK",
                            "value": "dotnetcore"
                        }
                    ]
                }
            }
        },
        {
            "type": "Microsoft.Web/sites/siteextensions",
            "name": "[concat(parameters('siteName'), '/', parameters('extensionName'))]",
            "apiVersion": "2018-11-01",
            "location": "[resourceGroup().location]",
            "properties": {
                "version": "[parameters('extensionVersion')]"
            }
        }
    ]
}
  DEPLOY
  parameters = {
    "siteName"         = azurerm_app_service.gfgatewayapp.name
    "extensionName"    = "Microsoft.AspNetCore.AzureAppServices.SiteExtension"
    "extensionVersion" = "3.1.7"
  }
  deployment_mode = "Incremental"
  depends_on      = [azurerm_app_service.gfgatewayapp]
}

Solution

  • You are getting this error because you are using a F1 tier app service plan. Free or Shared tiers do not have a 64 bit option.

    Terraform AzureRM Registry