@@ -16,6 +16,8 @@ This is the main terraform code for the UK platform. It is used to deploy the pl
16165.1 - PVSite database
17175.2 - PVSite API
18185.3 - PVSite ML bucket
19+ 6.0 - Data Platform Database
20+ 6.1 - Data Platform API
1921
2022Variables used across all modules
2123======*/
@@ -170,6 +172,7 @@ module "analysis_dashboard" {
170172 { " name" : " REGION" , " value" : local.domain},
171173 { " name" : " ENVIRONMENT" , " value" : local.environment},
172174 { " name" : " SENTRY_DSN" , " value" : var.sentry_dsn },
175+ { " name" : " DATA_PLATFORM_HOST" , " value" : module.data_platform_api.api_url},
173176 ]
174177 container-name = " analysis-dashboard"
175178 container-tag = var. internal_ui_version
@@ -238,3 +241,41 @@ module "pvsite_ml_bucket" {
238241 lifecycled_prefixes = []
239242}
240243
244+ # 6.0 Data Platform - Database
245+ module "data_platform_database" {
246+ source = " github.com/openclimatefix/ocf-infrastructure//terraform/modules/storage/postgres?ref=23f3802"
247+ region = var. region
248+ environment = local. environment
249+ db_subnet_group_name = module. networking . private_subnet_group_name
250+ vpc_id = module. networking . vpc_id
251+ db_name = " dataplatform"
252+ rds_instance_class = " db.t3.small"
253+ allow_major_version_upgrade = true
254+ }
255+
256+ # 6.1 Data Platform - API
257+ module "data_platform_api" {
258+ source = " github.com/openclimatefix/ocf-infrastructure//terraform/modules/services/eb_app?ref=23f3802"
259+ domain = local. domain
260+ aws-region = var. region
261+ aws-environment = local. environment
262+ aws-subnet_id = module. networking . private_subnet_ids [0 ]
263+ aws-vpc_id = module. networking . vpc_id
264+ container-command = [" /dp-server" ]
265+ container-env_vars = [
266+ { " name" : " DATABASE_URL" , " value" : module.data_platform_database.default_db_connection_url },
267+ { " name" : " LOGLEVEL" , " value" : " DEBUG" },
268+ ]
269+ container-name = " data-platform"
270+ container-tag = var. data_platform_api_version
271+ container-registry = " ghcr.io/openclimatefix"
272+ eb-app_name = " data-platform-api"
273+ eb-instance_type = " t3.micro"
274+ s3_bucket = []
275+ container-port-mappings = [
276+ {" host" : " 50051" , " container" : " 50051" },
277+ {" host" : " 80" , " container" : " 50051" },
278+ ]
279+ elbscheme = " internal"
280+ elb_ports = [" 80" ," 50051" ]
281+ }
0 commit comments