hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.6k stars 4.64k forks source link

remote_debugging_version inconsistency in azurerm_linux_web_app_slot #26869

Open ncook-hxgn opened 3 months ago

ncook-hxgn commented 3 months ago

Is there an existing issue for this?

Community Note

Terraform Version

1.9.3

AzureRM Provider Version

3.113.0

Affected Resource(s)/Data Source(s)

azurerm_linux_web_app_slot

Terraform Configuration Files

resource "azurerm_linux_web_app_slot" "development_slot" {
  name           = "development"
  app_service_id = azurerm_linux_web_app.wep_app.id

  https_only = true

  identity {
    type = "SystemAssigned"
  }

  site_config {
    remote_debugging_enabled = true
    remote_debugging_version = "VS2019" # for plan, VS2019 is valid, for apply, VS2022 is the only available option
    application_stack {
      node_version = var.node_lts_version # 20 LTS
    }
    http2_enabled     = true
    use_32_bit_worker = false
  }

  app_settings = {
    NODE_ENV = "development"
    DEBUG    = "site:*"
  }

  auth_settings {
    # ...

    active_directory {
      # ...
    }
  }
}

contents of .terraform.lock.hcl:

# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.

provider "registry.terraform.io/hashicorp/azurerm" {
  version     = "3.107.0"
  constraints = ">= 3.74.0"
  hashes = [
    "h1:xA73PuMnVaXxtjTkpTJHE+No2IUDgXB4ELw0iKRiDHQ=",
    "zh:0a5bfcdef1dad509c4f45c0ada2c8e2cc058cf9542ddec48fbee18c4097bce9e",
    "zh:0b56736691e4b28ea15b381a4711ff39719ff83a40ce97cd283eb21988f471f6",
    "zh:13d55030c8be466b5de4819e4a8b84da69a40b15bfa0cc2588f5270b4682fa89",
    "zh:1eac398718cd0973f94015e49ff69a6ed8c860d69e4adbd192c7bea775af2941",
    "zh:7b1984b60abc7f53298950680bda504eca8d70c9d0d906d6dee2aac6a827f9d6",
    "zh:86f63ad98576d698c6ba8defa9165160633f086145a1f060014a93f5c2fb384e",
    "zh:afc78e7e0e76b4d2593ca2ec78b064c896888d03c6cb82f2c5bd37e815e056e7",
    "zh:b84997b287c673b297ede08404133279dbc72f070c8d6e4284bf62637de4bfb4",
    "zh:dd1d21c8a37938082a5c2497eacd76bacb1ac459bc9d38ee782443fa87a2247d",
    "zh:edcaca84c6473427d36f940748e5ce4d1d50b393012f6f6c0ec4303792f607d9",
    "zh:f0892ecd0eea0c06710056048d8bb75c4c3bda74de7ba41afa60d7b9c9a3b0ca",
    "zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c",
  ]
}

Terraform init output:

Initializing the backend...

Successfully configured the backend "azurerm"! Terraform will automatically
use this backend unless the backend configuration changes.
Initializing provider plugins...
- Reusing previous version of hashicorp/azurerm from the dependency lock file
- Installing hashicorp/azurerm v3.107.0...
- Installed hashicorp/azurerm v3.107.0 (signed by HashiCorp)
...

Debug Output/Panic Output

# doing terraform apply on main with `remote_debugging_version` set to `VS2019`:

..Slot Name: "development"): performing CreateOrUpdateSlot: unexpected status 400 (400 Bad Request) with response: {"Code":"BadRequest","Message":"The parameter 'remoteDebuggingVersion' has an invalid value. Details: Supported Versions: VS2022.","

# doing terraform plan on a bugfix branch to set `remote_debugging_version` to `VS2022`:
╷
│ Error: expected site_config.0.remote_debugging_version to be one of ["VS2017" "VS2019"], got VS2022
│ 
│   with azurerm_linux_web_app_slot.development_slot,
│   on main.tf line 234, in resource "azurerm_linux_web_app_slot" "development_slot":
│  234:     remote_debugging_version = "VS2022"

Expected Behaviour

It Used To Work And Now It Doesn't.

terraform plan and terraform validate should fail if the value for remote_debugging_version is not valid

Actual Behaviour

terraform plan and validate pass when the value of remote_debugging_version is VS2019 but apply will fail because azure expects VS2022. I get unexpected status 400 (400 Bad Request) with response: {"Code":"BadRequest","Message":"The parameter 'remoteDebuggingVersion' has an invalid value. Details: Supported Versions: VS2022.".

When I apply the fix as instructed, I get Error: expected site_config.0.remote_debugging_version to be one of ["VS2017" "VS2019"], got VS2022

Steps to Reproduce

No response

Important Factoids

No response

References

No response

Chambras commented 3 months ago

Interesting find @ncook-hxgn I will try to make sometime to check it out. I wonder if got introduced in v3.110.0. I see that some changes were introduced there in azurerm_linux_web_app_slot , but not 100% sure. Was this working on an earlier version?

ncook-hxgn commented 3 months ago

It was, it'd been stable for some months

ncook-hxgn commented 2 months ago

We use provider lockfiles.. I should have provided that.. Edit: I've provided my .terraform.lock.hcl file and the relevant output from terraform init in the OP