Terraform-provider-aws: api gateway v2 integration: Invalid integration URI specified when renaming a SQS queue

Created on 27 Oct 2020  路  5Comments  路  Source: hashicorp/terraform-provider-aws

Community Note

  • Please vote on this issue by adding a 馃憤 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

Terraform v0.13.5

  • provider registry.terraform.io/-/archive v2.0.0
  • provider registry.terraform.io/-/aws v3.12.0
  • provider registry.terraform.io/hashicorp/aws v3.12.0

Affected Resource(s)

  • aws_apigatewayv2_integration

Terraform Configuration Files

resource "aws_apigatewayv2_integration" "passbase_webhook" {
  api_id              = aws_apigatewayv2_api.passbase_webhook.id
  description         = "Convert Passbase webhook to SQS events"
  credentials_arn     = aws_iam_role.gogaille_api_gateway_passbase_webhook.arn
  integration_type    = "AWS_PROXY"
  integration_subtype = "SQS-SendMessage"
  request_parameters = {
    "QueueUrl"       = module.consumer_passbase.sqs_queue.id
    "MessageGroupId" = "$request.body.authentication_key"
    "MessageBody"    = "$request.body"
  }
}

Debug Output

I don't have the debug output as it was running on our ci and manually fixed since because of an emergency.
However, here's the terraform plan:
https://gist.github.com/shouze/c7ca21c6dbbcfc310f3ee28817698144

Panic Output

Here's the result of the apply:

aws_apigatewayv2_integration.passbase_webhook: Modifying... [id=ttltots]

Error: error updating API Gateway v2 integration: BadRequestException: Invalid integration URI specified


Error: Process completed with exit code 1.

Expected Behavior

The QueueUrl should have been renamed into the api gateway v2 integration.

Actual Behavior

The QueueUrl should have not been renamed into the api gateway v2 integration. However the state was updated whith the new queue url (when I terraform state show the resource I effectively have the new name after the failed apply). And on subsequent applies after this failure, I still encounter the same failure.

Steps to Reproduce

  1. Create an api gateway v2 sqs integration and apply it
  2. Rename the queue and apply.

Important Factoids


Nothing to mention.

References

  • #14761 as it could be related, or some kind of lifecycle issue maybe?
bug servicapigatewayv2

Most helpful comment

@shouze Thanks for raising this issue.
I can reproduce with an updated acceptance test:

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSAPIGatewayV2Integration_AwsServiceIntegration'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSAPIGatewayV2Integration_AwsServiceIntegration -timeout 120m
=== RUN   TestAccAWSAPIGatewayV2Integration_AwsServiceIntegration
=== PAUSE TestAccAWSAPIGatewayV2Integration_AwsServiceIntegration
=== CONT  TestAccAWSAPIGatewayV2Integration_AwsServiceIntegration
    resource_aws_apigatewayv2_integration_test.go:414: Step 2/3 error: Error running apply: 2020/10/28 11:42:03 [DEBUG] Using modified User-Agent: Terraform/0.12.26 HashiCorp-terraform-exec/0.10.0

        Error: error updating API Gateway v2 integration: BadRequestException: Invalid integration URI specified


--- FAIL: TestAccAWSAPIGatewayV2Integration_AwsServiceIntegration (24.44s)
FAIL
FAIL    github.com/terraform-providers/terraform-provider-aws/aws   24.494s
FAIL
GNUmakefile:27: recipe for target 'testacc' failed
make: *** [testacc] Error 1

All 5 comments

@shouze Thanks for raising this issue.
I can reproduce with an updated acceptance test:

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSAPIGatewayV2Integration_AwsServiceIntegration'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSAPIGatewayV2Integration_AwsServiceIntegration -timeout 120m
=== RUN   TestAccAWSAPIGatewayV2Integration_AwsServiceIntegration
=== PAUSE TestAccAWSAPIGatewayV2Integration_AwsServiceIntegration
=== CONT  TestAccAWSAPIGatewayV2Integration_AwsServiceIntegration
    resource_aws_apigatewayv2_integration_test.go:414: Step 2/3 error: Error running apply: 2020/10/28 11:42:03 [DEBUG] Using modified User-Agent: Terraform/0.12.26 HashiCorp-terraform-exec/0.10.0

        Error: error updating API Gateway v2 integration: BadRequestException: Invalid integration URI specified


--- FAIL: TestAccAWSAPIGatewayV2Integration_AwsServiceIntegration (24.44s)
FAIL
FAIL    github.com/terraform-providers/terraform-provider-aws/aws   24.494s
FAIL
GNUmakefile:27: recipe for target 'testacc' failed
make: *** [testacc] Error 1

It seems like the integration type, integration subtype and all required request parameters must be specified on update even if they don't change.

$ aws --region us-west-2 apigatewayv2 update-integration --api-id msgieufude --integration-id kwfjxsa --request-parameters QueueUrl=https://sqs.us-west-2.amazonaws.com/123456789012/issue-15861-1,MessageBody=\$request.body --integration-type AWS_PROXY --integration-subtype SQS-SendMessage
{
    "ConnectionType": "INTERNET",
    "CredentialsArn": "arn:aws:iam::123456789012:role/issue-15861",
    "Description": "Test SQS send",
    "IntegrationId": "kwfjxsa",
    "IntegrationSubtype": "SQS-SendMessage",
    "IntegrationType": "AWS_PROXY",
    "PayloadFormatVersion": "1.0",
    "RequestParameters": {
        "QueueUrl": "https://sqs.us-west-2.amazonaws.com/123456789012/issue-15861-1",
        "MessageBody": "$request.body"
    },
    "TimeoutInMillis": 29000
}

It seems like the integration type, integration subtype and all required request parameters must be specified on update even if they don't change.

Makes sense about the error message which is returned directly by aws SDK I guess: BadRequestException: Invalid integration URI specified

This has been released in version 3.13.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

Was this page helpful?
0 / 5 - 0 ratings