Created
August 30, 2018 20:02
-
-
Save yez/365447163dd69c2617d3a5220c75d27e 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
# START RESOURCE DEFINITION | |
resource "aws_api_gateway_resource" "HelloResource" { | |
rest_api_id = "${var.gateway_api_id}" | |
parent_id = "${var.gateway_resource_parent_id}" | |
path_part = "hello" | |
} | |
# END RESOURCE DEFINITION | |
############################### | |
# START GET | |
resource "aws_api_gateway_method" "HelloGET" { | |
rest_api_id = "${var.gateway_api_id}" | |
resource_id = "${aws_api_gateway_resource.HelloResource.id}" | |
http_method = "GET" | |
authorization = "NONE" | |
} | |
resource "aws_api_gateway_integration" "HelloGETIntegration" { | |
rest_api_id = "${var.gateway_api_id}" | |
resource_id = "${aws_api_gateway_resource.HelloResource.id}" | |
http_method = "${aws_api_gateway_method.HelloGET.http_method}" | |
uri = "arn:aws:apigateway:${var.aws_region}:lambda:path/2015-03-31/functions/${var.lambda_arn}/invocations" | |
integration_http_method = "POST" | |
type = "AWS_PROXY" | |
} | |
# END GET | |
############################### | |
# START POST | |
resource "aws_api_gateway_method" "HelloPOST" { | |
rest_api_id = "${var.gateway_api_id}" | |
resource_id = "${aws_api_gateway_resource.HelloResource.id}" | |
http_method = "POST" | |
authorization = "NONE" | |
} | |
resource "aws_api_gateway_integration" "HelloPOSTIntegration" { | |
rest_api_id = "${var.gateway_api_id}" | |
resource_id = "${aws_api_gateway_resource.HelloResource.id}" | |
http_method = "${aws_api_gateway_method.HelloPOST.http_method}" | |
uri = "arn:aws:apigateway:${var.aws_region}:lambda:path/2015-03-31/functions/${var.lambda_arn}/invocations" | |
integration_http_method = "POST" | |
type = "AWS_PROXY" | |
} | |
# END POST | |
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
variable "gateway_api_id" { | |
description = "The ID of the associated REST API" | |
} | |
variable "gateway_resource_parent_id" { | |
description = "The ID of the Gateway Root Resource" | |
} | |
variable "lambda_arn" { | |
description = "The lambda name to invoke" | |
} | |
variable "aws_region" { | |
description = "The AWS region, e.g., eu-west-1" | |
} | |
variable "account_id" { | |
description = "The AWS account ID" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment