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

Altering imported Lambda function resource results in a diffs didn't match during apply error #5742

Closed
bleggett opened this issue Aug 31, 2018 · 4 comments
Labels
service/lambda Issues and PRs that pertain to the lambda service.

Comments

@bleggett
Copy link

bleggett commented Aug 31, 2018

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 "me too" comments, 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 Version

0.11.8

Affected Resource(s)

  • aws_lambda_function

Terraform Configuration Files

# Deploy the function with the correct role.
resource "aws_lambda_function" "proxyfunc" {
  function_name    = "${var.env_prefix}-proxyfunc"
  role             = "${aws_iam_role.lambda-role.arn}"
  handler          = "proxyfunc.handler"
  runtime          = "nodejs8.10"

  lifecycle {
    ignore_changes = [
      "function_name",
      "runtime",
      "handler"
    ]
  }
}

Have to use ignore_changes here, because I only want to update the function role for the existing function, and those 3 fields are required if I do not ignore them.

Debug Output

https://gist.github.com/bleggett/48dbc654c9e0f295e2a1a6ac997a1276

diffs didn't match during apply. This is a bug with Terraform and should be reported as a GitHub Issue.

Expected Behavior

Given a preexisting Lambda function named test-func

running

terraform import --function-name test-func
terraform apply -var env_prefix=fubar

should result in the function being imported, and the existing resource should be updated with the new role.

Actual Behavior

terraform input succeeds, terraform apply fails with the above diff exception.

Steps to Reproduce

terraform import --function-name test-func
terraform apply -var env_prefix=fubar
@bleggett
Copy link
Author

bleggett commented Aug 31, 2018

More info by following the below steps:

  1. Running terraform input on the Lambda function works.

  2. Running terraform apply does NOT show the correct set of changes for the lambda function (the lambda role is NOT updated), and fails with the same diff out of sync exception as before.

  3. And running terraform apply a second time immediately after the above step succeeds without a diff exception and outputs and performs the correct operation.

So weirdly if I just rerun apply it works the second time around.

@bleggett bleggett changed the title Altering imported Lambda function resource results in a diff error Altering imported Lambda function resource results in a diffs didn't match during apply error Aug 31, 2018
@bleggett
Copy link
Author

bleggett commented Sep 4, 2018

After some more investigation I am inclined to think this is an issue with core Terraform, and not this provider, though I lack the insight into the codebase to be sure of that.

@bflad bflad added the service/lambda Issues and PRs that pertain to the lambda service. label Sep 25, 2018
@aeschright aeschright added the needs-triage Waiting for first response or review from a maintainer. label Jun 24, 2019
@aeschright
Copy link
Contributor

Hi @bleggett ! Unfortunately the message you saw isn't enough for us to go on to investigate the error. The debugging situation should be improved if you upgrade to Terraform 0.12 and the latest AWS provider. If you still see an error in this situation, please open a new bug report and we'll dig into it. Thanks!

@aeschright aeschright removed the needs-triage Waiting for first response or review from a maintainer. label Jun 25, 2019
@ghost
Copy link

ghost commented Nov 3, 2019

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 and limited conversation to collaborators Nov 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/lambda Issues and PRs that pertain to the lambda service.
Projects
None yet
Development

No branches or pull requests

3 participants