Madhawa
Madhawa

Reputation: 147

Terraform : Error creating API Gateway Integration: BadRequestException: AWS ARN for integration must contain path or action

I'm integrating aws firehouse with API gateway post call.

I know here the issue is with the uri.

My Terraform code looks like this.

resource "aws_api_gateway_integration" "request_method_integration_post" {

rest_api_id = local.rest_api_id
resource_id = local.resource_id
http_method = aws_api_gateway_method.request_method_post.http_method
type        = "AWS"
integration_http_method = "POST"
uri = 
"arn:aws:apigateway:${local.region_name}:firehose:arn:aws:firehose:${local.region_name}:${var.accountId}:deliverystream/${var.firehose_name}/PutRecord"
}

According to the documentation uri should have the below pattern

arn:aws:apigateway:{region}:{subdomain.service|service}:{path|action}/{service_api}

reference : https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/api_gateway_integration

But I cannot figure out the correct uri here.

If anyone knows please help.

I tried to change the uri with different formats.
I also tried with the following.
uri = "arn:aws:apigateway:${var.aws_region}:firehose:action/PutRecord"
Non works.

Upvotes: 0

Views: 5198

Answers (2)

Madhawa
Madhawa

Reputation: 147

Found the answer.

uri should be as follow.

"arn:aws:apigateway:${local.region_name}:firehose:action/PutRecordBatch"

Also credentials was missing in my aws_api_gateway_integration resource. Should be look like,

credentials             = aws_iam_role.name.arn

Upvotes: 0

marcincuber
marcincuber

Reputation: 3791

Looking at another post here

You should have the following values and format:

type = "AWS"
integration_http_method = "POST"
uri = "arn:aws:apigateway:${var.aws_region}:firehose:action/PutRecord"

Upvotes: 1

Related Questions