From 898884e692eb4c414238ca068a7d995de81b05be Mon Sep 17 00:00:00 2001 From: Steven Fawcett Date: Tue, 15 Jun 2021 11:13:21 +0100 Subject: [PATCH] Fix Database Connection This is for delivery to PaaS only. Remove the service binds and get the database name from the service-key --- terraform/paas/application.tf | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/terraform/paas/application.tf b/terraform/paas/application.tf index 01a08ee01b..03dc0ac77d 100644 --- a/terraform/paas/application.tf +++ b/terraform/paas/application.tf @@ -1,7 +1,6 @@ locals { environment_map = { REDIS_URL = local.redis-credentials.uri, - DATABASE_URL = local.postgres-credentials.uri, - DB_DATABASE = "schools-experience", + DB_DATABASE = local.postgres-credentials.name DB_HOST = local.postgres-credentials.host, DB_USERNAME = local.postgres-credentials.username, DB_PASSWORD = local.postgres-credentials.password, @@ -27,22 +26,6 @@ resource "cloudfoundry_app" "application" { route = cloudfoundry_route.route_internal.id } - # For Review Apps find existing Resources - dynamic "service_binding" { - for_each = concat(data.cloudfoundry_service_instance.redis, data.cloudfoundry_service_instance.redis) - content { - service_instance = service_binding.value["id"] - } - } - - # For Dev/Test/Production Apps use created Resources - dynamic "service_binding" { - for_each = concat(cloudfoundry_service_instance.redis, cloudfoundry_service_instance.postgres, cloudfoundry_user_provided_service.logging) - content { - service_instance = service_binding.value["id"] - } - } - environment = merge(local.application_secrets, local.environment_map) }