Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

218
Visualizações
AWS API Gateway Integration and Terraform

I'm struggling to translate my API Gateway Integration request into Terraform code, I'm trying to pass a multipart/form-data request to a Lambda for storage.

I've been able to set up the API gateway manually from scratch, but when I try the terraform I recieve an Internal server error and Cloudwatch tells me the gateway has been unable to transform the request.

Execution failed due to configuration error: Unable to transform request

The problem seems to be in the Integration request, because if I do the terraform deployment I can get the whole thing to work by changing the Integration Type in the UI to Lambda Proxy, changing it back again and adding re-adding the Mapping Template.

Terraform block for the Integration;

resource "aws_api_gateway_integration" "docuemnt-api-method-integration" {
  rest_api_id = aws_api_gateway_rest_api.document-api.id
  resource_id = aws_api_gateway_resource.document-resource.id
  http_method = aws_api_gateway_method.document-post-method.http_method
  type = "AWS"
  uri = aws_lambda_function.document_function.invoke_arn
  integration_http_method = "POST"
  passthrough_behavior = "WHEN_NO_TEMPLATES"
  request_templates = {
    "multipart/form-data" = file("${path.module}/mapping/mapping_template.json")
  }
}

The Mapping template

{
  "body":"$input.body",
  "content-type": "$util.escapeJavaScript($input.params().header.get('Content-Type'))"
}
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

On the AWS console you are NOT able to set the Integration Request's content_handling and it is only an Optional parameter in terraform as well. When you are changing the Integration Type in the UI to Lambda Proxy, the integration request's content_handling will be set to CONVERT_TO_TEXT.

So you need to add this row to the aws_api_gateway_integration:

content_handling = "CONVERT_TO_TEXT" 

And normally it will solve your problem.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda