1

I am trying to create or update Lambdas on AWS using the Terraform CDKTF. During deployment, I am getting the error of

"An event source mapping with SQS arn (\" arn:aws:sqs:eu-west-2:*******:*****-*****-******** \") and function (\" ******-******-****** \") already exists. Please update or delete the existing mapping with UUID *******-****-****-****-***********"

**** are sensitive info I have swapped out.

Some of our Lambdas are called via SQS, which is what this mapping is referring to. I assumed the first fix would be to remove the mappings that might already exist (on a previous deployment that might have partly gone through), but I am unsure where to find them, nor if they are even available to delete. I originally assumed by calling cdktf deploy it would update these mappings and not throw the err at all.

Does anyone have any advice?

Prabhat Mishra
  • 951
  • 2
  • 12
  • 33
  • If you have the UUID of this event source map, you can delete it using `aws lambda delete-event-source-mapping --uuid `. Just be careful because there is no way to revert it. – Juan Fontes Dec 16 '21 at 04:23

1 Answers1

0

Your diagnosis seems right, there might be some stray resources left behind due to an aborted / unfinished Terraform run. You should be able to clean up after these runs by running terraform destroy in the stack directory ./cdktf.out/stacks/..../. That should delete all previously existing resources created through this Terraform stack.

Daniel Schmidt
  • 11,605
  • 5
  • 38
  • 70