Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api gateway v2 integration: Invalid integration URI specified when renaming a SQS queue #15861

Closed
shouze opened this issue Oct 27, 2020 · 6 comments · Fixed by #15894
Closed
Assignees
Labels
bug Addresses a defect in current functionality. service/apigatewayv2 Issues and PRs that pertain to the apigatewayv2 service.
Milestone

Comments

@shouze
Copy link

shouze commented Oct 27, 2020

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

@ghost ghost added the service/apigatewayv2 Issues and PRs that pertain to the apigatewayv2 service. label Oct 27, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Oct 27, 2020
@ewbankkit ewbankkit added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Oct 28, 2020
@ewbankkit
Copy link
Contributor

@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

@ewbankkit ewbankkit self-assigned this Oct 28, 2020
@ewbankkit
Copy link
Contributor

Related: #14761.

@ewbankkit
Copy link
Contributor

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
}

@shouze
Copy link
Author

shouze commented Oct 28, 2020

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

@ghost
Copy link

ghost commented Oct 29, 2020

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!

@ghost
Copy link

ghost commented Nov 29, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Nov 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/apigatewayv2 Issues and PRs that pertain to the apigatewayv2 service.
Projects
None yet
3 participants