Created
March 18, 2019 21:15
-
-
Save rogerwelin/2d020d822f803039e055324b706c2006 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ############################################ | |
| # LAMBDA - Create the lambda function | |
| ############################################ | |
| resource "aws_lambda_function" "weather_api" { | |
| function_name = "weather-api" | |
| # fetch the artifact from bucket created earlier | |
| s3_bucket = "${var.artifact_bucket}" | |
| s3_key = "${var.artifact_zip_name}" | |
| handler = "${var.faas_name}" | |
| runtime = "go1.x" | |
| role = "${aws_iam_role.lambda_role.arn}" | |
| } | |
| resource "aws_lambda_permission" "apigw" { | |
| statement_id = "AllowAPIGatewayInvoke" | |
| action = "lambda:InvokeFunction" | |
| function_name = "${aws_lambda_function.weather_api.arn}" | |
| principal = "apigateway.amazonaws.com" | |
| source_arn = "${aws_api_gateway_rest_api.weather_gw.execution_arn}/*/*" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment