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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_linux_web_app_slot ignores worker_count parameter in site_config block #24678

Closed
1 task done
dkanbier opened this issue Jan 29, 2024 · 1 comment · Fixed by #24515
Closed
1 task done

azurerm_linux_web_app_slot ignores worker_count parameter in site_config block #24678

dkanbier opened this issue Jan 29, 2024 · 1 comment · Fixed by #24515

Comments

@dkanbier
Copy link
Contributor

dkanbier commented Jan 29, 2024

Is there an existing issue for this?

  • I have searched the existing issues

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 and review the contribution guide to help.

Terraform Version

1.7.1

AzureRM Provider Version

3.89.0

Affected Resource(s)/Data Source(s)

azurerm_linux_web_app_slot

Terraform Configuration Files

resource "random_integer" "ri" {
  min = 10000
  max = 99999
}

# Create the resource group
resource "azurerm_resource_group" "rg" {
  name     = "myResourceGroup-${random_integer.ri.result}"
  location = "westeurope"
}

# Create the Linux App Service Plan
resource "azurerm_service_plan" "appserviceplan" {
  name                     = "webapp-asp-${random_integer.ri.result}"
  location                 = azurerm_resource_group.rg.location
  resource_group_name      = azurerm_resource_group.rg.name
  os_type                  = "Linux"
  sku_name                 = "P1v3"
  per_site_scaling_enabled = true
  worker_count             = 2
}

# Create the web app, pass in the App Service Plan ID
resource "azurerm_linux_web_app" "webapp" {
  name                = "webapp-${random_integer.ri.result}"
  location            = azurerm_resource_group.rg.location
  resource_group_name = azurerm_resource_group.rg.name
  service_plan_id     = azurerm_service_plan.appserviceplan.id
  https_only          = true
  site_config {
    minimum_tls_version = "1.2"
    worker_count        = 2
  }
}

resource "azurerm_linux_web_app_slot" "webapp_slot" {
  name           = "webapp-staging-${random_integer.ri.result}"
  app_service_id = azurerm_linux_web_app.webapp.id
  site_config {
    minimum_tls_version = "1.2"
    worker_count        = 2
  }
}

Debug Output/Panic Output

PUT request to Azure for the slot:

PUT /subscriptions/SUBSCRIPTION/resourceGroups/myResourceGroup-42718/providers/Microsoft.Web/sites/webapp-42718/slots/webapp-staging-42718?api-version=2022-09-01 HTTP/1.1
Host: management.azure.com
User-Agent: Go/go1.21.3 (arm64-linux) go-autorest/v14.2.1 tombuildsstuff/kermit/v0.20230703.1101016 web/2022-09-01 HashiCorp Terraform/1.7.1 (+https://www.terraform.io) Terraform Plugin SDK/2.10.1 terraform-provider-azurerm/3.89.0 pid-222c6c49-1b0a-5959-a213-6608f9eb8820
Content-Length: 876
Content-Type: application/json; charset=utf-8
X-Ms-Correlation-Request-Id: CORRELATION_ID
Accept-Encoding: gzip

{"identity":{"type":"None"},"location":"West Europe","properties":{"clientAffinityEnabled":false,"clientCertEnabled":false,"clientCertMode":"Required","enabled":true,"httpsOnly":false,"publicNetworkAccess":"Enabled","serverFarmId":"/subscriptions/SUBSCRIPTION/resourceGroups/myResourceGroup-42718/providers/Microsoft.Web/serverFarms/webapp-asp-42718","siteConfig":{"acrUseManagedIdentityCreds":false,"alwaysOn":true,"autoHealEnabled":false,"ftpsState":"Disabled","http20Enabled":false,"loadBalancing":"LeastRequests","localMySqlEnabled":false,"managedPipelineMode":"Integrated","minTlsVersion":"1.2","publicNetworkAccess":"Enabled","remoteDebuggingEnabled":false,"scmIpSecurityRestrictionsUseMain":false,"scmMinTlsVersion":"1.2","use32BitWorkerProcess":true,"vnetRouteAllEnabled":false,"webSocketsEnabled":false},"vnetRouteAllEnabled":false},"tags":{}}: timestamp="2024-01-29T11:26:13.124+0100"

Payload:

{
  "identity": {
    "type": "None"
  },
  "location": "West Europe",
  "properties": {
    "clientAffinityEnabled": false,
    "clientCertEnabled": false,
    "clientCertMode": "Required",
    "enabled": true,
    "httpsOnly": false,
    "publicNetworkAccess": "Enabled",
    "serverFarmId": "/subscriptions/SUBSCRIPTION/resourceGroups/myResourceGroup-42718/providers/Microsoft.Web/serverFarms/webapp-asp-42718",
    "siteConfig": {
      "acrUseManagedIdentityCreds": false,
      "alwaysOn": true,
      "autoHealEnabled": false,
      "ftpsState": "Disabled",
      "http20Enabled": false,
      "loadBalancing": "LeastRequests",
      "localMySqlEnabled": false,
      "managedPipelineMode": "Integrated",
      "minTlsVersion": "1.2",
      "publicNetworkAccess": "Enabled",
      "remoteDebuggingEnabled": false,
      "scmIpSecurityRestrictionsUseMain": false,
      "scmMinTlsVersion": "1.2",
      "use32BitWorkerProcess": true,
      "vnetRouteAllEnabled": false,
      "webSocketsEnabled": false
    },
    "vnetRouteAllEnabled": false
  },
  "tags": {}
}

Expected Behaviour

The resulting azurerm_linux_web_app_slot in Azure should have a worker_count of 2.

Actual Behaviour

The resulting azurerm_linux_web_app_slot in Azure has a default worker_count of 1:

$ az webapp deployment slot list --resource-group myResourceGroup-42718 --name webapp-42718  | jq '.[] | select(.name=="webapp-staging-42718") | .siteConfig.numberOfWorkers'

1

When running terraform plan directly after the apply it will always show differences:

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # azurerm_linux_web_app_slot.webapp_slot will be updated in-place
  ~ resource "azurerm_linux_web_app_slot" "webapp_slot" {
        id                                             = "/subscriptions/SUBSCRIPTION/resourceGroups/myResourceGroup-42718/providers/Microsoft.Web/sites/webapp-42718/slots/webapp-staging-42718"
        name                                           = "webapp-staging-42718"
        tags                                           = {}
        # (20 unchanged attributes hidden)

      ~ site_config {
          ~ worker_count                            = 1 -> 2
            # (20 unchanged attributes hidden)

            # (1 unchanged block hidden)
        }
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Steps to Reproduce

  1. terraform apply
  2. terraform plan
  3. The plan will output changes in the worker_count

Important Factoids

Notice the NumberOfWorkers parameter is missing from the siteConfig block in the debug output. I think the missing parameter is the cause of this issue. I've created PR #24515 which solves the issue in my testing.

References

Documentation:
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/linux_web_app_slot#worker_count

Related PR:
#24515

Copy link

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants