Skip to content

3.6.3

Release Date: May 21, 2026


🐛 Bug Fixes

Terraform Modules

Restore APIM Backend Naming and Add Missing project-id Policy Variable 🔧

Modules: saif-resources (api module), saif-api-service

Commit: f8f96a78

Fixes two regressions introduced during the composable-Terraform migration that caused APIM policies to break in QA and Test environments.

Issue 1 — Missing project-id APIM policy variable: The project-id set-variable was dropped from all three APIM policy templates (api_policy_standard, api_policy_filevine, api_policy_subscription_key) during migration. This variable is read downstream by shared policy fragments to route and identify requests. It has been restored in all templates and is now passed through all six templatefile() calls in local.tf.

Issue 2 — Broken APIM backend naming: The monolith used the webapp resource name (e.g. app-saif-proj-test) as the APIM backend name. The migrated module replaced this with {api_name}-default, which created mismatches in workspaces already deployed with the original naming. The fix introduces an optional name field in the backends variable, resolved via coalesce() — when provided, it is used as-is; otherwise the existing fallback applies. The saif-api-service composer now passes name = module.webapp.webapp.name to restore the original naming convention.

Key Fixes:

  • project-id set-variable restored — Added back to api_policy_standard.tpl, api_policy_filevine.tpl, and api_policy_subscription_key.tpl
  • project_id passed to all templatefile() calls — All 6 calls (3 API-level + 3 per-operation) now receive project_id = var.context.project_id
  • Optional backends[].name field — Allows callers to explicitly control the APIM backend resource name
  • Named values derive from backend nameazurerm_api_management_named_value references the backend resource name directly, no string duplication
  • Mocking backend name is consistent — Derived as "{default_backend_name}-mocking" from the default backend resource
  • saif-api-service passes webapp namename = module.webapp.webapp.name restores the pre-migration naming convention

Benefits:

  • 🚀 Fixes broken APIM policy evaluation in QA and Test environments
  • 🔄 Eliminates forced backend resource recreation for workspaces already using webapp-based names
  • 🎯 Mocking backend name stays consistent with default backend name

Before / After (backend naming):

# Before (migrated module — wrong for existing workspaces)
name = "${var.api_name}-default"   # → "payrollreports-default"

# After (restored — matches original monolith naming)
name = coalesce(each.value.name, each.key == "default" ? var.api_name : "${var.api_name}-${each.key}")
# saif-api-service passes: name = module.webapp.webapp.name  → "pol-api-proc-payrollreports-test"

Before / After (policy template):

<!-- Before — missing set-variable -->
<inbound>
  <base />
  <set-backend-service ... />
</inbound>

<!-- After — project-id restored -->
<inbound>
  <base />
  <set-variable name="project-id" value="${project_id}" />
  <set-backend-service ... />
</inbound>

🔄 Breaking Changes

None in this release ✅


📋 Additional Notes

  • Total commits: 1
  • Files changed: 8
  • Contributors: Emmitt Johnson

Support

  • 📧 Teams Support Channel: Support