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

Add auto swap support to app service slots #4042

Closed
alastairtree opened this issue Aug 9, 2019 · 2 comments
Closed

Add auto swap support to app service slots #4042

alastairtree opened this issue Aug 9, 2019 · 2 comments

Comments

@alastairtree
Copy link
Contributor

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

Description

Please can we add auto swap support to the app service slot resource

New or Affected Resource(s)

  • azurerm_app_service_slot

Potential Terraform Configuration

resource "azurerm_app_service_slot" "app_service_slot" {
  name                    = var.slot_name
  app_service_name        = azurerm_app_service.app_service.name
  location                = var.location
  resource_group_name     = var.resource_group_name
  app_service_plan_id     = var.app_service_plan_id

  site_config {
    always_on                = true
    dotnet_framework_version = "v4.0"
    http2_enabled            = true

    # NEW configuration property
    auto_swap_slot_name = "production"
  }

References

The following template deployment allows you so set the autoSwapSlotName property on every terraform apply in addition to a regular azurerm_app_service_slot resource using an azureRM template as a temporary workaround:

resource "azurerm_template_deployment" "app_service_slot_auto_swap" {
  name                = "${var.slot_name}-auto-swap"
  resource_group_name = var.resource_group_name
  deployment_mode     = "Incremental"

  template_body = <<JSON
{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "variables": {
     "_force_terraform_to_always_redeploy": "${timestamp()}"
  },
  "resources": [{
      "type": "Microsoft.Web/sites/slots",
      "name": "${azurerm_app_service.app_service.name}/${azurerm_app_service_slot.app_service_slot.name}",
      "apiVersion": "2018-11-01",
      "location": "${var.location}",
      "properties": {
        "siteConfig": {
          "autoSwapSlotName": "production"
        }
      }
    }
  ]
}
  JSON
  depends_on    = [azurerm_app_service_slot.app_service_slot]
}
@kendaleiv
Copy link

This can be closed, implemented via #4752.

@ghost
Copy link

ghost commented Mar 29, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants