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 PostgreSQL Flexible backup vault policy. #25762

Closed
1 task done
ryanjcanning opened this issue Apr 26, 2024 · 1 comment
Closed
1 task done

Support for PostgreSQL Flexible backup vault policy. #25762

ryanjcanning opened this issue Apr 26, 2024 · 1 comment

Comments

@ryanjcanning
Copy link

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

Currently there is support for creating a backup policy and associating to a PostgreSQL resource for type "single server" - found here

Azure also supports the ability to create a policy/apply to resource for "flexible server" - Microsoft documentation

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

azurerm_data_protection_backup_policy_postgresql_flexible,azurerm_data_protection_backup_instance_postgresql_flexible

Potential Terraform Configuration

#Same config as single server - just targetting the different resource type

resource "azurerm_data_protection_backup_vault_flexible" "example" {
  name                = "example-backup-vault"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  datastore_type      = "VaultStore"
  redundancy          = "LocallyRedundant"
}

resource "azurerm_data_protection_backup_policy_postgresql" "example" {
  name                = "example-backup-policy"
  resource_group_name = azurerm_resource_group.example.name
  vault_name          = azurerm_data_protection_backup_vault.example.name

  backup_repeating_time_intervals = ["R/2021-05-23T02:30:00+00:00/P1W"]
  time_zone                       = "India Standard Time"
  default_retention_duration      = "P4M"

  retention_rule {
    name     = "weekly"
    duration = "P6M"
    priority = 20
    criteria {
      absolute_criteria = "FirstOfWeek"
    }
  }

  retention_rule {
    name     = "thursday"
    duration = "P1W"
    priority = 25
    criteria {
      days_of_week           = ["Thursday"]
      scheduled_backup_times = ["2021-05-23T02:30:00Z"]
    }
  }

  retention_rule {
    name     = "monthly"
    duration = "P1D"
    priority = 15
    criteria {
      weeks_of_month         = ["First", "Last"]
      days_of_week           = ["Tuesday"]
      scheduled_backup_times = ["2021-05-23T02:30:00Z"]
    }
  }
}

resource "azurerm_data_protection_backup_instance_postgresql_flexible" "example" {
  name                                    = "example"
  location                                = azurerm_resource_group.example.location
  vault_id                                = azurerm_data_protection_backup_vault.example.id
  database_id                             = azurerm_postgresql_flexible_server_database.example.id
  backup_policy_id                        = azurerm_data_protection_backup_policy_postgresql_flexible.example.id
  database_credential_key_vault_secret_id = azurerm_key_vault_secret.example.versionless_id
}

References

No response

@mybayern1974
Copy link
Collaborator

Thank @ryanjcanning for filing this issue. With assuming this issue is duplicate with another one, I'm closing this issue and suggest to subscribe to the latter. Or let me know if you have further questions. Thanks.

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

3 participants