diff --git a/lambda/nameUpdate/index.js b/lambda/nameUpdate/index.js index eade1e6..7bcb77d 100644 --- a/lambda/nameUpdate/index.js +++ b/lambda/nameUpdate/index.js @@ -3,6 +3,7 @@ const AWS = require("aws-sdk"); const { runQuery, runScan, NAME_CACHE_TABLE_NAME, TABLE_NAME, ORCS_INDEX, dynamodb } = require("../dynamoUtil"); const { logger } = require('../logger'); const DATA_REGISTER_NAME_ENDPOINT = process.env.DATA_REGISTER_NAME_ENDPOINT || 'https://zloys5cfvf.execute-api.ca-central-1.amazonaws.com/api/parks/names?status=current'; +const DATA_REGISTER_NAME_API_KEY = process.env.DATA_REGISTER_NAME_API_KEY; exports.handler = async (event, context) => { logger.info('Name Update') @@ -211,7 +212,8 @@ async function getDataRegisterRecords() { headers: { 'Content-Type': 'application/json', 'Authorization': 'None', - 'Accept': 'application/json' + 'Accept': 'application/json', + 'x-api-key': DATA_REGISTER_NAME_API_KEY } }); } diff --git a/terraform/src/nameUpdate.tf b/terraform/src/nameUpdate.tf index 6e4a841..d11f27c 100644 --- a/terraform/src/nameUpdate.tf +++ b/terraform/src/nameUpdate.tf @@ -15,6 +15,7 @@ resource "aws_lambda_function" "name_update" { TABLE_NAME = aws_dynamodb_table.ar_table.name, NAME_CACHE_TABLE_NAME = aws_dynamodb_table.ar_table_name_cache.name, DATA_REGISTER_NAME_ENDPOINT = data.aws_ssm_parameter.data_register_name_endpoint.value, + DATA_REGISTER_NAME_API_KEY = data.aws_ssm_parameter.data_register_name_api_key.value, LOG_LEVEL = "debug" } } diff --git a/terraform/src/variables.tf b/terraform/src/variables.tf index 757e39d..eae9302 100644 --- a/terraform/src/variables.tf +++ b/terraform/src/variables.tf @@ -23,6 +23,10 @@ data "aws_ssm_parameter" "data_register_name_endpoint" { name = "/parks-ar-api/data-register-name-endpoint" } +data "aws_ssm_parameter" "data_register_name_api_key" { + name = "/parks-ar-api/data-register-name-api-key" +} + data "aws_ssm_parameter" "s3_bucket_assets" { name = "/parks-ar-api/s3-bucket-assets" }