Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for azurerm_sql_managed_instance Long-term retention policy #25754

Open
1 task done
alselivonets opened this issue Apr 25, 2024 · 0 comments
Open
1 task done

Comments

@alselivonets
Copy link
Contributor

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.

Description

Please enable Long-term retention feature for azurerm_sql_managed_instance. These might be attribute blocks in azurerm_sql_managed_instance resource itself, or this might be a new resource azurerm_sql_managed_instance_retention_policy

New or Affected Resource(s)/Data Source(s)

azurerm_sql_managed_instance

Potential Terraform Configuration

# Option 1: create attribute blocks for retention definition
resource "azurerm_sql_managed_instance" "example" {
  name                         = "managedsqlinstance"
  resource_group_name          = azurerm_resource_group.example.name
  location                     = azurerm_resource_group.example.location
  administrator_login          = "mradministrator"
  administrator_login_password = "thisIsDog11"
  license_type                 = "BasePrice"
  subnet_id                    = azurerm_subnet.example.id
  sku_name                     = "GP_Gen5"
  vcores                       = 4
  storage_size_in_gb           = 32

  retention_enabled            = true

  retention_weekly {
    count = 1
  }
  
  retention_monthly {
    count = 1
  }

  retention_yearly {
    count = 1
  }

  depends_on = [
    azurerm_subnet_network_security_group_association.example,
    azurerm_subnet_route_table_association.example,
  ]
}

# Option 2: create a new resource azurerm_sql_managed_instance_retention_policy
resource "azurerm_azurerm_sql_managed_instance_retention_policy" {
  name                       = "example"
  sql_managed_instance_id    = resource.azurerm_sql_managed_instance.id
  weekly_retention_duration  = 1
  monthly_retention_duration = 1
  yearly_retention_duration  = 1
}

References

https://learn.microsoft.com/en-us/azure/azure-sql/managed-instance/long-term-backup-retention-configure
https://learn.microsoft.com/en-us/azure/azure-sql/database/long-term-retention-overview
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/sql_managed_instance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants