azurerm_app_service

Manages an App Service (within an App Service Plan).

Example Usage

This example provisions a Windows App Service. Other examples of the azurerm_app_service resource can be found in the ./examples/app-service directory within the GitHub Repository

resource "azurerm_resource_group" "example" {
  name     = "example-resources"
  location = "West Europe"
}

resource "azurerm_app_service_plan" "example" {
  name                = "example-appserviceplan"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name

  sku {
    tier = "Standard"
    size = "S1"
  }
}

resource "azurerm_app_service" "example" {
  name                = "example-app-service"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  app_service_plan_id = azurerm_app_service_plan.example.id

  site_config {
    dotnet_framework_version = "v4.0"
    scm_type                 = "LocalGit"
  }

  app_settings = {
    "SOME_KEY" = "some-value"
  }

  connection_string {
    name  = "Database"
    type  = "SQLServer"
    value = "Server=some-server.mydomain.com;Integrated Security=SSPI"
  }
}

Argument Reference

The following arguments are supported:


A storage_account block supports the following:


A connection_string block supports the following:


A identity block supports the following:


A logs block supports the following:


An application_logs block supports the following:


An http_logs block supports one of the following:


An azure_blob_storage block supports the following:


A file_system block supports the following:


A site_config block supports the following:

Additional examples of how to run Containers via the azurerm_app_service resource can be found in the ./examples/app-service directory within the GitHub Repository.


A cors block supports the following:


A auth_settings block supports the following:


A active_directory block supports the following:


A facebook block supports the following:


A google block supports the following:


A twitter block supports the following:


A ip_restriction block supports the following:


A scm_ip_restriction block supports the following:


A headers block supports the following:


A microsoft block supports the following:


A backup block supports the following:


A schedule block supports the following:


A source_control block supports the following:

Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:


A identity block exports the following:


A site_credential block exports the following:


A source_control block exports the following:

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

Import

App Services can be imported using the resource id, e.g.

terraform import azurerm_app_service.instance1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Web/sites/instance1