mirror of
https://github.com/projecthorus/sondehub-infra.git
synced 2025-04-09 12:01:15 +00:00
add amateur listener api
This commit is contained in:
parent
2ee38c5a89
commit
915ae277de
@ -255,4 +255,51 @@ resource "aws_sns_topic_subscription" "ham_sns_to_mqtt" {
|
||||
topic_arn = aws_sns_topic.ham_telem.arn
|
||||
protocol = "lambda"
|
||||
endpoint = aws_lambda_function.ham_sns_to_mqtt.arn
|
||||
}
|
||||
|
||||
resource "aws_lambda_function" "ham_listener_put" {
|
||||
function_name = "ham-listener-put"
|
||||
handler = "ham_listener_put.lambda_handler"
|
||||
s3_bucket = aws_s3_bucket_object.lambda.bucket
|
||||
s3_key = aws_s3_bucket_object.lambda.key
|
||||
source_code_hash = data.archive_file.lambda.output_base64sha256
|
||||
publish = true
|
||||
memory_size = 128
|
||||
role = aws_iam_role.basic_lambda_role.arn
|
||||
runtime = "python3.9"
|
||||
timeout = 10
|
||||
architectures = ["arm64"]
|
||||
environment {
|
||||
variables = {
|
||||
"ES" = "es.${local.domain_name}"
|
||||
}
|
||||
}
|
||||
tags = {
|
||||
Name = "ham-listener-put"
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_lambda_permission" "ham_listener_put" {
|
||||
action = "lambda:InvokeFunction"
|
||||
function_name = aws_lambda_function.ham_listener_put.arn
|
||||
principal = "apigateway.amazonaws.com"
|
||||
source_arn = "arn:aws:execute-api:us-east-1:${data.aws_caller_identity.current.account_id}:${aws_apigatewayv2_api.main.id}/*/*/amateur/listeners"
|
||||
}
|
||||
|
||||
resource "aws_apigatewayv2_route" "ham_listener_put" {
|
||||
api_id = aws_apigatewayv2_api.main.id
|
||||
api_key_required = false
|
||||
authorization_type = "NONE"
|
||||
route_key = "PUT /amateur/listeners"
|
||||
target = "integrations/${aws_apigatewayv2_integration.ham_listener_put.id}"
|
||||
}
|
||||
|
||||
resource "aws_apigatewayv2_integration" "ham_listener_put" {
|
||||
api_id = aws_apigatewayv2_api.main.id
|
||||
connection_type = "INTERNET"
|
||||
integration_method = "POST"
|
||||
integration_type = "AWS_PROXY"
|
||||
integration_uri = aws_lambda_function.ham_listener_put.arn
|
||||
timeout_milliseconds = 30000
|
||||
payload_format_version = "2.0"
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user