Terraform won't deploy step function to API gateway

Viewed 478

I'm trying to deploy API GW with a step function integration inside a post method execution.

The error I am receiving is;

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

The integration looks like below;

resource "aws_api_gateway_integration" "approve_get_integration_POST" {
  rest_api_id                 = aws_api_gateway_rest_api.ccc_api.id
  resource_id                 = aws_api_gateway_resource.QuestionnaireResponseID.id
  http_method                 = aws_api_gateway_method.approve_get_integration_POST.http_method
  integration_http_method     = "POST"
  type                        = "AWS"
  passthrough_behavior        = "NEVER"
  uri                         = "arn:aws:states:us-west-2:1431651122:StartExecution/ccc-step-function-POST"

  request_templates = {
    "application/json" = <<EOF
{
  "Comment": "Test express state machine",
  "StartAt": "Validate",
  "States": {
    "Validate": {
      "Type": "Task",
      "Resource": "arn:aws:states:::lambda:invoke",
      "OutputPath": "$.Payload",
      "Parameters": {
        "Payload.$": "$",
        "FunctionName": "arn:aws:lambda:us-west-2:65163961147:function:sb-ccc-validate-submission:$LATEST"
      },
      "Retry": [
        {
          "ErrorEquals": [
            "Lambda.ServiceException",
            "Lambda.AWSLambdaException",
            "Lambda.SdkClientException"
          ],
          "IntervalSeconds": 2,
          "MaxAttempts": 6,
          "BackoffRate": 2
        }
      ],
      "Next": "CheckForValidateError"
    },
    "CheckForValidateError": {
      "Type": "Choice",
      "Choices": [
        {
          "Not": {
            "Variable": "$.statusCode",
            "NumericEquals": 200
          },
          "Next": "ValidateFailError"
        }
      ],
      "Default": "Create"
    },
    "ValidateFailError": {
      "Type": "Succeed"
    },
EOF
  }
}```

from what I have read that URI is correct and should be deploying ok.
1 Answers

For AWS integrations, the URI should be of the form

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