Skip to content

Commit

Permalink
feat(gcp sql): output instance and connection name
Browse files Browse the repository at this point in the history
  • Loading branch information
tweakster committed Jan 10, 2025
1 parent 3137a82 commit 6d9102f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
17 changes: 0 additions & 17 deletions modules/gcp_sql/instance.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,3 @@ resource "google_sql_database_instance" "this" {
}
}
}

output "ip_address" {
value = {
external_ip = one([
for ip in resource.google_sql_database_instance.this.ip_address : ip.ip_address if ip.type == "PRIMARY"
])
internal_ip = one([
for ip in resource.google_sql_database_instance.this.ip_address : ip.ip_address if ip.type == "PRIVATE"
])
}
}

output "server_ca_cert" {
value = one([
for ca in resource.google_sql_database_instance.this.server_ca_cert : ca.cert
])
}
24 changes: 24 additions & 0 deletions modules/gcp_sql/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
output "instance_name" {
value = google_sql_database_instance.this.id
}

output "connection_name" {
value = google_sql_database_instance.this.connection_name
}

output "ip_address" {
value = {
external_ip = one([
for ip in resource.google_sql_database_instance.this.ip_address : ip.ip_address if ip.type == "PRIMARY"
])
internal_ip = one([
for ip in resource.google_sql_database_instance.this.ip_address : ip.ip_address if ip.type == "PRIVATE"
])
}
}

output "server_ca_cert" {
value = one([
for ca in resource.google_sql_database_instance.this.server_ca_cert : ca.cert
])
}

0 comments on commit 6d9102f

Please sign in to comment.