blob: 26cf5d49d29ab04792a99ca982d1764f6a658587 [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: "Google Cloud NetApp Volumes"
description: |-
A backup policy is used to schedule backups at regular daily, weekly, or monthly intervals.
---
# google\_netapp\_backup\_policy
A backup policy is used to schedule backups at regular daily, weekly, or monthly intervals.
Backup policies allow you to attach a backup schedule to a volume.
The policy defines how many backups to retain at daily, weekly, or monthly intervals.
To get more information about backupPolicy, see:
* [API documentation](https://cloud.google.com/netapp/volumes/docs/reference/rest/v1/projects.locations.backupPolicies)
* How-to Guides
* [Documentation](https://cloud.google.com/netapp/volumes/docs/protect-data/about-volume-backups#about_backup_policies)
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=netapp_backup_policy_full&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
</a>
</div>
## Example Usage - Netapp Backup Policy Full
```hcl
resource "google_netapp_backup_policy" "test_backup_policy_full" {
name = "test-backup-policy-full"
location = "us-central1"
daily_backup_limit = 2
weekly_backup_limit = 1
monthly_backup_limit = 1
description = "TF test backup schedule"
enabled = true
labels = {
"foo" = "bar"
}
}
```
## Argument Reference
The following arguments are supported:
* `daily_backup_limit` -
(Required)
Number of daily backups to keep. Note that the minimum daily backup limit is 2.
* `weekly_backup_limit` -
(Required)
Number of weekly backups to keep. Note that the sum of daily, weekly and monthly backups should be greater than 1.
* `monthly_backup_limit` -
(Required)
Number of monthly backups to keep. Note that the sum of daily, weekly and monthly backups should be greater than 1.
* `location` -
(Required)
Name of the region for the policy to apply to.
* `name` -
(Required)
The name of the backup policy. Needs to be unique per location.
- - -
* `labels` -
(Optional)
Labels as key value pairs. Example: `{ "owner": "Bob", "department": "finance", "purpose": "testing" }`.
**Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
Please refer to the field `effective_labels` for all of the labels present on the resource.
* `description` -
(Optional)
An optional description of this resource.
* `enabled` -
(Optional)
If enabled, make backups automatically according to the schedules.
This will be applied to all volumes that have this policy attached and enforced on volume level.
* `project` - (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
## 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}}/locations/{{location}}/backupPolicies/{{name}}`
* `create_time` -
Create time of the backup policy. A timestamp in RFC3339 UTC "Zulu" format. Examples: "2023-06-22T09:13:01.617Z".
* `state` -
The state of the backup policy.
* `assigned_volume_count` -
The total number of volumes assigned by this backup policy.
* `terraform_labels` -
The combination of labels configured directly on the resource
and default labels configured on the provider.
* `effective_labels` -
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services.
## 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
backupPolicy can be imported using any of these accepted formats:
* `projects/{{project}}/locations/{{location}}/backupPolicies/{{name}}`
* `{{project}}/{{location}}/{{name}}`
* `{{location}}/{{name}}`
In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import backupPolicy using one of the formats above. For example:
```tf
import {
id = "projects/{{project}}/locations/{{location}}/backupPolicies/{{name}}"
to = google_netapp_backup_policy.default
}
```
When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), backupPolicy can be imported using one of the formats above. For example:
```
$ terraform import google_netapp_backup_policy.default projects/{{project}}/locations/{{location}}/backupPolicies/{{name}}
$ terraform import google_netapp_backup_policy.default {{project}}/{{location}}/{{name}}
$ terraform import google_netapp_backup_policy.default {{location}}/{{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).