You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1.5 KiB
HCL
31 lines
1.5 KiB
HCL
resource "aws_api_gateway_resource" "transponder-tracker-load" {
|
|
parent_id = aws_api_gateway_rest_api.transponder-tracker.root_resource_id
|
|
path_part = "load"
|
|
rest_api_id = aws_api_gateway_rest_api.transponder-tracker.id
|
|
}
|
|
|
|
resource "aws_api_gateway_method" "transponder-tracker-load" {
|
|
authorization = "NONE"
|
|
http_method = "POST"
|
|
resource_id = aws_api_gateway_resource.transponder-tracker-load.id
|
|
rest_api_id = aws_api_gateway_rest_api.transponder-tracker.id
|
|
}
|
|
|
|
resource "aws_api_gateway_integration" "transponder-tracker-load" {
|
|
http_method = aws_api_gateway_method.transponder-tracker-load.http_method
|
|
resource_id = aws_api_gateway_resource.transponder-tracker-load.id
|
|
rest_api_id = aws_api_gateway_rest_api.transponder-tracker.id
|
|
type = "AWS_PROXY"
|
|
uri = module.load-lambda.invoke_arn
|
|
}
|
|
|
|
resource "aws_lambda_permission" "apigw_lambda_load" {
|
|
statement_id = "AllowExecutionFromAPIGateway"
|
|
action = "lambda:InvokeFunction"
|
|
function_name = module.load-lambda.function_name
|
|
principal = "apigateway.amazonaws.com"
|
|
|
|
# More: http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-control-access-using-iam-policies-to-invoke-api.html
|
|
source_arn = "arn:aws:execute-api:${data.aws_region.current.name}:${data.aws_caller_identity.current.id}:${aws_api_gateway_rest_api.transponder-tracker.id}/*/${aws_api_gateway_method.transponder-tracker-load.http_method}${aws_api_gateway_resource.transponder-tracker-load.path}"
|
|
}
|