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_alias try and fail being updated in line when Lambda function name is changed #10298

Closed
gileri opened this issue Sep 30, 2019 · 3 comments · Fixed by #11170
Closed
Assignees
Labels
bug Addresses a defect in current functionality. service/lambda Issues and PRs that pertain to the lambda service.
Milestone

Comments

@gileri
Copy link
Contributor

gileri commented Sep 30, 2019

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 v0.12.9

  • provider.aws v2.30.0

Affected Resource(s)

  • aws_lambda_alias

Terraform Configuration Files

resource "aws_lambda_function" "example" {
  function_name = "example"
 # Other attributes
}

resource "aws_lambda_alias" "example_prod" {
  name             = "prod"
  function_name    = aws_lambda_function.example.arn
  function_version = "$LATEST"
}

Expected Behavior

Terraform should I believe :

  1. Destroy the lambda alias
  2. Destroy the lambda function
  3. Create the lambda function
  4. Create the alias

Actual Behavior

  # aws_lambda_function.example must be replaced
-/+ resource "aws_lambda_function" "example" {
      ~ arn                            = "arn:aws:lambda:eu-central-1:1234:function:example" -> (known after apply)
      ~ function_name                  = "example" -> "example-new" # forces replacement
[...]
  # aws_lambda_alias.example_prod will be updated in-place
  ~ resource "aws_lambda_alias" "transactional_retry_prod" {
        arn              = "arn:aws:lambda:eu-central-1:1234:function:example:prod"
      ~ function_name    = "arn:aws:lambda:eu-central-1:1234:function:example" -> (known after apply)
        function_version = "$LATEST"
        id               = "arn:aws:lambda:eu-central-1:1234:function:example:prod"
        invoke_arn       = "<ARN>"
        name             = "prod"
    }
[
Error: Error updating Lambda alias: ResourceNotFoundException: Alias not found: arn:aws:lambda:eu-central-1:1234:function:example:prod
        status code: 404, request id: 00c68f23-32ed-437d-a18d-a84f27ba9a54

  on example.tf line 31, in resource "aws_lambda_alias" "example_prod":
  31: resource "aws_lambda_alias" "example_prod" {

Steps to Reproduce

  1. Create a lambda, and an lambda alias
  2. terraform apply
  3. Change the function_name of the lambda in Terraform.
  4. terraform apply

References

@ghost ghost added the service/lambda Issues and PRs that pertain to the lambda service. label Sep 30, 2019
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Sep 30, 2019
@ryndaniels ryndaniels added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Nov 29, 2019
@bflad bflad self-assigned this Feb 20, 2020
@bflad bflad added this to the v2.54.0 milestone Mar 16, 2020
@bflad
Copy link
Contributor

bflad commented Mar 16, 2020

The fix for this has been merged and will release with version 2.54.0 of the Terraform AWS Provider, later this week. Thanks to @eservent for the implementation. 👍

@ghost
Copy link

ghost commented Mar 19, 2020

This has been released in version 2.54.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Apr 16, 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 16, 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

Successfully merging a pull request may close this issue.

3 participants