1515*/
1616
1717resource "google_service_account" "default" {
18- provider = google- beta
18+ provider = google- beta
1919 account_id = " tf-test-my-custom-1"
2020 display_name = " Custom SA for VM Instance"
2121}
2222
2323resource "google_compute_instance" "default" {
24- provider = google- beta
24+ provider = google- beta
2525 name = " tf-test-compute-instance-1"
2626 machine_type = " n2-standard-2"
2727 zone = " us-central1-a"
28- tags = [" foo" , " bar" ]
28+ tags = [" foo" , " bar" ]
29+
2930 boot_disk {
3031 initialize_params {
3132 image = " debian-cloud/debian-11"
@@ -34,56 +35,63 @@ resource "google_compute_instance" "default" {
3435 }
3536 }
3637 }
38+
3739 // Local SSD disk
3840 scratch_disk {
3941 interface = " NVME"
4042 }
43+
4144 network_interface {
4245 network = " default"
4346 access_config {
4447 // Ephemeral public IP
4548 }
4649 }
50+
4751 service_account {
4852 # Google recommends custom service accounts that have cloud-platform scope and permissions granted via IAM Roles.
4953 email = google_service_account. default . email
5054 scopes = [" cloud-platform" ]
5155 }
5256}
57+
5358resource "google_backup_dr_backup_vault" "default" {
54- provider = google- beta
55- location = " us-central1"
56- backup_vault_id = " tf-test-bv-1"
57- description = " This is a second backup vault built by Terraform."
58- backup_minimum_enforced_retention_duration = " 100000s"
59- labels = {
60- foo = " bar1"
61- bar = " baz1"
62- }
63- annotations = {
64- annotations1 = " bar1"
65- annotations2 = " baz1"
66- }
67- force_update = " true"
68- force_delete = " true"
69- allow_missing = " true"
59+ provider = google- beta
60+ location = " us-central1"
61+ backup_vault_id = " tf-test-bv-1"
62+ description = " This is a second backup vault built by Terraform."
63+ backup_minimum_enforced_retention_duration = " 100000s"
64+
65+ labels = {
66+ foo = " bar1"
67+ bar = " baz1"
68+ }
69+
70+ annotations = {
71+ annotations1 = " bar1"
72+ annotations2 = " baz1"
73+ }
74+
75+ force_update = " true"
76+ force_delete = " true"
77+ allow_missing = " true"
7078}
7179
7280resource "google_backup_dr_backup_plan" "default" {
73- provider = google- beta
74- location = " us-central1"
75- backup_plan_id = " tf-test-bp-test-1"
76- resource_type = " compute.googleapis.com/Instance"
77- backup_vault = google_backup_dr_backup_vault. default . name
81+ provider = google- beta
82+ location = " us-central1"
83+ backup_plan_id = " tf-test-bp-test-1"
84+ resource_type = " compute.googleapis.com/Instance"
85+ backup_vault = google_backup_dr_backup_vault. default . name
7886
7987 backup_rules {
80- rule_id = " rule-1"
81- backup_retention_days = 2
88+ rule_id = " rule-1"
89+ backup_retention_days = 2
8290
8391 standard_schedule {
84- recurrence_type = " HOURLY"
85- hourly_frequency = 6
86- time_zone = " UTC"
92+ recurrence_type = " HOURLY"
93+ hourly_frequency = 6
94+ time_zone = " UTC"
8795
8896 backup_window {
8997 start_hour_of_day = 12
@@ -95,14 +103,15 @@ resource "google_backup_dr_backup_plan" "default" {
95103
96104# [START backupdr_create_backupplanassociation]
97105
98- // Before creating a backup plan association, you need to create backup plan(google_backup_dr_backup_plan)
99- // and compute instance (google_compute_instance).
100- resource "google_backup_dr_backup_plan_association" "default" {
101- provider = google- beta
102- location = " us-central1"
106+ # Before creating a backup plan association, you need to create backup plan (google_backup_dr_backup_plan)
107+ # and compute instance (google_compute_instance).
108+ resource "google_backup_dr_backup_plan_association" "default" {
109+ provider = google- beta
110+ location = " us-central1"
103111 backup_plan_association_id = " tf-test-bpa-test"
104- resource = google_compute_instance. default . id
105- resource_type = " compute.googleapis.com/Instance"
106- backup_plan = google_backup_dr_backup_plan. default . name
112+ resource = google_compute_instance. default . id
113+ resource_type = " compute.googleapis.com/Instance"
114+ backup_plan = google_backup_dr_backup_plan. default . name
107115}
116+
108117# [END backupdr_create_backupplanassociation]
0 commit comments