diff --git a/modules/gcp_sql/instance.tf b/modules/gcp_sql/instance.tf index 030a262..94448cd 100644 --- a/modules/gcp_sql/instance.tf +++ b/modules/gcp_sql/instance.tf @@ -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 - ]) -} diff --git a/modules/gcp_sql/outputs.tf b/modules/gcp_sql/outputs.tf new file mode 100644 index 0000000..d6edc76 --- /dev/null +++ b/modules/gcp_sql/outputs.tf @@ -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 + ]) +}