From 43fecb7f088f1890d476fa4e84d0d93009f990fc Mon Sep 17 00:00:00 2001 From: Tom Ashworth Date: Mon, 30 Jan 2023 15:43:47 +0000 Subject: [PATCH] Add variable for the DB migrate lambda path This allows the path to be set to a specific location and committed or cached, so that it is not recreated unnecessarily in an automation context. --- main.tf | 1 + modules/metadata-service/locals.tf | 2 +- modules/metadata-service/variables.tf | 6 ++++++ variables.tf | 6 ++++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index d8c7127..1a0cf31 100644 --- a/main.tf +++ b/main.tf @@ -27,6 +27,7 @@ module "metaflow-metadata-service" { database_name = module.metaflow-datastore.database_name database_password = module.metaflow-datastore.database_password database_username = module.metaflow-datastore.database_username + db_migrate_lambda_zip_file = var.db_migrate_lambda_zip_file datastore_s3_bucket_kms_key_arn = module.metaflow-datastore.datastore_s3_bucket_kms_key_arn enable_api_basic_auth = var.metadata_service_enable_api_basic_auth enable_api_gateway = var.metadata_service_enable_api_gateway diff --git a/modules/metadata-service/locals.tf b/modules/metadata-service/locals.tf index bcbb4e1..a75f8db 100644 --- a/modules/metadata-service/locals.tf +++ b/modules/metadata-service/locals.tf @@ -22,7 +22,7 @@ locals { api_gateway_stage_name = "api" api_gateway_usage_plan_name = "${var.resource_prefix}usage-plan${var.resource_suffix}" - db_migrate_lambda_zip_file = "${path.module}/db_migrate_lambda.zip" + db_migrate_lambda_zip_file = coalesce(var.db_migrate_lambda_zip_file, "${path.module}/db_migrate_lambda.zip") db_migrate_lambda_name = "${var.resource_prefix}db_migrate${var.resource_suffix}" lambda_ecs_execute_role_name = "${var.resource_prefix}lambda_ecs_execute${var.resource_suffix}" diff --git a/modules/metadata-service/variables.tf b/modules/metadata-service/variables.tf index a0aae1b..b38f99c 100644 --- a/modules/metadata-service/variables.tf +++ b/modules/metadata-service/variables.tf @@ -37,6 +37,12 @@ variable "enable_api_gateway" { description = "Enable API Gateway for public metadata service endpoint" } +variable "db_migrate_lambda_zip_file" { + type = string + description = "Output path for the zip file containing the DB migrate lambda" + default = null +} + variable "fargate_execution_role_arn" { type = string description = "The IAM role that grants access to ECS and Batch services which we'll use as our Metadata Service API's execution_role for our Fargate instance" diff --git a/variables.tf b/variables.tf index 1852a86..d05c5a6 100644 --- a/variables.tf +++ b/variables.tf @@ -10,6 +10,12 @@ variable "batch_type" { default = "ec2" } +variable "db_migrate_lambda_zip_file" { + type = string + description = "Output path for the zip file containing the DB migrate lambda" + default = null +} + variable "enable_custom_batch_container_registry" { type = bool default = false