-
Notifications
You must be signed in to change notification settings - Fork 286
feat(terraform): add BV, BP, BPA resources to sample configurations #761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
glasnt
merged 29 commits into
terraform-google-modules:main
from
niharika-98:gcbdr-samples
Nov 21, 2024
Merged
Changes from 10 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
6d72e6d
Adding BV,BP,BPA resources to terraform samples
niharika-98 7a4c06c
Updating scripts
niharika-98 0861f25
Adding code owners and required api enablement
niharika-98 9e1ceea
Adding gcbdr team as code owners
niharika-98 a3eb6eb
Fixing code owners
niharika-98 b258a10
Fixing resource name to default
niharika-98 859aeb8
Fixing commit
niharika-98 de0fa63
Merge branch 'main' into gcbdr-samples
niharika-98 ed8c284
Fixing reviewers
niharika-98 6a027b1
Adding comment
niharika-98 6ce52a0
Fixing lint to codeowners
niharika-98 39393c7
Update gcbdr/backupvault/main.tf
niharika-98 0c7dd09
Update gcbdr/backupplanassociation/main.tf
niharika-98 aadf7be
Update gcbdr/backupplan/main.tf
niharika-98 8ca3519
FIxing lint for resources
niharika-98 25e8286
Fixing lint in BP and BPA resource files
niharika-98 9561661
Merge branch 'main' into gcbdr-samples
niharika-98 71ede18
Update code owners with gcbdr team
niharika-98 3791fbd
Fixing group name
niharika-98 e8f6405
Update gcbdr/backupvault/main.tf
niharika-98 49751f2
FIxing naming issues
niharika-98 755ab7b
changing backupdr to gcbdr
niharika-98 31c6293
Updating region tag
niharika-98 7879467
Updating folder name to backupdr
niharika-98 35e8005
Fixing code owners and description
niharika-98 12cf18c
Merge branch 'main' into gcbdr-samples
glasnt ba1f9ff
Fix labels for backup vault
niharika-98 1a04f7e
Update backupdr/backup_vault/main.tf
glasnt 9e59fc8
Fixing lint
niharika-98 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| /** | ||
niharika-98 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| * Copyright 2024 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. | ||
| */ | ||
| # [START backupdr_create_backupvault] | ||
|
|
||
| resource "google_backup_dr_backup_vault" "default" { | ||
| provider = google-beta | ||
| location ="us-central1" | ||
| backup_vault_id = "bv-1" | ||
| description = "This is a second backup vault built by Terraform." | ||
| backup_minimum_enforced_retention_duration = "100000s" | ||
| labels = { | ||
| foo = "bar1" | ||
| bar = "baz1" | ||
| } | ||
| annotations = { | ||
| annotations1 = "bar1" | ||
| annotations2 = "baz1" | ||
| } | ||
| force_update = "true" | ||
| force_delete = "true" | ||
| allow_missing = "true" | ||
| } | ||
| # [END backupdr_create_backupvault] | ||
|
|
||
| # [START backupdr_create_backupplan] | ||
|
|
||
| // Before creating a backup plan, you need to create backup vault(google_backup_dr_backup_vault). | ||
| resource "google_backup_dr_backup_plan" "default" { | ||
| provider = google-beta | ||
| location = "us-central1" | ||
| backup_plan_id = "bp-test" | ||
| resource_type= "compute.googleapis.com/Instance" | ||
| 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 = 6 | ||
| time_zone = "UTC" | ||
| backup_window{ | ||
| start_hour_of_day = 0 | ||
| end_hour_of_day = 24 | ||
| } | ||
| } | ||
| } | ||
| } | ||
| # [END backupdr_create_backupplan] | ||
niharika-98 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| /** | ||
| * Copyright 2024 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. | ||
| */ | ||
|
|
||
| resource "google_service_account" "default" { | ||
| provider = google-beta | ||
| account_id = "tf-test-my-custom-1" | ||
niharika-98 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| display_name = "Custom SA for VM Instance" | ||
| } | ||
|
|
||
| resource "google_compute_instance" "default" { | ||
| provider = google-beta | ||
| name = "tf-test-compute-instance-1" | ||
| machine_type = "n2-standard-2" | ||
| zone = "us-central1-a" | ||
| tags = ["foo", "bar"] | ||
| boot_disk { | ||
| initialize_params { | ||
| image = "debian-cloud/debian-11" | ||
| labels = { | ||
| my_label = "value" | ||
| } | ||
| } | ||
| } | ||
| // Local SSD disk | ||
| scratch_disk { | ||
| interface = "NVME" | ||
| } | ||
| network_interface { | ||
| network = "default" | ||
| access_config { | ||
| // Ephemeral public IP | ||
| } | ||
| } | ||
| service_account { | ||
| # Google recommends custom service accounts that have cloud-platform scope and permissions granted via IAM Roles. | ||
| email = google_service_account.default.email | ||
| scopes = ["cloud-platform"] | ||
| } | ||
| } | ||
| resource "google_backup_dr_backup_vault" "default" { | ||
| provider = google-beta | ||
| location ="us-central1" | ||
| backup_vault_id = "tf-test-bv-1" | ||
| description = "This is a second backup vault built by Terraform." | ||
| backup_minimum_enforced_retention_duration = "100000s" | ||
| labels = { | ||
| foo = "bar1" | ||
| bar = "baz1" | ||
| } | ||
| annotations = { | ||
| annotations1 = "bar1" | ||
| annotations2 = "baz1" | ||
| } | ||
| force_update = "true" | ||
| force_delete = "true" | ||
| allow_missing = "true" | ||
| } | ||
|
|
||
| resource "google_backup_dr_backup_plan" "default" { | ||
| provider = google-beta | ||
| location = "us-central1" | ||
| backup_plan_id = "tf-test-bp-test-1" | ||
| resource_type = "compute.googleapis.com/Instance" | ||
| backup_vault = google_backup_dr_backup_vault.default.name | ||
|
|
||
| backup_rules { | ||
| rule_id = "rule-1" | ||
| backup_retention_days = 2 | ||
|
|
||
| standard_schedule { | ||
| recurrence_type = "HOURLY" | ||
| hourly_frequency = 6 | ||
| time_zone = "UTC" | ||
|
|
||
| backup_window { | ||
| start_hour_of_day = 12 | ||
| end_hour_of_day = 18 | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| # [START backupdr_create_backupplanassociation] | ||
|
|
||
| // Before creating a backup plan association, you need to create backup plan(google_backup_dr_backup_plan) | ||
| // and compute instance (google_compute_instance). | ||
| resource "google_backup_dr_backup_plan_association" "default" { | ||
| provider = google-beta | ||
| location = "us-central1" | ||
| backup_plan_association_id = "tf-test-bpa-test" | ||
| resource = google_compute_instance.default.id | ||
| resource_type= "compute.googleapis.com/Instance" | ||
| backup_plan = google_backup_dr_backup_plan.default.name | ||
| } | ||
| # [END backupdr_create_backupplanassociation] | ||
niharika-98 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| /** | ||
| * Copyright 2024 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. | ||
| */ | ||
|
|
||
| # [START backupdr_create_backupvault] | ||
|
|
||
| resource "google_backup_dr_backup_vault" "default" { | ||
| provider = google-beta | ||
| location ="us-central1" | ||
| backup_vault_id = "bv-1" | ||
| description = "This is a second backup vault built by Terraform." | ||
| backup_minimum_enforced_retention_duration = "100000s" | ||
| labels = { | ||
| foo = "bar1" | ||
| bar = "baz1" | ||
| } | ||
| annotations = { | ||
| annotations1 = "bar1" | ||
| annotations2 = "baz1" | ||
| } | ||
| force_update = "true" | ||
| force_delete = "true" | ||
| allow_missing = "true" | ||
| } | ||
| # [END backupdr_create_backupvault] | ||
niharika-98 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.