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_*_app_slot on same asp as azurerm_*_app does not follow to new asp #25917

Open
1 task done
doug-fish opened this issue May 8, 2024 · 6 comments
Open
1 task done

Comments

@doug-fish
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.3.7

AzureRM Provider Version

3.102.0

Affected Resource(s)/Data Source(s)

azurerm_windows_web_app_slot azurerm_windows_function_app_slot azurerm_linux_web_app_slot azurerm_linux_function_app_slot

Terraform Configuration Files

provider "azurerm" {
  features {}
}

resource "azurerm_resource_group" "example" {
  name     = "example-resources-for-slot-asp-bug"
  location = "North Central US"
}

resource "azurerm_service_plan" "example1" {
  name                = "example-plan1"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  os_type             = "Windows"
  sku_name            = "P1v2"
}

resource "azurerm_service_plan" "example2" {
  name                = "example-plan2"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  os_type             = "Windows"
  sku_name            = "P1v2"
}

resource "azurerm_windows_web_app" "example" {
  name                = "example-windows-web-app"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_service_plan.example1.location
  service_plan_id     = azurerm_service_plan.example1.id
  # switch this an observe that the slot does not follow even though the "default" has changed
  #location            = azurerm_service_plan.example2.location
  #service_plan_id     = azurerm_service_plan.example2.id

  site_config {}
}

resource "azurerm_windows_web_app_slot" "example" {
  name           = "example-windows-web-app-slot"
  app_service_id = azurerm_windows_web_app.example.id
  # Setting this results in Error: parsing "": cannot parse an empty string
  # I think this is intentional from the fix to 23403
  # I'd like to be able to be explicit about where this slot should be - yet this is not allowed
  # service_plan_id     = azurerm_service_plan.example1.id

  site_config {}
}

resource "azurerm_web_app_active_slot" "example" {
  slot_id = azurerm_windows_web_app_slot.example.id
}

Debug Output/Panic Output

Initial apply went fine. Wanted to model a move to a different ASP, so I changed the location/service plan to a separate ASP as noted in the comments. 
 
Terraform will perform the following actions:

  # azurerm_windows_web_app.example will be updated in-place
  ~ resource "azurerm_windows_web_app" "example" {
        id                                             = "/subscriptions/a5398b02-6383-409a-a8d1-fecab87a0242/resourceGroups/example-resources-for-slot-asp-bug/providers/Microsoft.Web/sites/example-windows-web-app-4308952034902"
        name                                           = "example-windows-web-app-4308952034902"
      ~ service_plan_id                                = "/subscriptions/a5398b02-6383-409a-a8d1-fecab87a0242/resourceGroups/example-resources-for-slot-asp-bug/providers/Microsoft.Web/serverFarms/example-plan1" -> "/subscriptions/a5398b02-6383-409a-a8d1-fecab87a0242/resourceGroups/example-resources-for-slot-asp-bug/providers/Microsoft.Web/serverFarms/example-plan2"
        tags                                           = {}
        # (20 unchanged attributes hidden)

      ~ site_config {
          ~ use_32_bit_worker                       = false -> true
            # (22 unchanged attributes hidden)

            # (1 unchanged block hidden)
        }
    }

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

Expected Behaviour

The web app and its slot should have moved to the new ASP.

Actual Behaviour

Only the web app moved. the slot remained on the original ASP. This is not consistent with the description of the resource meanings.

It would be fine if I had to explicitly set the ASP for this scenario to work. However, this seems to be explicitly prevented by the fix to bug 23403.

Steps to Reproduce

  1. terraform apply
  2. edit web app to be on different asp
  3. terraform apply

Important Factoids

No response

References

No response

@xiaxyi
Copy link
Contributor

xiaxyi commented May 10, 2024

Thanks @doug-fish for raising this issue, let me try reproducing the issue. Besides, did you get a chance to check the slot's service plan in azure portal/ api call after the change?

@unkinected
Copy link

I think this might be related to @doug-fish's experience.

  • If I try to create a new slot with vnet integration and I set the service_plan_id, I get this message: 'service_plan_id' should only be specified when it differs from the 'service_plan_id' of the associated Web App (my slot id is the same as the parent app id)
  • If I try to create a new slot with vnet integration and I don't set the service_plan_id, I get: An App Service Plan is required to use Regional VNET Integration
  • If I try to set the service_plan_id on an existing slot, I get the message in the OP: Error: parsing "": cannot parse an empty string

I'm essentially dead in the water here. I can't create any new slots and I can't edit any existing ones. A quick fix would be appreciated.

@doug-fish
Copy link
Author

Thanks @doug-fish for raising this issue, let me try reproducing the issue. Besides, did you get a chance to check the slot's service plan in azure portal/ api call after the change?

I have checked. The slot truly does not change.

@dpickeringjudge
Copy link

I think this might be related to @doug-fish's experience.

  • If I try to create a new slot with vnet integration and I set the service_plan_id, I get this message: 'service_plan_id' should only be specified when it differs from the 'service_plan_id' of the associated Web App (my slot id is the same as the parent app id)
  • If I try to create a new slot with vnet integration and I don't set the service_plan_id, I get: An App Service Plan is required to use Regional VNET Integration
  • If I try to set the service_plan_id on an existing slot, I get the message in the OP: Error: parsing "": cannot parse an empty string

I'm essentially dead in the water here. I can't create any new slots and I can't edit any existing ones. A quick fix would be appreciated.

seeing a similar behavior in our setup.

@doug-fish
Copy link
Author

@dpickeringjudge please note the above voting method to help with prioritization!
"Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request"

@iWerewolf2
Copy link

I think this might be related to @doug-fish's experience.

  • If I try to create a new slot with vnet integration and I set the service_plan_id, I get this message: 'service_plan_id' should only be specified when it differs from the 'service_plan_id' of the associated Web App (my slot id is the same as the parent app id)
  • If I try to create a new slot with vnet integration and I don't set the service_plan_id, I get: An App Service Plan is required to use Regional VNET Integration
  • If I try to set the service_plan_id on an existing slot, I get the message in the OP: Error: parsing "": cannot parse an empty string

I'm essentially dead in the water here. I can't create any new slots and I can't edit any existing ones. A quick fix would be appreciated.

I have the same behavior with azurerm_windows_function_app_slot using only function_app_id for azurerm_linux_function_app_slot with app_service_id it was okay

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

No branches or pull requests

5 participants