Troubleshooting Azure SQL Time-Based Immutability with Terraform
Architecture Diagram Terraform Apply ➡ Resource Group ➡ SQL Server ➡ SQL Databases ➡ Short-Term Retention (7 days) ➡ Long-Term Retention (weekly/monthly/yearly) ➡ AzAPI Update (time-based immutability) TL;DR Terraform azurerm_mssql_database.long_term_retention_policy cannot fully enable time-based immutability yet. immutable_backups_enabled = true alone does not enforce it . Use AzAPI ( azapi_update_resource ) to enable timeBasedImmutability and timeBasedImmutabilityMode . Ensure LTR policies exist before updating via AzAPI . Validated in portal: backups become undeletable until retention expires. Problem Statement Trying to enforce time-based immutability for Azure SQL database backups using Terraform: long_term_retention_policy { immutable_backups_enabled = true weekly_retention = "P1W" } ✅ T...