Skip to content

Custom workspace backup policies #5016

Description

@JC-wk

Is your feature request related to a problem? Please describe.
Backup policies in the base workspace are currently hard coded and non-configurable.

Describe the solution you'd like
I'd like to have the option to define custom backup policies when deploying a workspace.

Describe alternatives you've considered
Modifying the template to add more backup policies and a drop down to select them.
A separate file defining custom backup policies that could be read by the terraform

Additional context
templates/workspaces/base/terraform/backup/backup.tf

resource "azurerm_backup_policy_vm" "vm_policy" {
  name                = local.vm_backup_policy_name
  resource_group_name = var.resource_group_name
  recovery_vault_name = azurerm_recovery_services_vault.vault.name


  timezone = "UTC"

  backup {
    frequency = "Daily"
    time      = "22:00"
  }

  retention_daily {
    count = 14
  }

  retention_weekly {
    count    = 4
    weekdays = ["Sunday"]
  }

  retention_monthly {
    count    = 12
    weekdays = ["Monday"]
    weeks    = ["First"]
  }

  retention_yearly {
    count    = 2
    months   = ["December"]
    weekdays = ["Sunday"]
    weeks    = ["Last"]
  }

  depends_on = [
    azurerm_recovery_services_vault.vault
  ]


}

resource "azurerm_backup_policy_file_share" "file_share_policy" {
  name                = local.fs_backup_policy_name
  resource_group_name = var.resource_group_name
  recovery_vault_name = azurerm_recovery_services_vault.vault.name

  timezone = "UTC"

  backup {
    frequency = "Daily"
    time      = "23:00"
  }

  retention_daily {
    count = 14
  }

  retention_weekly {
    count    = 4
    weekdays = ["Sunday"]
  }

  retention_monthly {
    count    = 12
    weekdays = ["Monday"]
    weeks    = ["First"]
  }

  retention_yearly {
    count    = 2
    months   = ["December"]
    weekdays = ["Sunday"]
    weeks    = ["Last"]
  }

  depends_on = [
    azurerm_recovery_services_vault.vault
  ]

}

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions