Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Terraform Error: Error creating API Gateway Deployment: BadRequestException: No integration defined for method

Getting error while creating api_gateway using terraform, Below is my code and the error screenshot.. with this code am able to create REST API, but failing in deployment section... can anyone please help me in this

aws_api_gateway_deployment.api-deployment: Creating...

Error: Error creating API Gateway Deployment: BadRequestException: No integration defined for method

Screenshot of the logs

like image 735
Narasimha Avatar asked Jul 12 '26 14:07

Narasimha


2 Answers

In your "aws_api_gateway_deployment" resource you will need to add a "depends_on" which will need to contain entries for:

  • aws_api_gateway_method
  • aws_api_gateway_integration

that are found in your terraform script, for example:

   resource "aws_api_gateway_deployment" "example" {
    
      depends_on = [
        aws_api_gateway_method.methodproxy,
        aws_api_gateway_integration.apilambda
      ]
      ...
   }

The problem it from either of the two resource not having been setup.

like image 186
devguy Avatar answered Jul 18 '26 11:07

devguy


I faced this error; the problem was that a dev created a new resource (endpoint) via the AWS console in the same API terraform trying to redeploy. He hasn't integrated that endpoint with any of the services.

Once we removed that partial resource, terraform apply worked fine without any issues.

like image 39
Rahul Kodumuru Avatar answered Jul 18 '26 12:07

Rahul Kodumuru