Lesson 3 of 4 ยท Azure with Terraform

VMs and App Service

Azure virtual machines give you operating-system control. App Service provides a managed platform for web applications. Choose based on how much infrastructure control the application genuinely needs.

Example

resource "azurerm_service_plan" "main" {
  name                = "plan-training"
  location            = azurerm_resource_group.main.location
  resource_group_name = azurerm_resource_group.main.name
  os_type             = "Linux"
  sku_name            = "B1"
}

Step by step

  1. Create a service plan before an App Service.
  2. Use a VM when the workload needs OS-level control.
  3. Use managed app hosting for standard web workloads.
  4. Review the chosen service tier as demand changes.

Common mistakes to avoid

  • Creating an App Service without a service plan.
  • Selecting a production SKU without checking expected usage.