Interview Prep/Azure/Azure DevOps, Bicep and Terraform

What is the `azapi` provider and when do you use it?

IntermediateConceptAzure DevOps, Bicep and Terraform
Answer

azapi is a thin Terraform provider over the ARM REST API. azapi_resource takes the resource type with API version and a body that mirrors the ARM schema:

resource "azapi_resource" "example" {
  type      = "Microsoft.ContainerService/managedClusters/maintenanceConfigurations@2024-09-01"
  name      = "aksManagedAutoUpgradeSchedule"
  parent_id = azurerm_kubernetes_cluster.aks.id
  body = { properties = { maintenanceWindow = { schedule = { weekly = { dayOfWeek = "Sunday", intervalWeeks = 1 } }, durationHours = 4, startTime = "01:00", utcOffset = "+05:30" } } }
}

Use it for features or API versions azurerm doesn't support yet, or azapi_update_resource to patch a property. It coexists with azurerm in the same configuration.

Azure All Azure questions Roadmap: AKS & Azure DevOps

More on Azure DevOps, Bicep and Terraform