-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
aws_lambda_function ResourceConflictException due to a concurrent update operation #5154
Comments
Has anyone found a workaround for this? It has shown up for some of our Lambda functions and we're now unable to deploy them using Terraform. |
Looks like the serverless folks are hitting this issue too, so perhaps an AWS bug? serverless/serverless#4964 |
Running |
OK, I've figured out what's happening here based on a comment here: AWS has some sort of limit on how many concurrent modifications you can make to a Lambda function. In our code, we had a bunch of resources like this: resource "aws_lambda_permission" "foo" {
statement_id = "foo"
action = "lambda:InvokeFunction"
function_name = "${var.lambda_function_name}"
principal = "apigateway.amazonaws.com"
}
resource "aws_lambda_permission" "bar" {
statement_id = "bar"
action = "lambda:InvokeFunction"
function_name = "${var.lambda_function_name}"
principal = "apigateway.amazonaws.com"
}
resource "aws_lambda_permission" "baz" {
statement_id = "baz"
action = "lambda:InvokeFunction"
function_name = "${var.lambda_function_name}"
principal = "apigateway.amazonaws.com"
} It turns out that each of these modifies the Lambda function in the resource "aws_lambda_permission" "foo" {
statement_id = "foo"
action = "lambda:InvokeFunction"
function_name = "${var.lambda_function_name}"
principal = "apigateway.amazonaws.com"
}
resource "aws_lambda_permission" "bar" {
statement_id = "bar"
action = "lambda:InvokeFunction"
function_name = "${var.lambda_function_name}"
principal = "apigateway.amazonaws.com"
depends_on = ["aws_lambda_permission.foo"]
}
resource "aws_lambda_permission" "baz" {
statement_id = "baz"
action = "lambda:InvokeFunction"
function_name = "${var.lambda_function_name}"
principal = "apigateway.amazonaws.com"
depends_on = ["aws_lambda_permission.bar"]
} |
Well, if you take a look at my postе, this is what we tried as well. Even though there might be a workaround like this, I think it's still a bug. |
I saw you mentioned:
But for me, it definitely fixed it.
Yes, 100% a bug. |
And today the bug is back. The I've now resorted to a crappy workaround: run |
This cropped up for me today creating two |
This is happening for me as well (same terraform stuff, Lambda function + CW event target + CW event + permission) . I have tried in both region us-east-1 and us-west-2 and it's happening in both the regions. |
Running into the same issue here. @apparentlymart Do we know if someone's working on this? |
I am seeing this error today with a very simple setup. API Gateway with Lambda Proxy. I added code to force Terraform to re-deploy the API on configuration changes (by updating the Seeing as the deployment setup I'm attempting is a workaround I will revert it and go back to manually deploying the API after changes. I am still using v1.60 of the AWS provider. Terraform v0.11.13. |
Adding a |
This is definitely still happening, been running into this exact issue for a few days now. |
@Aerendel fyi, daisy chaining the resources with depends_on worked for me |
I have found that terraform tries to create two I found that that I had the The terraform AWS provider should probably take the no more than 1 AWS permission being set at once into account however. |
ResourceConflictException: The function could not be updated due to a concurrent update operation. hashicorp/terraform-provider-aws#5154
Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you! |
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. |
Community Note
Terraform Version
Terraform v0.11.7
Affected Resource(s)
aws_lambda_function
Terraform Configuration Files
This is an extract of my main terraform file, it shows all the resources relevant to the issue:
A lot of the
depends_on
statements were added later to try to solve the issue but it did not really make a difference.Debug Output
Expected Behavior
Should modify the Lambda function with the updated source code without crashing.
Actual Behavior
Throws an error and only works on the second try
The text was updated successfully, but these errors were encountered: