'How do you set up an API Gateway Step Function integration using Terraform and aws_apigatewayv2_integration
I am looking for an example on how to start execution of a step function from API Gateway using Terraform and the aws_apigatewayv2_integration
resource. I am using an HTTP API (have only found an older example for REST API's on Stackoverflow).
Currently I have this:
resource "aws_apigatewayv2_integration" "workflow_proxy_integration" {
api_id = aws_apigatewayv2_api.default.id
credentials_arn = aws_iam_role.api_gateway_step_functions.arn
integration_type = "AWS_PROXY"
integration_subtype = "StepFunctions-StartExecution"
description = "The integration which will start the Step Functions workflow."
payload_format_version = "1.0"
request_parameters = {
StateMachineArn = aws_sfn_state_machine.default.arn
}
}
Right now, my State Machine receives an empty input ("input": {}
). When I try to add input
to the request_parameters
section, I get this error:
Error: error updating API Gateway v2 integration: BadRequestException: Parameter: input does not fit schema for Operation: StepFunctions-StartExecution.
Solution 1:[1]
I spent over an hour looking for a solution to a similar problem I was having with request_parameters
. AWS's documentation currently uses camelCase for their keys in all of their examples (stateMachineArn
, input
, etc.) so it made it difficult to research.
You'll want to use PascalCase for your keys, similar to how you already did for StateMachineArn
. So instead of input
, you'll use Input
.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Juniper Hovey |