feat(bootstrap): expose move_subscriptions_to_target_management_group toggle (#4205) - #141
Conversation
… 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.
Before / After — captured plan outputBehavioural proof of the toggle, using a self-contained harness that mirrors the exact expression in BEFORE (hardcoded — no opt-out possible)Brownfield Terraform estate, original logic AFTER (new toggle)Same estate, Summary
Setting the toggle to |
|
Shaik Naseeruddin (@NaseerDevops-1994) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
Summary
Resolves #4205.
Exposes a new optional input
move_subscriptions_to_target_management_groupso that estates can opt out of relocating their platform subscriptions during bootstrap. Previously this was hardcoded tovar.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.tfalz/github/variables.tfalz/local/variables.tfWire it into each
alz/<vcs>/main.tfwhen callingmodule "azure":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 theazapi_resource.subscription_placementfor_eachinmodules/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.yamlby name (Convert-HCLVariablesToInputConfig→Set-Config→Write-TfvarsJsonFile); the interactive-wizard schema (AcceleratorInputSchema.json) only enriches prompts and never gates values. Declaring the variable inalz/<vcs>/variables.tf(this PR) makes it settable directly:Left unset, behaviour is unchanged (
truefor Terraform/Bicep,falsefor bicep-classic).Validation
terraform fmt -check -recursive alz— clean.terraform init+terraform validate— "Success! The configuration is valid." foralz/local,alz/github, andalz/azuredevops.Behavioural check (same brownfield Terraform estate,
target_subscriptions = [management, connectivity, identity, security]— matching the issue's 4-subscription plan excerpt):iac_typeterraformtrueterraformfalsefalsebicep-classicfalseterraformtruetrueSetting the toggle to
falsecleanly drops the subscription placements to0(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-Zonesand is intended to merge after this change is released.