Skip to content

Commit 70205b0

Browse files
authored
fix: Add outputs for the actual google_sql_database_instance resources (#193)
Co-authored-by: Andrey Kaipov <[email protected]>
1 parent 4b787b2 commit 70205b0

File tree

18 files changed

+124
-1
lines changed

18 files changed

+124
-1
lines changed

examples/mysql-ha/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ terraform destroy
3232
| Name | Description |
3333
|------|-------------|
3434
| authorized\_network | n/a |
35+
| instances | n/a |
3536
| name | The name for Cloud SQL instance |
3637
| project\_id | n/a |
38+
| replicas | n/a |
3739

3840
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

examples/mysql-ha/outputs.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,11 @@ output "name" {
2626
output "authorized_network" {
2727
value = var.mysql_ha_external_ip_range
2828
}
29+
30+
output "replicas" {
31+
value = module.mysql.replicas
32+
}
33+
34+
output "instances" {
35+
value = module.mysql.instances
36+
}

examples/postgresql-ha/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ terraform destroy
3232
| Name | Description |
3333
|------|-------------|
3434
| authorized\_network | n/a |
35+
| instances | n/a |
3536
| name | The name for Cloud SQL instance |
3637
| project\_id | n/a |
38+
| replicas | n/a |
3739

3840
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

examples/postgresql-ha/outputs.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,11 @@ output "name" {
2626
output "authorized_network" {
2727
value = var.pg_ha_external_ip_range
2828
}
29+
30+
output "replicas" {
31+
value = module.pg.replicas
32+
}
33+
34+
output "instances" {
35+
value = module.pg.instances
36+
}

modules/mssql/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ The following dependency must be available for SQL Server module:
5757
| instance\_self\_link | The URI of the master instance |
5858
| instance\_server\_ca\_cert | The CA certificate information used to connect to the SQL instance via SSL |
5959
| instance\_service\_account\_email\_address | The service account email address assigned to the master instance |
60+
| primary | The `google_sql_database_instance` resource representing the primary instance |
6061
| private\_address | The private IP address assigned for the master instance |
6162
| root\_password | MSSERVER password for the root user. If not set, a random one will be generated and available in the root\_password output variable. |
6263

modules/mssql/outputs.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,9 @@ output "root_password" {
6666
value = coalesce(var.root_password, random_password.root-password.result)
6767
sensitive = true
6868
}
69+
70+
// Resources
71+
output "primary" {
72+
value = google_sql_database_instance.default
73+
description = "The `google_sql_database_instance` resource representing the primary instance"
74+
}

modules/mysql/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,13 @@ Note: CloudSQL provides [disk autoresize](https://cloud.google.com/sql/docs/mysq
6060
| instance\_self\_link | The URI of the master instance |
6161
| instance\_server\_ca\_cert | The CA certificate information used to connect to the SQL instance via SSL |
6262
| instance\_service\_account\_email\_address | The service account email address assigned to the master instance |
63+
| instances | A list of all `google_sql_database_instance` resources we've created |
64+
| primary | The `google_sql_database_instance` resource representing the primary instance |
6365
| private\_address | The private IP address assigned for the master instance |
6466
| private\_ip\_address | The first private (PRIVATE) IPv4 address assigned for the master instance |
6567
| public\_ip\_address | The first public (PRIMARY) IPv4 address assigned for the master instance |
6668
| read\_replica\_instance\_names | The instance names for the read replica instances |
69+
| replicas | A list of `google_sql_database_instance` resources representing the replicas |
6770
| replicas\_instance\_connection\_names | The connection names of the replica instances to be used in connection strings |
6871
| replicas\_instance\_first\_ip\_addresses | The first IPv4 addresses of the addresses assigned for the replica instances |
6972
| replicas\_instance\_self\_links | The URIs of the replica instances |

modules/mysql/outputs.tf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,19 @@ output "private_ip_address" {
101101
description = "The first private (PRIVATE) IPv4 address assigned for the master instance"
102102
value = google_sql_database_instance.default.private_ip_address
103103
}
104+
105+
// Resources
106+
output "primary" {
107+
value = google_sql_database_instance.default
108+
description = "The `google_sql_database_instance` resource representing the primary instance"
109+
}
110+
111+
output "replicas" {
112+
value = values(google_sql_database_instance.replicas)
113+
description = "A list of `google_sql_database_instance` resources representing the replicas"
114+
}
115+
116+
output "instances" {
117+
value = concat([google_sql_database_instance.default], values(google_sql_database_instance.replicas))
118+
description = "A list of all `google_sql_database_instance` resources we've created"
119+
}

modules/postgresql/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,12 @@ Note: CloudSQL provides [disk autoresize](https://cloud.google.com/sql/docs/mysq
5959
| instance\_self\_link | The URI of the master instance |
6060
| instance\_server\_ca\_cert | The CA certificate information used to connect to the SQL instance via SSL |
6161
| instance\_service\_account\_email\_address | The service account email address assigned to the master instance |
62+
| instances | A list of all `google_sql_database_instance` resources we've created |
63+
| primary | The `google_sql_database_instance` resource representing the primary instance |
6264
| private\_ip\_address | The first private (PRIVATE) IPv4 address assigned for the master instance |
6365
| public\_ip\_address | The first public (PRIMARY) IPv4 address assigned for the master instance |
6466
| read\_replica\_instance\_names | The instance names for the read replica instances |
67+
| replicas | A list of `google_sql_database_instance` resources representing the replicas |
6568
| replicas\_instance\_connection\_names | The connection names of the replica instances to be used in connection strings |
6669
| replicas\_instance\_first\_ip\_addresses | The first IPv4 addresses of the addresses assigned for the replica instances |
6770
| replicas\_instance\_self\_links | The URIs of the replica instances |

modules/postgresql/outputs.tf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,19 @@ output "generated_user_password" {
9696
value = random_id.user-password.hex
9797
sensitive = true
9898
}
99+
100+
// Resources
101+
output "primary" {
102+
value = google_sql_database_instance.default
103+
description = "The `google_sql_database_instance` resource representing the primary instance"
104+
}
105+
106+
output "replicas" {
107+
value = values(google_sql_database_instance.replicas)
108+
description = "A list of `google_sql_database_instance` resources representing the replicas"
109+
}
110+
111+
output "instances" {
112+
value = concat([google_sql_database_instance.default], values(google_sql_database_instance.replicas))
113+
description = "A list of all `google_sql_database_instance` resources we've created"
114+
}

0 commit comments

Comments
 (0)