This Terraform Module creates and attaches a Snapshot Policy to Zonal Persistent Disks.
This Terraform module will do the following:
- Schedule snapshot
- Attach policy to a resource
After configuration is completed by Terraform, you will be able to configure your server for backups and restores.
A snapshot schedule can be configured to operate daily, weekly, or every Nth hour.
To configure a snapshot schedule, fill in the corresponding start_time of the desired schedule type.
- If you opt for an hourly schedule, you must also provide an
hours_in_cyclevalue. - If you opt for a weekly schedule, you must also provide a
dayvalue. e.g."MONDAY"
| Name | Version |
|---|---|
| terraform | >=1.1.0 |
| Name | Version |
|---|---|
| n/a |
| Name | Type |
|---|---|
| google_compute_disk_resource_policy_attachment.attachment | resource |
| google_compute_resource_policy.main | resource |
| google_project_service.compute | resource |
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| disks | Disks to attach the policy to | set(string) |
n/a | yes |
| guest_flush | Whether to perform a 'guest aware' snapshot. | bool |
true |
no |
| labels | A set of key/value label pairs to assign to the resources | map(string) |
null |
no |
| max_retention_days | Maximum age of the snapshot that is allowed to be kept in days | number |
10 |
no |
| on_source_disk_delete | (Optional) Specifies the behavior to apply to scheduled snapshots when the source disk is deleted. Possible values are: KEEP_AUTO_SNAPSHOTS, APPLY_RETENTION_POLICY | string |
"KEEP_AUTO_SNAPSHOTS" |
no |
| policy_name | Unique name for the backup policy | string |
n/a | yes |
| project_id | The ID of the project in which to provision resources. | string |
null |
no |
| region | Name of region. Defaults to the Provider region | string |
null |
no |
| schedule | Available backup options to execute every Nth hour, day or day of week. | object({ |
n/a | yes |
| storage_locations | Cloud Storage bucket location to store the auto snapshot (regional or multi-regional) | list(string) |
[ |
no |
| tags | Tags to attach to the resources | list(string) |
null |
no |
| zone | Name of zone. Defaults to the Provider zone | string |
null |
no |
| Name | Description |
|---|---|
| snapshot_policy_id | ID of the google_compute_resource_policy resource |
| snapshot_policy_self_link | Self link of the google_compute_resource_policy resource |