From 9ae7422c6533ece4ab4a1ea1ee23ee20f67ff803 Mon Sep 17 00:00:00 2001 From: neelanjan00 Date: Sun, 3 Sep 2023 18:06:01 +0530 Subject: [PATCH 1/3] adds gcp secrets manager secret for postgresSQL connection string Signed-off-by: neelanjan00 --- terraform/main.tf | 2 +- terraform/modules/gcp/secret-manager/main.tf | 26 ++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 terraform/modules/gcp/secret-manager/main.tf diff --git a/terraform/main.tf b/terraform/main.tf index 28ee733..69a7d55 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -21,7 +21,7 @@ module "gcp_apis" { "monitoring.googleapis.com", "pubsub.googleapis.com", "serviceusage.googleapis.com", - "sts.googleapis.com" + "secretmanager.googleapis.com", ] } diff --git a/terraform/modules/gcp/secret-manager/main.tf b/terraform/modules/gcp/secret-manager/main.tf new file mode 100644 index 0000000..dd7d555 --- /dev/null +++ b/terraform/modules/gcp/secret-manager/main.tf @@ -0,0 +1,26 @@ +data "google_project" "project" {} + +resource "google_service_account" "service_account" { + account_id = "e2e-test-user" + display_name = "KEDA e2e test user" + project = data.google_project.project.project_id +} + +resource "google_service_account_key" "credentials" { + service_account_id = google_service_account.service_account.name +} + +provider "google" { + credentials = google_service_account_key.my_service_account_key.private_key + project = data.google_project.project.project_id +} + +resource "google_secret_manager_secret" "connection_string" { + secret_id = "connectionString" +} + +resource "google_secret_manager_secret_version" "connection_string_version" { + secret = google_secret_manager_secret.connection_string.id + + secret_data = "postgresql://test-user:test-password@postgresql.gcp-secret-manager-test-ns.svc.cluster.local:5432/test_db?sslmode=disable" +} From 574a5723575d2901d6a41edd50608dd93575d804 Mon Sep 17 00:00:00 2001 From: neelanjan00 Date: Sun, 3 Sep 2023 18:12:28 +0530 Subject: [PATCH 2/3] adds missing google api Signed-off-by: neelanjan00 --- terraform/main.tf | 1 + 1 file changed, 1 insertion(+) diff --git a/terraform/main.tf b/terraform/main.tf index 0d13ce3..b5cf1ea 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -28,6 +28,7 @@ module "gcp_apis" { "monitoring.googleapis.com", "pubsub.googleapis.com", "serviceusage.googleapis.com", + "sts.googleapis.com", "secretmanager.googleapis.com", ] } From ade77d6cec92e05792a436f053aa6af755938d34 Mon Sep 17 00:00:00 2001 From: neelanjan00 Date: Tue, 19 Sep 2023 11:37:05 +0530 Subject: [PATCH 3/3] removes module for gcp secret manager Signed-off-by: neelanjan00 --- terraform/modules/gcp/secret-manager/main.tf | 26 -------------------- 1 file changed, 26 deletions(-) delete mode 100644 terraform/modules/gcp/secret-manager/main.tf diff --git a/terraform/modules/gcp/secret-manager/main.tf b/terraform/modules/gcp/secret-manager/main.tf deleted file mode 100644 index dd7d555..0000000 --- a/terraform/modules/gcp/secret-manager/main.tf +++ /dev/null @@ -1,26 +0,0 @@ -data "google_project" "project" {} - -resource "google_service_account" "service_account" { - account_id = "e2e-test-user" - display_name = "KEDA e2e test user" - project = data.google_project.project.project_id -} - -resource "google_service_account_key" "credentials" { - service_account_id = google_service_account.service_account.name -} - -provider "google" { - credentials = google_service_account_key.my_service_account_key.private_key - project = data.google_project.project.project_id -} - -resource "google_secret_manager_secret" "connection_string" { - secret_id = "connectionString" -} - -resource "google_secret_manager_secret_version" "connection_string_version" { - secret = google_secret_manager_secret.connection_string.id - - secret_data = "postgresql://test-user:test-password@postgresql.gcp-secret-manager-test-ns.svc.cluster.local:5432/test_db?sslmode=disable" -}