Skip to content

feat(bootstrap): expose move_subscriptions_to_target_management_group toggle (#4205) - #141

Merged
Qi Zhang (Zhangqi910) merged 1 commit into
Azure:mainfrom
NaseerDevops-1994:fix/4205-expose-move-subscriptions-toggle
Oct 10, 2026
Merged

Qi Zhang (Zhangqi910) merged 1 commit into
Azure:mainfrom
NaseerDevops-1994:fix/4205-expose-move-subscriptions-toggle

Conversation

@NaseerDevops-1994

@NaseerDevops-1994 Shaik Naseeruddin (NaseerDevops-1994) commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Resolves #4205.

Exposes a new optional input move_subscriptions_to_target_management_group so that estates can opt out of relocating their platform subscriptions during bootstrap. Previously this was hardcoded to var.iac_type != "bicep-classic" with no way to override it, which forced subscription moves even for brownfield estates whose platform subscriptions are already placed in a management group hierarchy.

The input is added to all three VCS variants (azuredevops, github, local) and is fully backward-compatible: when left unset (null) the effective value is exactly today's behaviour.

Changes

  • Add variable "move_subscriptions_to_target_management_group" (type = bool, default = null) to:

    • alz/azuredevops/variables.tf
    • alz/github/variables.tf
    • alz/local/variables.tf
  • Wire it into each alz/<vcs>/main.tf when calling module "azure":

    move_subscriptions_to_target_management_group = var.move_subscriptions_to_target_management_group != null ? var.move_subscriptions_to_target_management_group : (var.iac_type != "bicep-classic")

    The pre-change expression (var.iac_type != "bicep-classic") remains the fallback, so unset = unchanged behaviour.

The consuming module input already exists (modules/azure/variables.tf) and gates the azapi_resource.subscription_placement for_each in modules/azure/subscription_placements.tf.

Usage (inputs.yaml)

No allowlist or schema change is required. The accelerator generates the bootstrap tfvars from the module's Terraform variables matched to inputs.yaml by name (Convert-HCLVariablesToInputConfig → Set-Config → Write-TfvarsJsonFile); the interactive-wizard schema (AcceleratorInputSchema.json) only enriches prompts and never gates values. Declaring the variable in alz/<vcs>/variables.tf (this PR) makes it settable directly:

# inputs.yaml
move_subscriptions_to_target_management_group: false

Left unset, behaviour is unchanged (true for Terraform/Bicep, false for bicep-classic).

Validation

  • terraform fmt -check -recursive alz — clean.
  • terraform init + terraform validate — "Success! The configuration is valid." for alz/local, alz/github, and alz/azuredevops.

Behavioural check (same brownfield Terraform estate, target_subscriptions = [management, connectivity, identity, security] — matching the issue's 4-subscription plan excerpt):

Scenario iac_type toggle effective value subscription placements
Default (unchanged) terraform unset true 4
Brownfield opt-out terraform false false 0
bicep-classic (unchanged) bicep-classic unset false 0
Explicit opt-in terraform true true 4

Setting the toggle to false cleanly drops the subscription placements to 0 (no subscriptions relocated), while the unset default preserves current behaviour.

Docs

A companion documentation update (migration guidance) will be raised separately in Azure/Azure-Landing-Zones and is intended to merge after this change is released.

… toggle (#4205)

Adds an optional bool input 'move_subscriptions_to_target_management_group' to the azuredevops, github and local variants. Defaults to null, preserving current behaviour (var.iac_type != 'bicep-classic'). Allows brownfield estates whose platform subscriptions are already placed to opt out of relocation during bootstrap.
@NaseerDevops-1994

Shaik Naseeruddin (NaseerDevops-1994) commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Before / After — captured plan output

Behavioural proof of the toggle, using a self-contained harness that mirrors the exact expression in alz/<vcs>/main.tf and the for_each in modules/azure/subscription_placements.tf, with target_subscriptions = [management, connectivity, identity, security] (matching the issue's 4-subscription plan excerpt).

BEFORE (hardcoded — no opt-out possible)

Brownfield Terraform estate, original logic move = (iac_type != "bicep-classic"):

==================================================================
 BEFORE #4205  -  brownfield Terraform estate (subs ALREADY placed)
 Hardcoded: move = (iac_type != 'bicep-classic')  ->  no opt-out
==================================================================

  + effective_move_subscriptions = true
  + iac_type                     = "terraform"
  + subscription_placement_count = 4

^ subscriptions are FORCE-MOVED (count=4). No variable exists to prevent it.

AFTER (new toggle)

Same estate, move_subscriptions_to_target_management_group = false:

==================================================================
 AFTER #4205  -  same brownfield Terraform estate
 New: move_subscriptions_to_target_management_group = false
==================================================================

  + effective_move_subscriptions = false
  + iac_type                     = "terraform"
  + subscription_placement_count = 0
  + toggle_input                 = false

^ opt-out honoured (count=0). No subscriptions relocated.

--- regression check: defaults UNCHANGED when toggle is unset ---
  + effective_move_subscriptions = true
  + iac_type                     = "terraform"
  + subscription_placement_count = 4
^ terraform default still moves (count=4) - backward compatible.

Summary

Scenario iac_type toggle subscription_placement
Before / default terraform unset 4
After (brownfield opt-out) terraform false 0
Regression (unset) terraform unset 4

Setting the toggle to false cleanly drops the subscription placements to 0 (no subscriptions relocated); leaving it unset preserves current behaviour. terraform validate also passes on all three variants (alz/local, alz/github, alz/azuredevops).

@Zhangqi910
Qi Zhang (Zhangqi910) merged commit f0a11c2 into Azure:main Oct 10, 2026
11 checks passed
Qi Zhang (Zhangqi910) pushed a commit to Azure/Azure-Landing-Zones that referenced this pull request Oct 10, 2026
#4243)

Adds guidance to the CAF Enterprise Scale -> AVM migration guide (both migration paths + FAQ) explaining that the bootstrap moves already-placed platform subscriptions by default at the end of phase 2, and how to opt out via move_subscriptions_to_target_management_group: false in inputs.yaml. Companion to Azure/accelerator-bootstrap-modules#141.

Co-authored-by: Shaik Naseeruddin (BEYONDSOFT CONSULTING INC) <v-shaiknase@microsoft.com>
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.

3 participants