0

I trying to replicate the build of an api gateway from an Udemy course in Terraform

On the course the tutor constructs a POST method integration on the console selecting "Lambda Function" as the "Integration Type" NOT selecting "Use Lambda Proxy Integration".

This works fine on the console but when I try to replicate this in Terraform the code:

resource "aws_api_gateway_integration" "build-table-post-integration" {
  rest_api_id = aws_api_gateway_rest_api.testAPI.id
  resource_id = aws_api_gateway_resource.build-table-resource.id
  http_method = aws_api_gateway_method.build-table-method-post.http_method
  type = "LAMBDA"
}

I get the following error:

Error: expected type to be one of [HTTP AWS MOCK HTTP_PROXY AWS_PROXY], got LAMBDA

Fair enough but is the logical conclusion of this that a non-proxy integration of Lambda is not supported by Terraform?

Or am I missing the point?

If it's not supported my options are a proxy integration (not really keen) or use the Serverless Framework which does appear to support it (not hugely keen on that either)?

1 Answer 1

1

The non proxied Lambda integration requires you to use a type of AWS. This type also allows you to use DynamoDB, SNS, SQS and other AWS services.

The AWS user guide also covers this:

The type of integration with the specified backend. The valid value is

  • http or http_proxy: for integration with an HTTP backend
  • aws_proxy: for integration with AWS Lambda functions;
  • aws: for integration with AWS Lambda functions or other AWS services, such as Amazon DynamoDB, Amazon Simple Notification Service or Amazon Simple Queue Service;
  • mock: for integration with API Gateway without invoking any backend.

For more information about the integration types, see integration:type.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.