Skip to content

kasna-cloud/terraform-google-snapshot-policy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

terraform-google-snapshot-policy

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.

Scheduling Snapshots

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_cycle value.
  • If you opt for a weekly schedule, you must also provide a day value. e.g. "MONDAY"

Requirements

Name Version
terraform >=1.1.0

Providers

Name Version
google n/a

Resources

Name Type
google_compute_disk_resource_policy_attachment.attachment resource
google_compute_resource_policy.main resource
google_project_service.compute resource

Inputs

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({
hourly_schedule = optional(object({
hours_in_cycle = number,
start_time = string
}))
daily_schedule = optional(object({
start_time = string
}))
weekly_schedule = optional(object({
day = string
start_time = string
}))
})
n/a yes
storage_locations Cloud Storage bucket location to store the auto snapshot (regional or multi-regional) list(string)
[
"us"
]
no
tags Tags to attach to the resources list(string) null no
zone Name of zone. Defaults to the Provider zone string null no

Outputs

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

About

This Terraform Module helps to create a snapshot policy and attach it to one or more persistent disks

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages