generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7451 from ministryofjustice/dlt-generic-lambda
Load Zip File Module
- Loading branch information
Showing
4 changed files
with
110 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
terraform/environments/electronic-monitoring-data/modules/unzipped_structure_extract/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
locals { | ||
dataset_name_parts = split("_", var.dataset_name) | ||
SUPPLIER_NAME = local.dataset_name_parts[0] | ||
SYSTEM_NAME = join("_", slice(local.dataset_name_parts, 1, length(local.dataset_name_parts))) | ||
} | ||
|
||
module "this" { | ||
source = "../lambdas" | ||
function_name = "load_${var.dataset_name}" | ||
is_image = true | ||
role_name = var.iam_role.name | ||
role_arn = var.iam_role.arn | ||
memory_size = var.memory_size | ||
timeout = var.timeout | ||
env_account_id = var.env_account_id | ||
core_shared_services_id = var.core_shared_services_id | ||
production_dev = var.production_dev | ||
ecr_repo_name = "create-a-data-task" | ||
function_tag = var.function_tag | ||
environment_variables = { | ||
DLT_PROJECT_DIR : "/tmp" | ||
DLT_DATA_DIR : "/tmp" | ||
DLT_PIPELINE_DIR : "/tmp" | ||
JSON_BUCKET_NAME = var.json_bucket_name | ||
STANDARD_FILESYSTEM__QUERY_RESULT_BUCKET = "s3://${var.athena_bucket_name}/output" | ||
ATHENA_DUMP_BUCKET_NAME = "s3://${var.athena_bucket_name}/output" | ||
pipeline_name = var.dataset_name | ||
environment = var.production_dev | ||
SUPPLIER_NAME = local.SUPPLIER_NAME | ||
SYSTEM_NAME = local.SYSTEM_NAME | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...form/environments/electronic-monitoring-data/modules/unzipped_structure_extract/output.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
output "lambda_function_name" { | ||
value = module.this.lambda_function_name | ||
} | ||
|
||
output "lambda_function_arn" { | ||
value = module.this.lambda_function_arn | ||
} | ||
|
||
output "lambda_function_invoke_arn" { | ||
value = module.this.lambda_function_invoke_arn | ||
} |
60 changes: 60 additions & 0 deletions
60
...m/environments/electronic-monitoring-data/modules/unzipped_structure_extract/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
variable "dataset_name" { | ||
type = string | ||
nullable = false | ||
} | ||
|
||
variable "iam_role" { | ||
type = object({ | ||
name = string | ||
arn = string | ||
id = string | ||
}) | ||
nullable = false | ||
} | ||
|
||
variable "memory_size" { | ||
type = number | ||
nullable = false | ||
default = 240 | ||
} | ||
variable "timeout" { | ||
type = number | ||
nullable = false | ||
default = 60 | ||
} | ||
variable "function_tag" { | ||
type = string | ||
nullable = false | ||
default = "v0.0.0-884806f" | ||
} | ||
|
||
variable "env_account_id" { | ||
description = "The account number of the aws account" | ||
type = number | ||
} | ||
|
||
variable "core_shared_services_id" { | ||
description = "The account number of the core shared services account" | ||
type = number | ||
default = null | ||
nullable = true | ||
} | ||
|
||
variable "production_dev" { | ||
description = "The environment the lambda is being deployed to" | ||
type = string | ||
nullable = true | ||
default = null | ||
} | ||
|
||
variable "json_bucket_name" { | ||
description = "The bucket to pull json structure from" | ||
type = string | ||
nullable = false | ||
} | ||
|
||
variable "athena_bucket_name" { | ||
description = "Bucket to dump query output into" | ||
type = string | ||
nullable = false | ||
} |