forked from GoogleCloudPlatform/magic-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cross-region replication support to AlloyDB (GoogleCloudPlatform#…
…9012) Co-authored-by: Riley Karson <[email protected]> Co-authored-by: Shubham Sahu <[email protected]>
- Loading branch information
1 parent
bb7db4f
commit 79d5d56
Showing
4 changed files
with
949 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
54 changes: 54 additions & 0 deletions
54
mmv1/templates/terraform/examples/alloydb_secondary_cluster_basic.tf.erb
This file contains 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,54 @@ | ||
resource "google_alloydb_cluster" "primary" { | ||
cluster_id = "<%= ctx[:vars]['alloydb_primary_cluster_name'] %>" | ||
location = "us-central1" | ||
network = google_compute_network.default.id | ||
} | ||
|
||
resource "google_alloydb_instance" "primary" { | ||
cluster = google_alloydb_cluster.primary.name | ||
instance_id = "<%= ctx[:vars]['alloydb_primary_instance_name'] %>" | ||
instance_type = "PRIMARY" | ||
|
||
machine_config { | ||
cpu_count = 2 | ||
} | ||
|
||
depends_on = [google_service_networking_connection.vpc_connection] | ||
} | ||
|
||
resource "google_alloydb_cluster" "<%= ctx[:primary_resource_id] %>" { | ||
cluster_id = "<%= ctx[:vars]['alloydb_secondary_cluster_name'] %>" | ||
location = "us-east1" | ||
network = google_compute_network.default.id | ||
cluster_type = "SECONDARY" | ||
|
||
continuous_backup_config { | ||
enabled = false | ||
} | ||
|
||
secondary_config { | ||
primary_cluster_name = google_alloydb_cluster.primary.name | ||
} | ||
|
||
depends_on = [google_alloydb_instance.primary] | ||
} | ||
|
||
data "google_project" "project" {} | ||
|
||
resource "google_compute_network" "default" { | ||
name = "<%= ctx[:vars]['alloydb_secondary_cluster_name'] %>" | ||
} | ||
|
||
resource "google_compute_global_address" "private_ip_alloc" { | ||
name = "<%= ctx[:vars]['alloydb_secondary_cluster_name'] %>" | ||
address_type = "INTERNAL" | ||
purpose = "VPC_PEERING" | ||
prefix_length = 16 | ||
network = google_compute_network.default.id | ||
} | ||
|
||
resource "google_service_networking_connection" "vpc_connection" { | ||
network = google_compute_network.default.id | ||
service = "servicenetworking.googleapis.com" | ||
reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name] | ||
} |
This file contains 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.