File tree 3 files changed +100
-0
lines changed
templates/terraform/examples
3 files changed +100
-0
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,18 @@ examples:
65
65
primary_resource_id : ' default'
66
66
vars :
67
67
alloydb_cluster_name : ' alloydb-cluster'
68
+ - name : ' alloydb_cluster_before_upgrade'
69
+ primary_resource_id : ' default'
70
+ vars :
71
+ alloydb_cluster_name : ' alloydb-cluster'
72
+ alloydb_instance_name : ' alloydb-instance'
73
+ network_name : ' alloydb-network'
74
+ - name : ' alloydb_cluster_after_upgrade'
75
+ primary_resource_id : ' default'
76
+ vars :
77
+ alloydb_cluster_name : ' alloydb-cluster'
78
+ alloydb_instance_name : ' alloydb-instance'
79
+ network_name : ' alloydb-network'
68
80
- name : ' alloydb_cluster_full'
69
81
primary_resource_id : ' full'
70
82
vars :
Original file line number Diff line number Diff line change
1
+ resource "google_alloydb_instance" "{{$.PrimaryResourceId}}" {
2
+ cluster = google_alloydb_cluster.{{$.PrimaryResourceId}}.name
3
+ instance_id = "{{index $.Vars "alloydb_instance_name"}}"
4
+ instance_type = "PRIMARY"
5
+
6
+ machine_config {
7
+ cpu_count = 2
8
+ }
9
+
10
+ depends_on = [google_service_networking_connection.vpc_connection]
11
+ }
12
+
13
+ resource "google_alloydb_cluster" "{{$.PrimaryResourceId}}" {
14
+ cluster_id = "{{index $.Vars "alloydb_cluster_name"}}"
15
+ location = "us-central1"
16
+ network_config {
17
+ network = google_compute_network.default.id
18
+ }
19
+ database_version = "POSTGRES_15"
20
+
21
+ initial_user {
22
+ password = "{{index $.Vars "alloydb_cluster_name"}}"
23
+ }
24
+ }
25
+
26
+ data "google_project" "project" {}
27
+
28
+ resource "google_compute_network" "default" {
29
+ name = "{{index $.Vars "network_name"}}"
30
+ }
31
+
32
+ resource "google_compute_global_address" "private_ip_alloc" {
33
+ name = "{{index $.Vars "alloydb_cluster_name"}}"
34
+ address_type = "INTERNAL"
35
+ purpose = "VPC_PEERING"
36
+ prefix_length = 16
37
+ network = google_compute_network.default.id
38
+ }
39
+
40
+ resource "google_service_networking_connection" "vpc_connection" {
41
+ network = google_compute_network.default.id
42
+ service = "servicenetworking.googleapis.com"
43
+ reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name]
44
+ }
Original file line number Diff line number Diff line change
1
+ resource "google_alloydb_instance" "{{$.PrimaryResourceId}}" {
2
+ cluster = google_alloydb_cluster.{{$.PrimaryResourceId}}.name
3
+ instance_id = "{{index $.Vars "alloydb_instance_name"}}"
4
+ instance_type = "PRIMARY"
5
+
6
+ machine_config {
7
+ cpu_count = 2
8
+ }
9
+
10
+ depends_on = [google_service_networking_connection.vpc_connection]
11
+ }
12
+
13
+ resource "google_alloydb_cluster" "{{$.PrimaryResourceId}}" {
14
+ cluster_id = "{{index $.Vars "alloydb_cluster_name"}}"
15
+ location = "us-central1"
16
+ network_config {
17
+ network = google_compute_network.default.id
18
+ }
19
+ database_version = "POSTGRES_14"
20
+
21
+ initial_user {
22
+ password = "{{index $.Vars "alloydb_cluster_name"}}"
23
+ }
24
+ }
25
+
26
+ data "google_project" "project" {}
27
+
28
+ resource "google_compute_network" "default" {
29
+ name = "{{index $.Vars "network_name"}}"
30
+ }
31
+
32
+ resource "google_compute_global_address" "private_ip_alloc" {
33
+ name = "{{index $.Vars "alloydb_cluster_name"}}"
34
+ address_type = "INTERNAL"
35
+ purpose = "VPC_PEERING"
36
+ prefix_length = 16
37
+ network = google_compute_network.default.id
38
+ }
39
+
40
+ resource "google_service_networking_connection" "vpc_connection" {
41
+ network = google_compute_network.default.id
42
+ service = "servicenetworking.googleapis.com"
43
+ reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name]
44
+ }
You can’t perform that action at this time.
0 commit comments