A backup schedule for a Cloud Firestore Database. This resource is owned by the database it is backing up, and is deleted along with the database. The actual backups are not though.
To get more information about BackupSchedule, see:
resource "google_firestore_database" "database" {
project = "my-project-name"
name = "database-id"
location_id = "nam5"
type = "FIRESTORE_NATIVE"
delete_protection_state = "DELETE_PROTECTION_ENABLED"
deletion_policy = "DELETE"
}
resource "google_firestore_backup_schedule" "daily-backup" {
project = "my-project-name"
database = google_firestore_database.database.name
retention = "8467200s" // 14 weeks (maximum possible retention)
daily_recurrence {}
}
resource "google_firestore_database" "database" {
project = "my-project-name"
name = "database-id"
location_id = "nam5"
type = "FIRESTORE_NATIVE"
delete_protection_state = "DELETE_PROTECTION_ENABLED"
deletion_policy = "DELETE"
}
resource "google_firestore_backup_schedule" "weekly-backup" {
project = "my-project-name"
database = google_firestore_database.database.name
retention = "8467200s" // 14 weeks (maximum possible retention)
weekly_recurrence {
day = "SUNDAY"
}
}
The following arguments are supported:
retention
-
(Required)
At what relative time in the future, compared to its creation time, the backup should be deleted, e.g. keep backups for 7 days.
A duration in seconds with up to nine fractional digits, ending with 's'. Example: "3.5s".
You can set this to a value up to 14 weeks.daily_recurrence
-
(Optional)
For a schedule that runs daily.
weekly_recurrence
-
(Optional)
For a schedule that runs weekly on a specific day.
Structure is documented below.
database
-
(Optional)
The Firestore database id. Defaults to "(default)"
.
project
- (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
The weekly_recurrence
block supports:
day
-
(Optional)
The day of week to run.
Possible values are: DAY_OF_WEEK_UNSPECIFIED
, MONDAY
, TUESDAY
, WEDNESDAY
, THURSDAY
, FRIDAY
, SATURDAY
, SUNDAY
.In addition to the arguments listed above, the following computed attributes are exported:
id
- an identifier for the resource with format projects/{{project}}/databases/{{database}}/backupSchedules/{{name}}
name
-
The unique backup schedule identifier across all locations and databases for the given project. Format:
projects/{{project}}/databases/{{database}}/backupSchedules/{{backupSchedule}}
This resource provides the following Timeouts configuration options:
create
- Default is 20 minutes.update
- Default is 20 minutes.delete
- Default is 20 minutes.BackupSchedule can be imported using any of these accepted formats:
projects/{{project}}/databases/{{database}}/backupSchedules/{{name}}
{{project}}/{{database}}/{{name}}
{{database}}/{{name}}
In Terraform v1.5.0 and later, use an import
block to import BackupSchedule using one of the formats above. For example:
import {
id = "projects/{{project}}/databases/{{database}}/backupSchedules/{{name}}"
to = google_firestore_backup_schedule.default
}
When using the terraform import
command, BackupSchedule can be imported using one of the formats above. For example:
$ terraform import google_firestore_backup_schedule.default projects/{{project}}/databases/{{database}}/backupSchedules/{{name}}
$ terraform import google_firestore_backup_schedule.default {{project}}/{{database}}/{{name}}
$ terraform import google_firestore_backup_schedule.default {{database}}/{{name}}
This resource supports User Project Overrides.