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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_linux_web_app - site_config.always_on cannot be updated after initial deployment #25115

Open
1 task done
Dmitrii034 opened this issue Mar 1, 2024 · 3 comments 路 May be fixed by #25753
Open
1 task done

azurerm_linux_web_app - site_config.always_on cannot be updated after initial deployment #25115

Dmitrii034 opened this issue Mar 1, 2024 · 3 comments 路 May be fixed by #25753

Comments

@Dmitrii034
Copy link

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.5.7

AzureRM Provider Version

3.94.0

Affected Resource(s)/Data Source(s)

azurerm_linux_web_app

Terraform Configuration Files

terraform {
  required_version = "~>1.5.7"
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "~>3.94.0"
    }
  }
  backend "azurerm" {}
}

provider "azurerm" {
  subscription_id = var.subscriptionId
  tenant_id       = var.tenantId
  features {
  }
}

resource "azurerm_windows_web_app" "aas" {
  name                          = "appsvc-test"
  resource_group_name           = var.resourceGroup
  location                      = var.location
  service_plan_id               = azurerm_service_plan.asp.id
  https_only                    = true
  enabled                       = true
  virtual_network_subnet_id     = azurerm_subnet.snt.id
  public_network_access_enabled = false

  ftp_publish_basic_authentication_enabled       = false
  webdeploy_publish_basic_authentication_enabled = false


  site_config {
    always_on              = true
    minimum_tls_version    = "1.2"
    http2_enabled          = true
    vnet_route_all_enabled = true

    application_stack {
      dotnet_version = "8.0"
    }
  }

}

resource "azurerm_service_plan" "asp" {
  name                = "asp-test"
  resource_group_name = var.resourceGroup
  location            = var.location

  os_type  = "Linux"
  sku_name = "S1"
}

resource "azurerm_virtual_network" "vnt" {
  name                = "vnt-test"
  resource_group_name = var.resourceGroup
  location            = var.location
  address_space       = var.vntConfig.addressSpaces

}

resource "azurerm_subnet" "snt" {
  name                                           = "test-subnet"
  resource_group_name                            = var.resourceGroup
  virtual_network_name                           = azurerm_virtual_network.vnt.name
  address_prefixes                               = ["10.0.0.0/24"]
  
  delegation {
    name = "appsvc"
    service_delegation {
      name    = "Microsoft.Web/serverFarms"
      actions = ["Microsoft.Network/virtualNetworks/subnets/action"]
    }
  }
}

Debug Output/Panic Output

PS xxx> terraform apply -auto-approve
azurerm_virtual_network.vnt: Refreshing state... [id=/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Network/virtualNetworks/vnt-test]
azurerm_service_plan.asp: Refreshing state... [id=/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Web/serverFarms/asp-test]
azurerm_subnet.snt: Refreshing state... [id=/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Network/virtualNetworks/vnt-test/subnets/test-subnet]
azurerm_linux_web_app.aas: Refreshing state... [id=/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Web/sites/appsvc-test]

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.aas will be updated in-place
  ~ resource "azurerm_linux_web_app" "aas" {
        id                                             = "/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Web/sites/appsvc-test"
        name                                           = "appsvc-test"
        # (22 unchanged attributes hidden)

      ~ site_config {
          ~ always_on                               = true -> false
            # (21 unchanged attributes hidden)

            # (1 unchanged block hidden)
        }
    }

Plan: 0 to add, 1 to change, 0 to destroy.
azurerm_linux_web_app.aas: Modifying... [id=/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Web/sites/appsvc-test]
azurerm_linux_web_app.aas: Still modifying... [id=/subscriptions/xxx...Microsoft.Web/sites/appsvc-test, 10s elapsed]
azurerm_linux_web_app.aas: Still modifying... [id=/subscriptions/xxx...Microsoft.Web/sites/appsvc-test, 20s elapsed]
azurerm_linux_web_app.aas: Still modifying... [id=/subscriptions/xxx...Microsoft.Web/sites/appsvc-test, 30s elapsed]
azurerm_linux_web_app.aas: Still modifying... [id=/subscriptions/xxx...Microsoft.Web/sites/appsvc-test, 40s elapsed]
azurerm_linux_web_app.aas: Modifications complete after 41s [id=/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Web/sites/appsvc-test]

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

Expected Behaviour

After changing the value of site_config.always_on, Terraform will update the corresponding resource parameter.

Actual Behaviour

After changing the value of site_config.always_on, Terraform plan lists that it will update the corresponding resource parameter, but the apply action does not actually update it.

Steps to Reproduce

  1. terraform apply
  2. Change the value of site_config.always_on
  3. terraform apply

Important Factoids

No response

References

No response

@Dmitrii034 Dmitrii034 changed the title azurerm_linux_web_app - site_config,always_on cannot be updated after initial deployment azurerm_linux_web_app - site_config.always_on cannot be updated after initial deployment Mar 1, 2024
@ASHR4
Copy link
Contributor

ASHR4 commented Mar 4, 2024

@Dmitrii034 thank you for raising this!

It seems like the AlwaysOn attribute was missing from the ExpandForUpdate function but not from the ExpandforCreate function.

This would explain why you can only configure when creating the resource :)

@borislavml
Copy link

Is there an active PR we can follow te get merged so we can update the provider versions once fixed?

@pacorreia
Copy link

Can we we expect this fix to be released in the next version? 3.102.0 still has this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants