forked from terraform-google-modules/docs-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
42 lines (34 loc) · 1 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
resource "google_alloydb_cluster" "primary" {
cluster_id = "alloydb-primary-cluster-${local.name_suffix}"
location = "us-central1"
network_config {
network = data.google_compute_network.default.id
}
}
resource "google_alloydb_instance" "primary" {
cluster = google_alloydb_cluster.primary.name
instance_id = "alloydb-primary-instance-${local.name_suffix}"
instance_type = "PRIMARY"
machine_config {
cpu_count = 2
}
}
resource "google_alloydb_cluster" "secondary" {
cluster_id = "alloydb-secondary-cluster-${local.name_suffix}"
location = "us-east1"
network_config {
network = data.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" {}
data "google_compute_network" "default" {
name = "alloydb-network-${local.name_suffix}"
}