Terraform provider reference / resources / server_backup_policy

fiberax_server_backup_policy (Resource)

Backup policy of a server. ONE resource per server.

The switch and the schedule are one thing. enabled means both that backups are taken and that they are billed: you pay for having a live schedule, not for the number of backups taken.

Switching off does not lose your settings - the schedule is switched off, not deleted, and the days and the hour are kept until the next time you switch it on. Backups already taken are not deleted either, and keeping them is not billed separately.

The resource has no create and no delete: a server always has a policy. Destroying the resource DOES NOT TOUCH the platform - backups keep being taken and keep being billed.

A side effect worth knowing. Any write of the policy PINS the server to a preference of its own, and from that moment the project-level default no longer touches it: a project-wide switch of backups skips such a server. There is no way to put it back under the shared default through the API - you can only describe it explicitly here.

Example Usage

# The backup policy. ONE resource per server.
#
# enabled is money: you pay for having a schedule in force, not for the number of
# backups taken.
resource "fiberax_server_backup_policy" "app" {
  server_id = fiberax_server.app.id
  enabled   = true

  days   = ["mon", "wed", "fri"]
  hour   = 3
  minute = 30
}

# Several runs a day: 1 to 4 times, "HH:MM" with leading zeros, at least 120 minutes apart,
# in the platform's time zone (Europe/Warsaw). hour and minute then read the first of them;
# write either times or hour and minute, not both. For one run a day both forms work:
# times = ["03:00"] is the same as hour = 3, minute = 0.
resource "fiberax_server_backup_policy" "db" {
  server_id = fiberax_server.db.id
  enabled   = true

  times = ["03:00", "15:00"]
}

# Backups are off. The days and the hour are not lost - the schedule is switched off
# rather than deleted, and turning it back on brings them back.
resource "fiberax_server_backup_policy" "scratch" {
  server_id = fiberax_server.scratch.id
  enabled   = false
}

Schema

Required

Optional

A set, not a list: the order of the days means nothing. Omit it and the platform keeps the current days, and for a server with no schedule picks them itself.

With several times this is the hour of the first of them.

Set either times or hour and minute, not both. hour and minute are always the FIRST of the times, so for one time a day both forms describe the same schedule: times = ["03:00"] equals hour = 3 with minute = 0.

Removing times from the configuration does not fold the schedule back to one time: the server keeps all of its times. On a server with several times hour and minute may only repeat the first one; any other value is refused (backup_schedule_multiple_times) - write times instead.

Omit it and the platform keeps the current times, and for a new schedule picks a night time itself.

Read-Only

Import

Import is supported using the following syntax:

The terraform import command can be used, for example:

# The import ID is the server ID: a server has exactly one policy.
terraform import fiberax_server_backup_policy.app 10867

Generated from the provider schema for version 0.11.0. How to install the provider: Terraform provider.