Skip to content

Commit

Permalink
Define env vars for lambdas in their own file, not inline
Browse files Browse the repository at this point in the history
  • Loading branch information
ericblau committed Oct 5, 2023
1 parent 2d0ad4f commit 9fcc06f
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 29 deletions.
30 changes: 2 additions & 28 deletions infra/mdf/container_lambdas.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,7 @@ resource "aws_lambda_function" "mdf-connect-containerized-status" {
role = aws_iam_role.lambda_execution.arn
timeout = 30
environment {
variables = {
DYNAMO_STATUS_TABLE="MDF-Connect-test"
GDRIVE_EP="f00dfd6c-edf4-4c8b-a4b1-be6ad92a4fbb"
GDRIVE_ROOT="/Shared With Me"
MANAGE_FLOWS_SCOPE="https://auth.globus.org/scopes/eec9b274-0c81-4334-bdc2-54e90e689b9a/manage_flows"
MONITOR_BY_GROUP="urn:globus:groups:id:5fc63928-3752-11e8-9c6f-0e00fd09bf20"
PORTAL_URL="https://acdc.alcf.anl.gov/mdf/detail/"
RUN_AS_SCOPE="0c7ee169-cefc-4a23-81e1-dc323307c863"
SEARCH_INDEX_UUID="ab71134d-0b36-473d-aa7e-7b19b2124c88"
TEST_DATA_DESTINATION="globus://f10a69a9-338c-4e5b-baa1-0dc92359ab47/mdf_testing/"
TEST_SEARCH_INDEX_UUID="ab71134d-0b36-473d-aa7e-7b19b2124c88"
FLOW_ID="0c7ee169-cefc-4a23-81e1-dc323307c863"
FLOW_SCOPE= "https://auth.globus.org/scopes/0c7ee169-cefc-4a23-81e1-dc323307c863/flow_0c7ee169_cefc_4a23_81e1_dc323307c863_user"
}
variables = local.env_vars[each.key]
}
}

Expand Down Expand Up @@ -63,19 +50,6 @@ resource "aws_lambda_function" "mdf-connect-containerized-submit" {
role = aws_iam_role.lambda_execution.arn
timeout = 30
environment {
variables = {
DYNAMO_STATUS_TABLE="MDF-Connect-test"
GDRIVE_EP="f00dfd6c-edf4-4c8b-a4b1-be6ad92a4fbb"
GDRIVE_ROOT="/Shared With Me"
MANAGE_FLOWS_SCOPE="https://auth.globus.org/scopes/eec9b274-0c81-4334-bdc2-54e90e689b9a/manage_flows"
MONITOR_BY_GROUP="urn:globus:groups:id:5fc63928-3752-11e8-9c6f-0e00fd09bf20"
PORTAL_URL="https://acdc.alcf.anl.gov/mdf/detail/"
RUN_AS_SCOPE="0c7ee169-cefc-4a23-81e1-dc323307c863"
SEARCH_INDEX_UUID="ab71134d-0b36-473d-aa7e-7b19b2124c88"
TEST_DATA_DESTINATION="globus://f10a69a9-338c-4e5b-baa1-0dc92359ab47/mdf_testing/"
TEST_SEARCH_INDEX_UUID="ab71134d-0b36-473d-aa7e-7b19b2124c88"
FLOW_ID="0c7ee169-cefc-4a23-81e1-dc323307c863"
FLOW_SCOPE= "https://auth.globus.org/scopes/0c7ee169-cefc-4a23-81e1-dc323307c863/flow_0c7ee169_cefc_4a23_81e1_dc323307c863_user"
variables = local.env_vars[each.key]
}
}
}
34 changes: 34 additions & 0 deletions infra/mdf/lambda_environment_vars.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
variable "prod_env_vars" {
type = map
default = {
DYNAMO_STATUS_TABLE="MDF-Connect-test"
GDRIVE_EP="f00dfd6c-edf4-4c8b-a4b1-be6ad92a4fbb"
GDRIVE_ROOT="/Shared With Me"
MANAGE_FLOWS_SCOPE="https://auth.globus.org/scopes/eec9b274-0c81-4334-bdc2-54e90e689b9a/manage_flows"
MONITOR_BY_GROUP="urn:globus:groups:id:5fc63928-3752-11e8-9c6f-0e00fd09bf20"
PORTAL_URL="https://acdc.alcf.anl.gov/mdf/detail/"
RUN_AS_SCOPE="0c7ee169-cefc-4a23-81e1-dc323307c863"
SEARCH_INDEX_UUID="ab71134d-0b36-473d-aa7e-7b19b2124c88"
TEST_DATA_DESTINATION="globus://f10a69a9-338c-4e5b-baa1-0dc92359ab47/mdf_testing/"
TEST_SEARCH_INDEX_UUID="ab71134d-0b36-473d-aa7e-7b19b2124c88"
FLOW_ID="0c7ee169-cefc-4a23-81e1-dc323307c863"
FLOW_SCOPE= "https://auth.globus.org/scopes/0c7ee169-cefc-4a23-81e1-dc323307c863/flow_0c7ee169_cefc_4a23_81e1_dc323307c863_user"
}
}
variable "test_env_vars" {
type = map
default = {
DYNAMO_STATUS_TABLE="MDF-Connect-test"
GDRIVE_EP="f00dfd6c-edf4-4c8b-a4b1-be6ad92a4fbb"
GDRIVE_ROOT="/Shared With Me"
MANAGE_FLOWS_SCOPE="https://auth.globus.org/scopes/eec9b274-0c81-4334-bdc2-54e90e689b9a/manage_flows"
MONITOR_BY_GROUP="urn:globus:groups:id:5fc63928-3752-11e8-9c6f-0e00fd09bf20"
PORTAL_URL="https://acdc.alcf.anl.gov/mdf/detail/"
RUN_AS_SCOPE="0c7ee169-cefc-4a23-81e1-dc323307c863"
SEARCH_INDEX_UUID="ab71134d-0b36-473d-aa7e-7b19b2124c88"
TEST_DATA_DESTINATION="globus://f10a69a9-338c-4e5b-baa1-0dc92359ab47/mdf_testing/"
TEST_SEARCH_INDEX_UUID="ab71134d-0b36-473d-aa7e-7b19b2124c88"
FLOW_ID="0c7ee169-cefc-4a23-81e1-dc323307c863"
FLOW_SCOPE= "https://auth.globus.org/scopes/0c7ee169-cefc-4a23-81e1-dc323307c863/flow_0c7ee169_cefc_4a23_81e1_dc323307c863_user"
}
}
5 changes: 4 additions & 1 deletion infra/mdf/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ locals {
functions = toset(local.funcs)
account_id = data.aws_caller_identity.current.account_id
region = "us-east-1"

env_vars = {
prod = var.prod_env_vars
test = var.test_env_vars
}
}

terraform {
Expand Down

0 comments on commit 9fcc06f

Please sign in to comment.