blob: 7bfbf2bcfaabe738f89eb45ca0eb897457466638 [file] [log] [blame] [edit]
---
# ----------------------------------------------------------------------------
#
# *** 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: |-
NetApp Volumes supports volume backups, which are copies of your volumes
stored independently from the volume.
---
# google_netapp_backup
NetApp Volumes supports volume backups, which are copies of your volumes
stored independently from the volume. Backups are stored in backup vaults,
which are containers for backups. If a volume is lost or deleted, you can
use backups to restore your data to a new volume.
When you create the first backup of a volume, all of the volume's used
data is sent to the backup vault. Subsequent backups of the same volume
only include data that has changed from the previous backup. This allows
for fast incremental-forever backups and reduces the required capacity
inside the backup vault.
You can create manual and scheduled backups. Manual backups can be taken
from a volume or from an existing volume snapshot. Scheduled backups
require a backup policy.
To get more information about Backup, see:
* [API documentation](https://cloud.google.com/netapp/volumes/docs/reference/rest/v1/projects.locations.backupVaults.backups)
* How-to Guides
* [Documentation](https://cloud.google.com/netapp/volumes/docs/protect-data/about-volume-backups)
<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_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md&cloudshell_working_dir=netapp_backup&open_in_editor=main.tf" 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
```hcl
data "google_compute_network" "default" {
name = ""
}
resource "google_netapp_storage_pool" "default" {
name = "backup-pool"
location = "us-central1"
service_level = "PREMIUM"
capacity_gib = "2048"
network = data.google_compute_network.default.id
}
resource "google_netapp_volume" "default" {
name = "backup-volume"
location = google_netapp_storage_pool.default.location
capacity_gib = "100"
share_name = "backup-volume"
storage_pool = google_netapp_storage_pool.default.name
protocols = ["NFSV3"]
deletion_policy = "FORCE"
backup_config {
backup_vault = google_netapp_backup_vault.default.id
}
}
resource "google_netapp_backup_vault" "default" {
name = "backup-vault"
location = google_netapp_storage_pool.default.location
}
resource "google_netapp_backup" "test_backup" {
name = "test-backup"
location = google_netapp_backup_vault.default.location
vault_name = google_netapp_backup_vault.default.name
source_volume = google_netapp_volume.default.id
}
```
## Argument Reference
The following arguments are supported:
* `location` -
(Required)
Location of the backup.
* `vault_name` -
(Required)
Name of the backup vault to store the backup in.
* `name` -
(Required)
The resource name of the backup. Needs to be unique per location.
- - -
* `description` -
(Optional)
A description of the backup with 2048 characters or less. Requests with longer descriptions will be rejected.
* `source_volume` -
(Optional)
ID of volumes this backup belongs to. Format: `projects/{{projects_id}}/locations/{{location}}/volumes/{{name}}``
* `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.
* `source_snapshot` -
(Optional)
If specified, backup will be created from the given snapshot. If not specified,
there will be a new snapshot taken to initiate the backup creation.
Format: `projects/{{projectId}}/locations/{{location}}/volumes/{{volumename}}/snapshots/{{snapshotname}}``
* `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}}/backupVaults/{{vault_name}}/backups/{{name}}`
* `state` -
The state of the Backup Vault. Possible Values : [STATE_UNSPECIFIED, CREATING, UPLOADING, READY, DELETING, ERROR, UPDATING]
* `volume_usage_bytes` -
Size of the file system when the backup was created. When creating a new volume from the backup, the volume capacity will have to be at least as big.
* `backup_type` -
Type of backup, manually created or created by a backup policy. Possible Values : [TYPE_UNSPECIFIED, MANUAL, SCHEDULED]
* `create_time` -
Create time of the backup. A timestamp in RFC3339 UTC "Zulu" format. Examples: "2023-06-22T09:13:01.617Z".
* `chain_storage_bytes` -
Backups of a volume build incrementally on top of each other. They form a "backup chain".
Total size of all backups in a chain in bytes = baseline backup size + sum(incremental backup size)
* `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
Backup can be imported using any of these accepted formats:
* `projects/{{project}}/locations/{{location}}/backupVaults/{{vault_name}}/backups/{{name}}`
* `{{project}}/{{location}}/{{vault_name}}/{{name}}`
* `{{location}}/{{vault_name}}/{{name}}`
In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import Backup using one of the formats above. For example:
```tf
import {
id = "projects/{{project}}/locations/{{location}}/backupVaults/{{vault_name}}/backups/{{name}}"
to = google_netapp_backup.default
}
```
When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), Backup can be imported using one of the formats above. For example:
```
$ terraform import google_netapp_backup.default projects/{{project}}/locations/{{location}}/backupVaults/{{vault_name}}/backups/{{name}}
$ terraform import google_netapp_backup.default {{project}}/{{location}}/{{vault_name}}/{{name}}
$ terraform import google_netapp_backup.default {{location}}/{{vault_name}}/{{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).