Open fotto opened 1 month ago
Workaround: for HyperScale DB set a value that gets accepted by provider plus a suitable ignore_changes
setting, e.g.
resource "azurerm_mssql_database" "this" {
name = var.name
server_id = var.server_id
sku_name = "HS_S_Gen5_2"
...
short_term_retention_policy {
retention_days = 7
backup_interval_in_hours = 24 # only dummy. will internally be set to 0
}
...
lifecycle {
ignore_changes = [ short_term_retention_policy[0].backup_interval_in_hours ]
}
Hi @fotto thanks for opening this issue. I assume that after PR is merged, for HyperScale DB , by not specifying a value of backup_interval_in_hours
instead set it to 0. Could you please remove it and try again? Like this:
resource "azurerm_mssql_database" "this" {
name = var.name
server_id = var.server_id
sku_name = "HS_S_Gen5_2"
...
short_term_retention_policy {
retention_days = 7
}
Hi @sinbai , many thanks for that hint. I can confirm that it solves the issue:
So, the issue boils down to a pending documentation update for azurerm_mssql_database
.
I suggest to add something like this to the description of backup_interval_in_hours
:
This attribute must not be set for Hyperscale DBs or for DBs running within a Hyperscale Elastic Pool
Is there an existing issue for this?
Community Note
Terraform Version
1.9.8
AzureRM Provider Version
4.6.0
Affected Resource(s)/Data Source(s)
azurerm_mssql_database
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
provider should not enforce a value of "12" or "24" for HyperScale SKUs.
Rationale
If I set an allowed value, e.g.
then the change gets applied - But the next run of "terrraform plan" will then show the following configuration drift:
Conclusion: the API sets the value internally to 0 for Hyperscale DBs.
This behavior has changed recently as it seems (within last few days?)
Actual Behaviour
No response
Steps to Reproduce
No response
Important Factoids
No response
References
No response