Skip to content

SAIFTRBL0008 ยท permalink

Function App deploy fails: service_plan_id is required

One-sentence summary: saif-event-subscriber-service needs your team's opt-in Elastic Premium -functions App Service plan, and until the platform team enables it the plan ID is null, so Terraform rejects the Function App with a missing-required-argument error.


๐Ÿšจ Symptom

Deploying saif-event-subscriber-service fails during terraform plan (or terraform apply) with:

Error: Missing required argument

  with module.function_app.azurerm_linux_function_app.this,
  on .terraform/modules/function_app/modules/functionapp_linux/main.tf line 5, in resource "azurerm_linux_function_app" "this":
   5:   service_plan_id               = var.service_plan_id

The argument "service_plan_id" is required, but no definition was found.

The error points at the third-party functionapp_linux module rather than at your service, so it reads like a module bug. It isn't โ€” the plan ID your service passed in was null. Line numbers shift between functionapp_linux versions; the resource address and the service_plan_id wording stay the same.

This appears in the event subscriber's Deploy pipeline Terraform step, and locally when running Terraform against the service.


๐Ÿ“Œ Applies to

Aspect Value
Component Terraform โ€” saif-event-subscriber-service
Module versions functionapp_linux ~> 5.1.1; saif-resources //modules/environment
Related versions Check the version compatibility matrix

๐Ÿง  Cause

The Elastic Premium (EP) plan that Function Apps run on is opt-in per team, because EP plans bill even when idle. Teams that have never deployed a Function App don't have one.

saif-event-subscriber-service reads the plan from module.environment.context.team_services.function_app_service_plan_id, which the environment module resolves as null when the team hasn't enabled it. That null flows into functionapp_linux's service_plan_id, which is a plain string variable with no null check, so it reaches azurerm_linux_function_app โ€” where the azurerm provider requires it. Terraform blocks the plan there.

Nothing is misconfigured in your service. The prerequisite just isn't provisioned yet.


โœ… Fix

The plan lives in the platform-owned cloud-foundations repo, so request it rather than changing your service:

  1. Ask the platform team to enable your team's Function App service plan, through either channel:

  2. Include in the request:

    • Your team name
    • The environments you need it in (test, qa, uat, prod)
    • That this is the opt-in Elastic Premium -functions plan, needed for saif-event-subscriber-service
    • Why the workload needs it, since EP plans carry a standing cost
  3. Wait for confirmation that the team stack has been applied, then re-run the deploy.

On the platform side this enables the -functions plan for your team and creates a Linux Elastic Premium plan named <team-service-plan>-functions with elastic scaling. You don't make this change yourself, and you don't need to modify your service's Terraform.


๐Ÿ”ฌ Verify

After the team stack is applied, re-run terraform plan for the service. The Missing required argument error is gone and the plan shows the Function App to add:

# module.function_app.azurerm_linux_function_app.this will be created
+ resource "azurerm_linux_function_app" "this" {
    + service_plan_id = "/subscriptions/.../providers/Microsoft.Web/serverfarms/<team-service-plan>-functions"

You can also confirm the plan exists in your team's resource group in the Azure portal: an App Service plan whose name ends in -functions with an EP SKU.