Skip to content

Add the App Service Plan

As we saw earlier, creating an App Service requires an App Service Plan (docs), which define what kind of infrastructure the associated App Service runs on. Looking at the Terraform documentation for App Service Plans and then complete the following.

  1. Create the App Service Plan resource block and use the label dojo_app_service_plan
  2. Identify the required arguments and then complete the following:

Define a name for the App Service plan

The name is how this resource will be defined in Azure and identified in the portal. Let's call it asp-dojo-workshop.

Reference the values from the resource group

Recall that Azure resources need to be placed inside a resource group. Not surprisingly then, most Terraform resource blocks will need to have a resource_group_name and location definition.

By defining these within the azurerm_resource_group above, Terraform allows you to access those values and reference them in other resource definitions, like our azurerm_app_service_plan.

location            = azurerm_resource_group.<label>.location
resource_group_name = azurerm_resource_group.<label>.name

Define the App Service instance

You'll notice that the last required argument is for the sku, which details the specifics about the instance. Often organizations will have pre-configured and approved instances, but we will use Azure's available instances.

Check out Azure's App Service pricing plans to see about the different instant types, sizes, and pricing. Select an appropriate tier and size (hint: for sandbox purposes, we can use a Basic plan for dev workloads).

Hint: sample App Service Plan answer code
resource "azurerm_app_service_plan" "dojo_app_service_plan" {
  name                = "`asp-dojo-workshop`"
  location            = azurerm_resource_group.dojo_resource_group.location
  resource_group_name = azurerm_resource_group.dojo_resource_group.name

  sku {
    tier = "Basic"
    size = "B1"
  }
}