Skip to content

Error: retrieving Long Term Retention Policy for Managed Database when Instance is stopped #24094

@PAKalucki

Description

@PAKalucki

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment and review the contribution guide to help.

Terraform Version

1.4.6

AzureRM Provider Version

3.83.0

Affected Resource(s)/Data Source(s)

azurerm_mssql_managed_database

Terraform Configuration Files

resource "azurerm_mssql_managed_database" "this" {
  name                = var.db_name != "" ? var.db_name : "${var.name_prefix}-sqldb"
  managed_instance_id = azurerm_mssql_managed_instance.this.id

  timeouts {
    create = "4h"
  }
}

Debug Output/Panic Output

Error: retrieving Long Term Retention Policy for  Managed Database: (Database Name "sand-xyz-sqldb" / Managed Instance Name "sand-xyz-instance" / Resource Group "dev-xyz-eastus-rg"): sql.ManagedInstanceLongTermRetentionPoliciesClient#Get: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="LongTermRetentionPolicyNotSupported" Message="Long Term Retention is not supported : Database 'sand-xyz-sqldb' does not exist on server 'sand-xyz-instance'."
│
│   with module.mssql_sandbox[0].azurerm_mssql_managed_database.this,
│   on modules/mssql_managed_instance/main.tf line 1, in resource "azurerm_mssql_managed_database" "this":
│    1: resource "azurerm_mssql_managed_database" "this" {
│
│ retrieving Long Term Retention Policy for  Managed Database: (Database Name "sand-xyz-sqldb" / Managed Instance Name "sand-xyz-instance" / Resource Group "dev-xyz-eastus-rg"):
│ sql.ManagedInstanceLongTermRetentionPoliciesClient#Get: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="LongTermRetentionPolicyNotSupported" Message="Long Term
│ Retention is not supported : Database 'sand-xyz-sqldb' does not exist on server 'sand-xyz-instance'."

Expected Behaviour

Apply should work

Actual Behaviour

Apply fails despite not using long_term_retention_policy block.

Steps to Reproduce

  • create azurerm_mssql_managed_database and instance in it
  • stop the managed instance
  • run terraform apply again

Important Factoids

No response

References

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions