Skip to content

fix: Render empty subscription arrays correctly (#4195) - #140

Open
Omansh5 wants to merge 1 commit into
mainfrom
bug4195-empty-subscription-rendering
Open

fix: Render empty subscription arrays correctly (#4195)#140
Omansh5 wants to merge 1 commit into
mainfrom
bug4195-empty-subscription-rendering

Conversation

@Omansh5

@Omansh5 Omansh5 commented Aug 7, 2026

Copy link
Copy Markdown

Overview/Summary

This PR fixes Bug #4195 by correctly rendering empty subscription arrays for optional platform subscriptions in the generated Bicep parameter files.

Previously, when the Identity or Security subscription IDs were left empty, the generated .bicepparam files contained:

subscriptionsToPlaceInManagementGroup: ['']

This PR updates the rendering logic so that empty subscription values are rendered as:

subscriptionsToPlaceInManagementGroup: []

while preserving valid subscription IDs.

This PR fixes/adds/changes/removes

  1. Updates the Bicep file rendering logic in modules/file_manipulation/locals.bicep.tf.
  2. Converts [''] to [] after template rendering.
  3. Preserves valid subscription arrays for populated Management and Connectivity subscriptions.

Validation

Validation was performed using the ALZ Accelerator with the following configuration:

  • IaC: Bicep
  • Identity subscription: Empty
  • Security subscription: Empty
  • Management subscription: Configured
  • Connectivity subscription: Configured

Verified that:

  • Identity renders:
    subscriptionsToPlaceInManagementGroup: []
  • Security renders:
    subscriptionsToPlaceInManagementGroup: []
  • Management renders the configured subscription ID.
  • Connectivity renders the configured subscription ID.
  • No occurrences of [''] remain in the generated local-output files.
  • No unresolved template placeholders remain in the rendered .bicepparam files.

Fixes #4195

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses Bug #4195 by adjusting the Bicep .bicepparam templating pipeline to render empty subscription arrays as [] (instead of ['']) after template rendering, while leaving populated subscription arrays unchanged.

Changes:

  • Post-processes rendered .bicepparam content to convert [''] to [].
  • Keeps the existing escaping/unescaping flow around templatestring() intact.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Omansh5 Omansh5 changed the title Fix Bug #4195: Render empty subscription arrays correctly fix: Render empty subscription arrays correctly (#4195) Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants