-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resources and Datasources for SQL Server Backups #1802
Comments
In addition to short term backup policy management, I would also add support for sql server Long Term Backup Policy Management while we're at it: https://docs.microsoft.com/en-us/rest/api/sql/backuplongtermretentionpolicies The structure of the LTR policy would likely closely resemble the short term policy. SHORT TERM Backup Policy Parameter:
LONG TERM Backup Policy Parameters:
|
If anyone is looking for an interim solution, I found this example ARM template in the comments at https://docs.microsoft.com/en-us/azure/sql-database/sql-database-long-term-backup-retention-configure You could probably use the terraform ARM template resource to deploy it.
|
I've found this link (not tested yet): http://dbainthecloud.com/how-to-deploy-an-azure-sql-database-using-terraform/ |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
We ended up letting Terraform invoke "az rest" with their REST API: https://docs.microsoft.com/en-us/rest/api/sql/backuplongtermretentionpolicies/createorupdate Worked. Though we would prefer an integration into tf provider and/or azure cli. |
seems like this is part of the go sdk which is usually the roadblock to TF inclusion https://github.com/Azure/azure-sdk-for-go/blob/master/services/sql/mgmt/2014-04-01/sql/backuplongtermretentionpolicies.go |
for those who are interested we ended up using arm templates to define policies like this (slimmed down as much as we could
this assumes you have a sql server resoucre named example anda db resource in that sql server named example. |
@tombuildsstuff do u know of anything blocking this functionality? |
@drdamour Is their any way we can restore the azure deleted databases from LTR backup with tagged resources using terraform arm template? |
I ended up going with @sjentzsch's solution. It's idempotent and avoids downsides of ARM template like importing existing policies. It looks like this:
to set long term retention, and then this:
to set short term retention. |
This has been released in version 2.31.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example: provider "azurerm" {
version = "~> 2.31.0"
}
# ... other configuration ... |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
Community Note
Description
We would like to use terraform to manage our sql server backups: https://docs.microsoft.com/en-us/rest/api/sql/backupshorttermretentionpolicies/createorupdate
New or Affected Resource(s)
Should be resources and datasources for Backup Policies
Potential Terraform Configuration
References
https://docs.microsoft.com/en-us/rest/api/sql/backupshorttermretentionpolicies/createorupdate
The text was updated successfully, but these errors were encountered: