Generate a postgresql certificate.

This commit is contained in:
Tom Alexander
2021-07-18 21:19:08 -04:00
parent 8a7fa68a6e
commit fd63ea2c43
3 changed files with 53 additions and 0 deletions

View File

@@ -43,6 +43,11 @@ output "instance" {
value = google_sql_database_instance.instance
}
output "certificate" {
description = "TLS certificate for connecting to the database."
value = google_sql_ssl_cert.client_cert
}
# Needed for CloudSQL Auth Proxy
resource "google_project_service" "sqladmin" {
project = var.project
@@ -85,3 +90,8 @@ resource "google_sql_user" "postgres" {
instance = google_sql_database_instance.instance.name
password = var.postgres_password
}
resource "google_sql_ssl_cert" "client_cert" {
common_name = "client-name"
instance = google_sql_database_instance.instance.name
}