From f52ae669cdf66f5ba4f9a92bdf60377c6446c69e Mon Sep 17 00:00:00 2001 From: ujjwal ranjan Date: Thu, 28 Nov 2024 20:04:25 +0000 Subject: [PATCH 1/4] Added terraform-doc-sample for Async PD --- compute/disk_async_replication/main.tf | 50 ++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 compute/disk_async_replication/main.tf diff --git a/compute/disk_async_replication/main.tf b/compute/disk_async_replication/main.tf new file mode 100644 index 00000000..6c1f3d2a --- /dev/null +++ b/compute/disk_async_replication/main.tf @@ -0,0 +1,50 @@ +/** + * Copyright 2022 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 primary_disk_setup_for_async_replication] +resource "google_compute_disk" "primary-disk" { + name = "primary-disk" + type = "pd-ssd" + zone = "europe-west4-a" + + physical_block_size_bytes = 4096 +} +# [END primary_disk_setup_for_async_replication] + +# [START secondary_disk_setup_for_async_replication] +resource "google_compute_disk" "secondary-disk" { + name = "secondary-disk" + type = "pd-ssd" + zone = "europe-west3-a" + + async_primary_disk { + disk = google_compute_disk.primary-disk.id + } + + physical_block_size_bytes = 4096 +} +# [END secondary_disk_setup_for_async_replication] + +/* +# [START setup_to_start_asynchronous_replication] +resource "google_compute_disk_async_replication" "replication" { + primary_disk = google_compute_disk.primary-disk.id + secondary_disk { + disk = google_compute_disk.secondary-disk.id + } +} +# [END setup_to_start_asynchronous_replication]*/ + From 25b102cea382df16f31616bf77be44246198eb1c Mon Sep 17 00:00:00 2001 From: ujjwal ranjan Date: Thu, 28 Nov 2024 20:19:01 +0000 Subject: [PATCH 2/4] added async replication --- compute/disk_async_replication/main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compute/disk_async_replication/main.tf b/compute/disk_async_replication/main.tf index 6c1f3d2a..bad3a5da 100644 --- a/compute/disk_async_replication/main.tf +++ b/compute/disk_async_replication/main.tf @@ -38,7 +38,7 @@ resource "google_compute_disk" "secondary-disk" { } # [END secondary_disk_setup_for_async_replication] -/* + # [START setup_to_start_asynchronous_replication] resource "google_compute_disk_async_replication" "replication" { primary_disk = google_compute_disk.primary-disk.id @@ -46,5 +46,5 @@ resource "google_compute_disk_async_replication" "replication" { disk = google_compute_disk.secondary-disk.id } } -# [END setup_to_start_asynchronous_replication]*/ +# [END setup_to_start_asynchronous_replication] From badba540c539b05f987649da10884492471d06f4 Mon Sep 17 00:00:00 2001 From: ujjwal ranjan Date: Tue, 3 Dec 2024 09:23:34 +0000 Subject: [PATCH 3/4] added parent tag --- compute/disk_async_replication/main.tf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compute/disk_async_replication/main.tf b/compute/disk_async_replication/main.tf index bad3a5da..078b05e7 100644 --- a/compute/disk_async_replication/main.tf +++ b/compute/disk_async_replication/main.tf @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + +# [START compute_disk_async_replication_parent_tag] # [START primary_disk_setup_for_async_replication] resource "google_compute_disk" "primary-disk" { name = "primary-disk" @@ -47,4 +48,4 @@ resource "google_compute_disk_async_replication" "replication" { } } # [END setup_to_start_asynchronous_replication] - +# [END compute_disk_async_replication_parent_tag] From c65ef12df75b8de3a394947ddb314f153adc815b Mon Sep 17 00:00:00 2001 From: ujjwal ranjan Date: Wed, 4 Dec 2024 06:47:46 +0000 Subject: [PATCH 4/4] fixed the region violation comments --- compute/disk_async_replication/main.tf | 28 +++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/compute/disk_async_replication/main.tf b/compute/disk_async_replication/main.tf index 078b05e7..1e7ece84 100644 --- a/compute/disk_async_replication/main.tf +++ b/compute/disk_async_replication/main.tf @@ -1,5 +1,5 @@ /** - * Copyright 2022 Google LLC + * 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. @@ -13,39 +13,39 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + # [START compute_disk_async_replication_parent_tag] -# [START primary_disk_setup_for_async_replication] -resource "google_compute_disk" "primary-disk" { +# [START compute_disk_primary] +resource "google_compute_disk" "primary_disk" { name = "primary-disk" type = "pd-ssd" zone = "europe-west4-a" physical_block_size_bytes = 4096 } -# [END primary_disk_setup_for_async_replication] +# [END compute_disk_primary] -# [START secondary_disk_setup_for_async_replication] -resource "google_compute_disk" "secondary-disk" { +# [START compute_disk_secondary] +resource "google_compute_disk" "secondary_disk" { name = "secondary-disk" type = "pd-ssd" zone = "europe-west3-a" async_primary_disk { - disk = google_compute_disk.primary-disk.id + disk = google_compute_disk.primary_disk.id } physical_block_size_bytes = 4096 } -# [END secondary_disk_setup_for_async_replication] +# [END compute_disk_secondary] -# [START setup_to_start_asynchronous_replication] -resource "google_compute_disk_async_replication" "replication" { - primary_disk = google_compute_disk.primary-disk.id +# [START compute_disk_async_replication] +resource "google_compute_disk_async_replication" "default" { + primary_disk = google_compute_disk.primary_disk.id secondary_disk { - disk = google_compute_disk.secondary-disk.id + disk = google_compute_disk.secondary_disk.id } } -# [END setup_to_start_asynchronous_replication] +# [END compute_disk_async_replication] # [END compute_disk_async_replication_parent_tag]