blob: d6e9dcde8f16187c5051e280028b685b1d364b08 [file] [log] [blame]
---
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in
# .github/CONTRIBUTING.md.
#
# ----------------------------------------------------------------------------
subcategory: "Firestore"
description: |-
A backup schedule for a Cloud Firestore Database.
---
# google\_firestore\_backup\_schedule
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:
* [API documentation](https://cloud.google.com/firestore/docs/reference/rest/v1/projects.databases.backupSchedules)
* How-to Guides
* [Official Documentation](https://cloud.google.com/firestore/docs/backups)
~> **Warning:** This resource creates a Firestore Backup Schedule on a project that already has
a 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.
## Example Usage - Firestore Backup Schedule Daily
```hcl
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 = "604800s" // 7 days (maximum possible value for daily backups)
daily_recurrence {}
}
```
## Example Usage - Firestore Backup Schedule Weekly
```hcl
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 value for weekly backups)
weekly_recurrence {
day = "SUNDAY"
}
}
```
## Argument Reference
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".
For a daily backup recurrence, set this to a value up to 7 days. If you set a weekly backup recurrence, set this to a value up to 14 weeks.
- - -
* `daily_recurrence` -
(Optional)
For a schedule that runs daily at a specified time.
* `weekly_recurrence` -
(Optional)
For a schedule that runs weekly on a specific day and time.
Structure is [documented below](#nested_weekly_recurrence).
* `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.
<a name="nested_weekly_recurrence"></a>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`.
## Attributes Reference
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}}`
## Timeouts
This resource provides the following
[Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options:
- `create` - Default is 20 minutes.
- `update` - Default is 20 minutes.
- `delete` - Default is 20 minutes.
## Import
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](https://developer.hashicorp.com/terraform/language/import) to import BackupSchedule using one of the formats above. For example:
```tf
import {
id = "projects/{{project}}/databases/{{database}}/backupSchedules/{{name}}"
to = google_firestore_backup_schedule.default
}
```
When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), 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}}
```
## User Project Overrides
This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override).