Skip to content

Commit 79981fe

Browse files
committed
Add VM disk daily snapshot policy
1 parent ced4bb1 commit 79981fe

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

mithril-infra/main.vm.tf

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
terraform {
22
required_providers {
33
google = {
4-
source = "hashicorp/google"
5-
version = "3.5.0"
4+
source = "hashicorp/google"
65
}
76
}
87
}
@@ -50,3 +49,21 @@ resource "google_compute_address" "mithril-external-address" {
5049
name = "${local.environment_name}-ip"
5150
}
5251

52+
resource "google_compute_resource_policy" "policy" {
53+
name = "${local.environment_name}-policy"
54+
region = var.google_region
55+
snapshot_schedule_policy {
56+
schedule {
57+
daily_schedule {
58+
days_in_cycle = 1
59+
start_time = "04:00"
60+
}
61+
}
62+
}
63+
}
64+
65+
resource "google_compute_disk_resource_policy_attachment" "attachment" {
66+
name = google_compute_resource_policy.policy.name
67+
disk = google_compute_instance.vm_instance.name
68+
zone = var.google_zone
69+
}

0 commit comments

Comments
 (0)