Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions backupdr/backup_plan/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,32 @@ resource "google_backup_dr_backup_plan" "default" {
}

# [END backupdr_create_backupplan]

# [START backupdr_create_backupplan_disk]

# Before creating a backup plan, you need to create backup vault (google_backup_dr_backup_vault).
resource "google_backup_dr_backup_plan" "disk_default" {
provider = google-beta
location = "us-central1"
backup_plan_id = "my-disk-bp"
resource_type = "compute.googleapis.com/Disk"
backup_vault = google_backup_dr_backup_vault.default.name

backup_rules {
rule_id = "rule-1"
backup_retention_days = 5

standard_schedule {
recurrence_type = "HOURLY"
hourly_frequency = 1
time_zone = "UTC"

backup_window {
start_hour_of_day = 0
end_hour_of_day = 6
}
}
}
}

# [END backupdr_create_backupplan_disk]
20 changes: 20 additions & 0 deletions backupdr/backup_plan/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: blueprints.cloud.google.com/v1alpha1
kind: BlueprintTest
metadata:
name: backupdr_backup_plan
spec:
skip: true
45 changes: 45 additions & 0 deletions backupdr/backup_plan_association/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ resource "google_compute_instance" "default" {
}
}

resource "google_compute_disk" "default" {
name = "disk-data"
type = "pd-standard"
zone = "us-central1-a"
}

resource "google_backup_dr_backup_vault" "default" {
provider = google-beta
location = "us-central1"
Expand Down Expand Up @@ -99,6 +105,30 @@ resource "google_backup_dr_backup_plan" "default" {
}
}

resource "google_backup_dr_backup_plan" "disk_default" {
provider = google-beta
location = "us-central1"
backup_plan_id = "my-disk-bp"
resource_type = "compute.googleapis.com/Disk"
backup_vault = google_backup_dr_backup_vault.default.name

backup_rules {
rule_id = "rule-1"
backup_retention_days = 5

standard_schedule {
recurrence_type = "HOURLY"
hourly_frequency = 1
time_zone = "UTC"

backup_window {
start_hour_of_day = 0
end_hour_of_day = 6
}
}
}
}

# [START backupdr_create_backupplanassociation]

# Before creating a backup plan association, you need to create backup plan (google_backup_dr_backup_plan)
Expand All @@ -113,3 +143,18 @@ resource "google_backup_dr_backup_plan_association" "default" {
}

# [END backupdr_create_backupplanassociation]

# [START backupdr_create_backupplanassociation_disk]

# Before creating a backup plan association, you need to create backup plan (google_backup_dr_backup_plan)
# and compute disk (google_compute_disk or google_compute_region_disk).
resource "google_backup_dr_backup_plan_association" "disk_association" {
provider = google-beta
location = "us-central1"
backup_plan_association_id = "my-disk-bpa"
resource = google_compute_disk.default.id
resource_type = "compute.googleapis.com/Disk"
backup_plan = google_backup_dr_backup_plan.disk_default.name
}

# [END backupdr_create_backupplanassociation_disk]
20 changes: 20 additions & 0 deletions backupdr/backup_plan_association/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: blueprints.cloud.google.com/v1alpha1
kind: BlueprintTest
metadata:
name: backupdr_backup_plan_association
spec:
skip: true