Skip to content

Migrate root sandbox config to azurerm 5.0 - #591

Merged
Roger Doherty (MSFT) (doherty100) merged 2 commits into
vnextfrom
azurerm-5-migration-root-sandbox
Aug 5, 2026
Merged

Migrate root sandbox config to azurerm 5.0#591
Roger Doherty (MSFT) (doherty100) merged 2 commits into
vnextfrom
azurerm-5-migration-root-sandbox

Conversation

@doherty100

Copy link
Copy Markdown
Contributor

Summary

Migrates the root sandbox configuration and all root-reachable child modules (modules/* plus the extras/modules/* referenced by main.tf) from azurerm ~> 4.81.0 to ~> 5.0.1, including all code changes required by azurerm 5.0's breaking changes.

This supersedes the 11 Dependabot PRs for these paths (#574, #575, #576, #577, #578, #579, #580, #582, #584, #585, #586), which only raise the version constraint. On their own they fail terraform validate under 5.0 — the provider bump and the code fixes are coupled (new syntax is 5.0-only, old syntax is 4.x-only), so they must land together in one change.

Breaking changes addressed

  1. azurerm_private_dns_zone_virtual_network_link (azurerm 5.0: azurerm_private_dns_zone_virtual_network_link requires private_dns_zone_id #588) — the resource_group_name + private_dns_zone_name pair was removed; the required private_dns_zone_id is now used instead.
    • modules/vnet-shared/network.tfkey_vault and ampls links
    • modules/vnet-app/network.tf — the three for_each links
  2. azurerm_log_analytics_workspace (azurerm 5.0: azurerm_log_analytics_workspace removed internet_ingestion_enabled / internet_query_enabled #589) — the internet_ingestion_enabled / internet_query_enabled booleans were removed; replaced with internet_ingestion_access_type / internet_query_access_type ("Enabled"/"Disabled"), and the ignore_changes lifecycle updated to match.
    • modules/vnet-shared/main.tf
    • The root azapi_update_resource barrier is unaffected — it sets the raw ARM publicNetworkAccessForIngestion / publicNetworkAccessForQuery properties, not the provider arguments.

Additional breaking changes discovered during migration (not previously tracked)

  1. azurerm_monitor_diagnostic_setting — the metric block was removed in 5.0 (replaced by enabled_metric). The Key Vault "Audit Logs" setting in modules/vnet-shared/main.tf only enables audit logs (no metrics), so the now-invalid lifecycle { ignore_changes = [metric] } is simply removed.
  2. azurerm_container_registry — the trust_policy_enabled argument was removed (ACR content trust retired). It was set to false (disabled) in modules/vnet-app/main.tf, so removing it preserves behavior.

Validation

  • terraform init resolves azurerm v5.0.1.
  • terraform validate (all modules) → Success! The configuration is valid.
  • terraform fmt -recursive → clean.
  • tflint (recommended + azurerm ruleset), root and changed modules → no findings.

⚠️ This is a breaking major provider upgrade. It has not yet been deployment-tested (terraform apply) — recommend an apply against a sandbox before merge, as was done for the rg-devops-iac migration (#590).

Related

Bump the azurerm provider constraint from ~> 4.81.0 to ~> 5.0.1 across the
root module and all root-reachable child modules (modules/* and the
extras/modules/* referenced by main.tf), and apply the required azurerm 5.0
code changes surfaced by terraform validate:

- azurerm_private_dns_zone_virtual_network_link: use the required
  private_dns_zone_id argument instead of the removed resource_group_name +
  private_dns_zone_name pair (vnet-shared key_vault + ampls links; vnet-app
  three links). (#588)
- azurerm_log_analytics_workspace: replace the removed internet_ingestion_enabled
  / internet_query_enabled booleans with internet_ingestion_access_type /
  internet_query_access_type and update the ignore_changes lifecycle
  accordingly (vnet-shared). The root azapi barrier is unaffected (it sets the
  raw ARM publicNetworkAccessForIngestion/Query properties). (#589)
- azurerm_monitor_diagnostic_setting: remove the now-invalid
  lifecycle ignore_changes = [metric] (the metric block was removed in 5.0;
  this setting only enables audit logs, no metrics) (vnet-shared).
- azurerm_container_registry: remove the removed trust_policy_enabled argument
  (ACR content trust was retired); it was disabled, so behavior is unchanged
  (vnet-app).

Validated with terraform validate, terraform fmt, and tflint under azurerm v5.0.1.

Supersedes Dependabot PRs #574, #575, #576, #577, #578, #579, #580, #582, #584, #585, #586.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@doherty100

Copy link
Copy Markdown
Contributor Author

✅ Deployment + full test validation (azurerm 5.0.1)

Deployed a fresh sandbox from scratch on this branch (all 6 base modules enabled) and ran the full automated test suite. Everything passed.

Apply

  • terraform init resolved azurerm v5.0.1; terraform validate → success.
  • terraform applyApply complete! Resources: 271 added, 0 changed, 0 destroyed (~88 min), full base sandbox (vnet_shared, vnet_app, vm_jumpbox_linux, vm_mssql_win, mssql, mysql, vwan).

All four 5.0 breaking-change fixes exercised live

  • azurerm_private_dns_zone_virtual_network_linkprivate_dns_zone_id (vnet-shared + vnet-app links created cleanly)
  • azurerm_log_analytics_workspaceinternet_*_access_type args; the azapi_update_resource ingestion/query barrier still works
  • azurerm_monitor_diagnostic_settingmetric block removal (Key Vault audit-logs setting)
  • azurerm_container_registrytrust_policy_enabled removal (ACR created)

The public-access barrier pattern also worked end-to-end (Key Vault / Storage / AMPLS / Log Analytics flipped to private after data-plane writes completed).

Tests — Invoke-UnitTests.ps1 (all modules, unit + integration)

All VMs confirmed running first. Overall: Passed=102 Failed=0 → RESULT: PASS (~18 min).

Module Result
vnet-shared Passed=9 Failed=0
vnet-app Passed=18 Failed=0
vm-jumpbox-linux Passed=13 Failed=0
vm-mssql-win Passed=25 Failed=0
mssql Passed=5 Failed=0
mysql Passed=5 Failed=0
vwan Passed=5 Failed=0
integration: SSH jumpwin1 → jumplinux1 Passed=1 Failed=0
integration: SQL jumpwin1 → mssqlwin1 Passed=1 Failed=0
integration: Azure SQL jumpwin1 → testdb Passed=4 Failed=0
integration: MySQL jumpwin1 → mysql Passed=4 Failed=0
integration: P2S VPN local → sandbox endpoints Passed=12 Failed=0

AVD and on-prem integration tests were skipped (those modules aren't part of the base deployment).

Environment: deployed on an MCAPS tenant with an organization-specific exemption tag passed on every plan/apply. Branch was refreshed to current vnext before testing.

@doherty100
Roger Doherty (MSFT) (doherty100) merged commit 7e3ebb7 into vnext Aug 5, 2026
16 checks passed
@doherty100
Roger Doherty (MSFT) (doherty100) deleted the azurerm-5-migration-root-sandbox branch August 5, 2026 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant