Skip to content

Commit 1104314

Browse files
adding csql backup_plan
1 parent 2c3b839 commit 1104314

File tree

1 file changed

+26
-1
lines changed
  • backupdr/backup_plan_association

1 file changed

+26
-1
lines changed

backupdr/backup_plan_association/main.tf

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,31 @@ resource "google_backup_dr_backup_plan" "disk_default" {
147147
}
148148
}
149149

150+
resource "google_backup_dr_backup_plan" "csql_default" {
151+
provider = google-beta
152+
location = "us-central1"
153+
backup_plan_id = "my-csql-bp"
154+
resource_type = "sqladmin.googleapis.com/Instance"
155+
backup_vault = google_backup_dr_backup_vault.default.name
156+
log_retention_days = 2
157+
158+
backup_rules {
159+
rule_id = "rule-1"
160+
backup_retention_days = 5
161+
162+
standard_schedule {
163+
recurrence_type = "HOURLY"
164+
hourly_frequency = 1
165+
time_zone = "UTC"
166+
167+
backup_window {
168+
start_hour_of_day = 0
169+
end_hour_of_day = 6
170+
}
171+
}
172+
}
173+
}
174+
150175
# [START backupdr_create_backupplanassociation]
151176

152177
# Before creating a backup plan association, you need to create backup plan (google_backup_dr_backup_plan)
@@ -187,7 +212,7 @@ resource "google_backup_dr_backup_plan_association" "csql_association" {
187212
backup_plan_association_id = "my-csql-bpa"
188213
resource = "projects/${google_sql_database_instance.default.project}/instances/${google_sql_database_instance.default.name}"
189214
resource_type = "sqladmin.googleapis.com/Instance"
190-
backup_plan = google_backup_dr_backup_plan.default.name
215+
backup_plan = google_backup_dr_backup_plan.csql_default.name
191216
}
192217

193218
# [END backupdr_create_backupplanassociation_csql]

0 commit comments

Comments
 (0)