Skip to content

TF State old schema dashboard replacement - #545

Merged
mattwin1 merged 2 commits into
mainfrom
fix/tfstateMigrate
Sep 24, 2026
Merged

mattwin1 merged 2 commits into
mainfrom
fix/tfstateMigrate

Conversation

@mattwin1

Copy link
Copy Markdown
Collaborator

This pull request significantly enhances the Deployment/terraform_conditional_run.ps1 script by introducing robust handling for legacy Azure Dashboard state migration, improving error handling and output clarity, and restructuring the script for better maintainability and readability. The changes ensure that deployments involving the transition from azurerm_dashboard to azurerm_portal_dashboard are handled safely and automatically, with clear checks and messaging throughout the process.

Azure Dashboard State Migration:

  • Added a migration block to detect and safely remove the legacy azurerm_dashboard resource from Terraform state if present, ensuring compatibility with AzureRM v4 and preventing accidental deletion of the actual Azure Dashboard resource. The script now checks for both legacy and new dashboard resources and handles all possible migration states with clear output and error handling.

Script Structure and Error Handling:

  • Refactored the script to use consistent and descriptive Write-Output messages, added section headers for clarity, and improved error handling after each critical Terraform command (init, workspace select, validate, plan, apply).
  • Ensured workspace selection uses the correct variable casing and added verification that the current workspace matches the expected one before proceeding.

Terraform Plan and Apply Enhancements:

  • Improved detection of planned resource destroys by parsing the Terraform plan output and requiring explicit confirmation to continue if resources are to be destroyed, using the correct pipeline variable for this check.

Output Handling:

  • Improved formatting and clarity of output variable setting for the pipeline, and reformatted JSON output generation for better readability.

These changes collectively make the deployment process safer, more transparent, and easier to maintain.…r new provider schema

@snyk-io-eu

snyk-io-eu Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@MuhammadJawad-Mastek MuhammadJawad-Mastek left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looking good to merge.

@mattwin1
mattwin1 merged commit b9aa4bd into main Sep 24, 2026
16 checks passed
@mattwin1
mattwin1 deleted the fix/tfstateMigrate branch September 24, 2026 13:54
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.

3 participants