@@ -53,6 +53,12 @@ resource "google_compute_instance" "default" {
5353 }
5454}
5555
56+ resource "google_compute_disk" "default" {
57+ name = " disk-data"
58+ type = " pd-standard"
59+ zone = " us-central1-a"
60+ }
61+
5662resource "google_backup_dr_backup_vault" "default" {
5763 provider = google- beta
5864 location = " us-central1"
@@ -99,6 +105,30 @@ resource "google_backup_dr_backup_plan" "default" {
99105 }
100106}
101107
108+ resource "google_backup_dr_backup_plan" "disk_default" {
109+ provider = google- beta
110+ location = " us-central1"
111+ backup_plan_id = " my-disk-bp"
112+ resource_type = " compute.googleapis.com/Disk"
113+ backup_vault = google_backup_dr_backup_vault. default . name
114+
115+ backup_rules {
116+ rule_id = " rule-1"
117+ backup_retention_days = 5
118+
119+ standard_schedule {
120+ recurrence_type = " HOURLY"
121+ hourly_frequency = 1
122+ time_zone = " UTC"
123+
124+ backup_window {
125+ start_hour_of_day = 0
126+ end_hour_of_day = 6
127+ }
128+ }
129+ }
130+ }
131+
102132# [START backupdr_create_backupplanassociation]
103133
104134# Before creating a backup plan association, you need to create backup plan (google_backup_dr_backup_plan)
@@ -113,3 +143,18 @@ resource "google_backup_dr_backup_plan_association" "default" {
113143}
114144
115145# [END backupdr_create_backupplanassociation]
146+
147+ # [START backupdr_create_backupplanassociation_disk]
148+
149+ # Before creating a backup plan association, you need to create backup plan (google_backup_dr_backup_plan)
150+ # and compute disk (google_compute_disk or google_compute_region_disk).
151+ resource "google_backup_dr_backup_plan_association" "disk_association" {
152+ provider = google- beta
153+ location = " us-central1"
154+ backup_plan_association_id = " my-disk-bpa"
155+ resource = google_compute_disk. default . id
156+ resource_type = " compute.googleapis.com/Disk"
157+ backup_plan = google_backup_dr_backup_plan. disk_default . name
158+ }
159+
160+ # [END backupdr_create_backupplanassociation_disk]
0 commit comments