Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Importing lambda_alias sets function_name to ARN #14478

Closed
terlar opened this issue Aug 5, 2020 · 4 comments
Closed

Importing lambda_alias sets function_name to ARN #14478

terlar opened this issue Aug 5, 2020 · 4 comments
Labels
service/lambda Issues and PRs that pertain to the lambda service.
Milestone

Comments

@terlar
Copy link

terlar commented Aug 5, 2020

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 other comments that do not add relevant new information or questions, 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 CLI and Terraform AWS Provider Version

Terraform v0.12.28
AWS Provider v2.70.0

Affected Resource(s)

  • aws_lambda_alias

Terraform Configuration Files

resource "aws_lambda_function" "test_lambda" {
  filename      = "lambda_function_payload.zip"
  function_name = "lambda_function_name"
  handler       = "exports.test"

  source_code_hash = filebase64sha256("lambda_function_payload.zip")

  runtime = "nodejs12.x"
}

resource "aws_lambda_alias" "test_lambda_alias" {
  name             = "my_alias"
  description      = "a sample description"
  function_name    = aws_lambda_function.test_lambda.function_name
  function_version = "1"
}

Expected Behavior

terraform state show aws_lambda_alias.test_lambda_alias
# aws_lambda_alias.test_lambda_alias:
resource "aws_lambda_alias" "test_lambda_alias" {
    arn              = "arn:aws:lambda:us-east-1:000000000000:function:lambda_function_name:my_alias"
    function_name    = "lambda_function_name"
    function_version = "1"
    id               = "arn:aws:lambda:us-east-1:000000000000:function:lambda_function_name:my_alias"
    name             = "my_alias"
}

Actual Behavior

terraform state show aws_lambda_alias.test_lambda_alias
# aws_lambda_alias.test_lambda_alias:
resource "aws_lambda_alias" "test_lambda_alias" {
    arn              = "arn:aws:lambda:us-east-1:000000000000:function:lambda_function_name:my_alias"
    function_name    = "arn:aws:lambda:us-east-1:000000000000:function:lambda_function_name"
    function_version = "1"
    id               = "arn:aws:lambda:us-east-1:000000000000:function:lambda_function_name:my_alias"
    name             = "my_alias"
}

Steps to Reproduce

  1. terraform apply
  2. terraform state rm aws_lambda_alias.test_lambda_alias
  3. terraform import aws_lambda_alias.test_lambda_alias lambda_function_name/my_alias

References

Importing an aws_lambda_alias will set function_name to ARN. However this does not work together with aws_lambda_provisioned_concurrency_config. As per the specified ticket.

@ghost ghost added the service/lambda Issues and PRs that pertain to the lambda service. label Aug 5, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Aug 5, 2020
@bflad bflad added this to the v3.0.0 milestone Aug 5, 2020
@bflad
Copy link
Contributor

bflad commented Aug 5, 2020

Hi @terlar 👋 Thank you for submitting this. This import behavior was fixed with Version 3 of the Terraform AWS Provider since we consider changes like this to be breaking. Once upgraded, this automatic switch from name to ARN should no longer be an issue during import. 👍

@bflad bflad closed this as completed Aug 5, 2020
@terlar
Copy link
Author

terlar commented Aug 5, 2020

Oh, what are the odds, sorry, should have checked that a new version was released, I just installed the latest one the other week, so wasn't aware of this. Thank you for fixing it!

@terlar
Copy link
Author

terlar commented Aug 5, 2020

BTW, that link doesn't work for me, just a white page, is it something wrong on my end? I see this for the whole https://registry.terraform.io

@ghost
Copy link

ghost commented Sep 4, 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 Sep 4, 2020
@breathingdust breathingdust removed the needs-triage Waiting for first response or review from a maintainer. label Sep 17, 2021
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
service/lambda Issues and PRs that pertain to the lambda service.
Projects
None yet
Development

No branches or pull requests

3 participants