@@ -53,6 +53,13 @@ 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-west1-a"
60+ size = " 5"
61+ }
62+
5663resource "google_backup_dr_backup_vault" "default" {
5764 provider = google- beta
5865 location = " us-central1"
@@ -99,6 +106,30 @@ resource "google_backup_dr_backup_plan" "default" {
99106 }
100107}
101108
109+ resource "google_backup_dr_backup_plan" "disk_default" {
110+ provider = google- beta
111+ location = " us-central1"
112+ backup_plan_id = " my-disk-bp"
113+ resource_type = " compute.googleapis.com/Disk"
114+ backup_vault = google_backup_dr_backup_vault. default . name
115+
116+ backup_rules {
117+ rule_id = " rule-1"
118+ backup_retention_days = 5
119+
120+ standard_schedule {
121+ recurrence_type = " HOURLY"
122+ hourly_frequency = 1
123+ time_zone = " UTC"
124+
125+ backup_window {
126+ start_hour_of_day = 0
127+ end_hour_of_day = 6
128+ }
129+ }
130+ }
131+ }
132+
102133# [START backupdr_create_backupplanassociation]
103134
104135# Before creating a backup plan association, you need to create backup plan (google_backup_dr_backup_plan)
@@ -113,3 +144,18 @@ resource "google_backup_dr_backup_plan_association" "default" {
113144}
114145
115146# [END backupdr_create_backupplanassociation]
147+
148+ # [START backupdr_create_backupplanassociation_disk]
149+
150+ # Before creating a backup plan association, you need to create backup plan (google_backup_dr_backup_plan)
151+ # and compute disk (google_compute_disk or google_compute_region_disk).
152+ resource "google_backup_dr_backup_plan_association" "default" {
153+ provider = google- beta
154+ location = " us-central1"
155+ backup_plan_association_id = " my-disk-bpa"
156+ resource = google_compute_disk. default . id
157+ resource_type = " compute.googleapis.com/Disk"
158+ backup_plan = google_backup_dr_backup_plan. disk_default . name
159+ }
160+
161+ # [END backupdr_create_backupplanassociation_disk]
0 commit comments