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.59k stars 4.63k forks source link

New Resource: `azurerm_app_service_extension` #2328

Open MVP072000 opened 5 years ago

MVP072000 commented 5 years ago

Community Note

Description

Azure recently dropped some of the extensions we were using, but some that we still want include:

AppDynamics.WindowsAzure.SiteExtension 4.5 Application Insights extension for Azure App Service Azure Web Site Logs Browser

We used the 2 links below to build ARM templates & later PowerShell code to apply extensions, in case they prove useful, but I haven’t yet checked the API for the commands.

https://developer.rackspace.com/blog/Azure-WebApp-Extensions-with-ARM/

anarchitect commented 5 years ago

Any progress on this one?

nexxai commented 4 years ago

@tombuildsstuff It sure would be nice to get this as a supported resource because this morning I had to write this awful piece of Terraform and I still feel dirty:

resource "azurerm_template_deployment" "datadog" {
  name                = "${azurerm_app_service.main[count.index].name}-datadog"
  resource_group_name = var.resource_group_name
  template_body       = azurerm_app_service.main[count.index].site_config[0].linux_fx_version != "" ? file("${path.module}/../arm/blank.json") : file("${path.module}/../arm/siteextensions.json")

  parameters = azurerm_app_service.main[count.index].site_config[0].linux_fx_version != "" ? {} : {
    siteName          = azurerm_app_service.main[count.index].name
    extensionName     = "Datadog.AzureAppServices"
  }

  deployment_mode     = "Incremental"

  count = length(local.app_services)
}

Yes, because we have some Linux and some Windows App Services being created in a foreach using the same module, I have to check if the App Service is Linux and then, if so, deploy this blank.json file:

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
  },
  "resources": [
  ]
}

Otherwise, use the correct template:

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "siteName": {
      "type": "string",
      "metadata": {
        "description": "The Azure App Service Name"
      }
    },
    "extensionName": {
      "type": "string",
      "metadata": {
        "description": "The Site Extension Name."
      }
    }
  },
  "resources": [
    {
      "type": "Microsoft.Web/sites/siteextensions",
      "name": "[concat(parameters('siteName'), '/', parameters('extensionName'))]",
      "apiVersion": "2020-06-01"
    }
  ]
}
nexxai commented 4 years ago

Could we also add the service/function-app tag to this request since they can have siteextensions too

dagus commented 4 years ago

This feature should be prioritized since site extensions is often required to be used, otherwise the underlying infrastructure will not be utilized to the fullest. e.g need to add the extension ASP.NET Core 3.1 (x64) Runtime to be able to have full memory utilization. It feel very poor to have this as a arm template,

schlbra commented 3 years ago

Any updates on this issue?

jeanpaulsmit commented 3 years ago

Any updates on this? It seems this request has been open for over 2 year, is it somewhere on the roadmap? We like to start using AppDynamics, which requires site extensions.

jeanpaulsmit commented 3 years ago

@tombuildsstuff can you please provide an update on this topic?

Currently we use ARM templates to create the site extension, and that one times-out quite regularly (taking longer than 2 minutes on Azure). Next to that, I'd like to get rid of ARM in my TF files, so a dedicated extension resource is very welcome.

andydkelly-ig commented 2 years ago

@tombuildsstuff any update on this? We also have this issue with DataDog extension across 50+ App Services. Cheers

declankilker commented 2 years ago

@tombuildsstuff - Definitely something we could do with too.

benjaminvaliente commented 2 years ago

This feature it's going to be a time saver. Any update on this?

RaptorCyrax commented 2 years ago

That would be of great help. Was there any progress on the order?

jeanpaulsmit commented 2 years ago

Not so much related to the resource request, but still might be interesting to others following this issue.

We experience big issues with the template_deployment approach, the site extension refuses to install or times out. Almost every deployment we have to do twice and/or remove the site extension deployment first on the resource group. I hope I'm the only one experiencing this, but we're going to check out alternatives like the Azure DevOps App Service Management task, which also seems to be capable of doing this, or the newly announced AzAPI provider (https://docs.microsoft.com/en-us/azure/developer/terraform/overview-azapi-provider). The template_deployment approach just doesn't work well for site extensions for us (hence the wish for having it available as native Terraform resource).

rmcolbert commented 1 year ago

To add to this request, Microsoft added a management API endpoint (https://learn.microsoft.com/en-us/azure/templates/microsoft.web/sites/siteextensions) that has been around since 2020.

One challenge that we've had w/ calling the API using AzAPI is that the removal of many extensions requires that the site be stopped in order to release file locks on DLLs so in a perfect world, the provider resource would have a flag to bookend the uninstall with stop/start the app (if it was running).

berryvanesch commented 5 months ago

Any progress on this one?

In the mean time you can use the AzApi provider. Below a example for the dynatrace extension.

resource "azapi_resource" "dynatrace_site_extension" { type = "Microsoft.Web/sites/siteextensions@2022-03-01" name = "Dynatrace" parent_id = azurerm_windows_web_app.main.id }