You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have checked for previous/existing GitHub issues
Issue Type?
Bug
(Optional) Module Version
0.21.8
(Optional) Correlation Id
No response
Description
Since the module was rewritten to use azapi in v0.21.0, every terraform plan shows a spurious in-place update for azapi_resource.this due to a serverFarmId casing mismatch — even when no changes
have been made.
Steps to Reproduce
Use this module with an azurerm_service_plan resource as the service_plan_resource_id input.
Run terraform apply successfully.
Run terraform plan again — it immediately shows a diff.
The only difference is the capitalization of serverFarms (F vs f).
Root Cause
In locals.body.tf, serverFarmId is set directly from the input variable:
serverFarmId = var.service_plan_resource_id
The azurerm_service_plan resource returns an ID with serverFarms (capital F), which gets passed into the azapi_resource body. However, the Azure ARM API returns the serverFarmId property with
serverfarms (lowercase) in subsequent GET responses. The azapi provider performs a case-sensitive comparison between the desired body and the API response, resulting in a perpetual diff.
Check for previous/existing GitHub issues
Issue Type?
Bug
(Optional) Module Version
0.21.8
(Optional) Correlation Id
No response
Description
Since the module was rewritten to use azapi in v0.21.0, every terraform plan shows a spurious in-place update for azapi_resource.this due to a serverFarmId casing mismatch — even when no changes
have been made.
Steps to Reproduce
Plan Output
~ resource "azapi_resource" "this" {
~ body = {
~ properties = {
~ serverFarmId = "/subscriptions/.../providers/Microsoft.Web/serverfarms/my-plan" -> "/subscriptions/.../providers/Microsoft.Web/serverFarms/my-plan"
The only difference is the capitalization of serverFarms (F vs f).
Root Cause
In locals.body.tf, serverFarmId is set directly from the input variable:
serverFarmId = var.service_plan_resource_id
The azurerm_service_plan resource returns an ID with serverFarms (capital F), which gets passed into the azapi_resource body. However, the Azure ARM API returns the serverFarmId property with
serverfarms (lowercase) in subsequent GET responses. The azapi provider performs a case-sensitive comparison between the desired body and the API response, resulting in a perpetual diff.
Suggested Fix
Normalize the casing in locals.body.tf:
serverFarmId = replace(var.service_plan_resource_id, "/serverFarms/", "/serverfarms/")
Or more robustly using a regex to handle any casing:
serverFarmId = replace(var.service_plan_resource_id, "/(?i)serverfarms/", "/serverfarms/")
Environment