sns_to_mqtt

This commit is contained in:
Michaela 2021-10-28 10:58:17 +11:00
parent 63a7a13133
commit 9cf9289f8f

View File

@ -116,3 +116,29 @@ resource "aws_sns_topic" "sonde_telem" {
}
EOF
}
// SNS to MQTT
resource "aws_lambda_function" "sns_to_mqtt" {
function_name = "sns-to-mqtt"
handler = "lambda_function.lambda_handler"
filename = "${path.module}/sns-to-mqtt/Archive.zip" # this should get replaced out when we make a proper build chain
publish = true
memory_size = 128
role = aws_iam_role.basic_lambda_role.arn
runtime = "python3.9"
timeout = 3
architectures = ["arm64"]
lifecycle {
ignore_changes = [environment]
}
}
resource "aws_lambda_permission" "sns_to_mqtt" {
action = "lambda:InvokeFunction"
function_name = aws_lambda_function.station.arn
principal = "apigateway.amazonaws.com"
source_arn = aws_sns_topic.sonde_telem.arn
}