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

aws_lambda_function data source never updates, especially when qualifier changes #4593

Closed
t-pascal opened this issue May 18, 2018 · 4 comments
Labels
bug Addresses a defect in current functionality. service/lambda Issues and PRs that pertain to the lambda service.

Comments

@t-pascal
Copy link

t-pascal commented May 18, 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

$ terraform -v
Terraform v0.11.7
+ provider.aws v1.19.0

Affected Resource(s)

  • aws_lambda_function (data source)

Terraform Configuration Files

data "aws_lambda_function" "mylambda" {
  function_name = "my_function"
  qualifier     = "1"
}

output "mylambda_version" {
  value = "${data.aws_lambda_function.mylambda.qualified_arn}"
}

Debug Output

Panic Output

Expected Behavior

Apply:
mylambda_version = arn:aws:lambda:us-east-1:123456789:function:my_function:1

Change value to 2 and apply:
mylambda_version = arn:aws:lambda:us-east-1:123456789:function:my_function:2

Actual Behavior

Apply:

$terraform apply
provider.aws.region
  The region where AWS operations will take place. Examples
  are us-east-1, us-west-2, etc.

  Default: us-east-1
  Enter a value:

data.aws_lambda_function.mylambda: Refreshing state...

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:

mylambda_version = arn:aws:lambda:us-east-1:12345678:function:my_function:1

Change qualifier:

data "aws_lambda_function" "mylambda" {
  function_name = "my_function"
  qualifier     = "2"
}

output "mylambda_version" {
  value = "${data.aws_lambda_function.mylambda.qualified_arn}"
}

Reapply:

$terraform apply
provider.aws.region
  The region where AWS operations will take place. Examples
  are us-east-1, us-west-2, etc.

  Default: us-east-1
  Enter a value:

data.aws_lambda_function.mylambda: Refreshing state...

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:

mylambda_version = arn:aws:lambda:us-east-1:123456789:function:my_function:1

Taint???

terraform taint data.aws_lambda_function.mylambda
Resource 'data.aws_lambda_function.mylambda' cannot be tainted

Steps to Reproduce

  1. terraform apply

  2. Verify outputs

  3. Change qualifier

  4. terraform apply

  5. Verify outputs are unchanged

  6. In fact, data resource seems to never update again

Important Factoids

References

See #2984

@bflad bflad added bug Addresses a defect in current functionality. service/lambda Issues and PRs that pertain to the lambda service. labels May 22, 2018
@t-pascal
Copy link
Author

I think I have verified that this bug in the data resource only returns the $LATEST version of the lambda, apparently ignoring the QUALIFIER flag.

@t-pascal
Copy link
Author

t-pascal commented Jun 15, 2018

I have no idea what changed, but the provider 1.23.0 seems to have fixed this issue? I will close this after a while if no one notices. Magic?

$ terraform -v
Terraform v0.11.7
+ provider.aws v1.23.0

@t-pascal
Copy link
Author

Confirmed that this was fixed in 1.21.0 (2018 31 May) in PR #4654

@ghost
Copy link

ghost commented Apr 5, 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 and limited conversation to collaborators Apr 5, 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/lambda Issues and PRs that pertain to the lambda service.
Projects
None yet
Development

No branches or pull requests

2 participants