Closed alexiskat closed 4 months ago
You should be able to provide and update statement_id
(see https://github.com/terraform-aws-modules/terraform-aws-lambda/blob/master/main.tf#L276):
allowed_triggers = {
("APIGW-Trigger-${var.serv}") = {
service = "apigateway"
source_arn = format("%s/*/%s%s", var.api_rest_exe_arn, var.api_method, var.api_resource_path)
statement_id = format("APIGW-Trigger-%s-%s-%s-%s", var.serv, var.api_rest_exe_arn, var.api_method, var.api_resource_path) # <- something like this
}
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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Description
Whenever a new trigger policy is required (because something has changed in the API GW config) I get the following error:
β Error: adding Lambda Permission (abcd-fd-2d-createGrid-post-api/APIGW-Trigger-fd-2d-createGrid-post): ResourceConflictException: The statement id (APIGW-Trigger-fd-2d-createGrid-post) provided already exists. Please provide a new statement id, or remove the existing statement.
Versions
Reproduction Code [Required]
Steps to reproduce the behavior:
I make a change to the API Gateway resource. For example, I change the HTTP method from a POST to a GET
This triggers the creation of a new policy to be created because of
var.api_method
in the belowExpected behavior
Lambda trigger policy to be deleted and a new one created.
Actual behavior
Terraform times outs after 10 minutes of trying to create the new policy and gives an error
Terminal Output Screenshot(s)
A workaround is to log into the console and manually delete the policy from Lambda and then Terraform can add the new one. I suspect the issue is with my configuration and not the module but any help with this would be great.
thanks alexis