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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating layer not triggering lambda alias update #12419

Open
VIKASPATID opened this issue Mar 17, 2020 · 1 comment
Open

Updating layer not triggering lambda alias update #12419

VIKASPATID opened this issue Mar 17, 2020 · 1 comment
Labels
service/lambda Issues and PRs that pertain to the lambda service. waiting-response Maintainers are waiting on response from community or contributor.

Comments

@VIKASPATID
Copy link

VIKASPATID commented Mar 17, 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 Version

Terraform v0.12.21

Affected Resource(s)

aws_lambda_alias

Terraform Configuration Files

data "archive_file" "lambda_layer_zip" {
  type        = "zip"
  source_dir  = "../layer/"
  output_path = "./layer.zip"
}

resource "aws_lambda_layer_version" "test_layer" {
  filename              = data.archive_file.lambda_layer_zip.output_path
  source_code_hash      = data.archive_file.lambda_layer_zip.output_base64sha256
  layer_name            = "test-layer"
  compatible_runtimes   = ["python3.8"]
}

data "archive_file" "function_zip" {
  type        = "zip"
  source_dir  = "../function/"
  output_path = "./function.zip"
}

resource "aws_lambda_function" "test_function" {
  function_name     = "TestFunction"
  filename          = data.archive_file.function_zip.output_path
  source_code_hash  = data.archive_file.function_zip.output_base64sha256
  handler           = "file.event_handler"
  memory_size       = 128
  timeout           = 60
  runtime           = "python3.8"
  layers            = [aws_lambda_layer_version.test_layer.arn]
  role              = data.aws_iam_role.service_role.arn
  publish           = true
}


resource "aws_lambda_alias" "live_alias" {
  name             = "live"
  description      = "Alias named live"
  function_name    = aws_lambda_function.test_function.arn
  function_version = aws_lambda_function.test_function.version
}

Terraform Plan/Apply Output

Terraform will perform the following actions:

  #aws_lambda_function.test_function will be updated in-place
  ~ resource "aws_lambda_function" "test_function" {
        arn                            = "arn:aws:lambda:us-east-1:xxxxxxxxx:function:TestFunction"
        filename                       = "./function.zip"
        function_name                  = "TestFunction"
        handler                        = "file.event_handler"
        id                             = "TestFunction"
        invoke_arn                     = "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:xxxxxxxxx:function:TestFunction/invocations"
        last_modified                  = "2020-03-17T07:07:54.388+0000"
      ~ layers                         = [
          - "arn:aws:lambda:us-east-1:xxxxxxxx:layer:test-layer:3",
        ] -> (known after apply)
        memory_size                    = 128
        publish                        = true
        qualified_arn                  = "arn:aws:lambda:us-east-1:xxxxxxxxx:function:TestFunction:3"
        reserved_concurrent_executions = -1
        role                           = "arn:aws:iam::xxxxxxxxxx:role/service-execution-iam-role"
        runtime                        = "python3.8"
        source_code_hash               = "37GBoC23gPCJjXByNhvpb//tL/oPDtOuKgIH9+iTRQY="
        source_code_size               = 201
        tags                           = {}
        timeout                        = 60
        version                        = "3"

        tracing_config {
            mode = "PassThrough"
        }
    }

  # aws_lambda_layer_version.test_layer must be replaced
-/+ resource "aws_lambda_layer_version" "test_layer" {
      ~ arn                 = "arn:aws:lambda:us-east-1:xxxxxxxxxx:layer:test-layer:3" -> (known after apply)
        compatible_runtimes = [
            "python3.8",
        ]
      ~ created_date        = "2020-03-17T07:07:54.237+0000" -> (known after apply)
        filename            = "./layer.zip"
      ~ id                  = "arn:aws:lambda:us-east-1:xxxxxxxxx:layer:test-layer:3" -> (known after apply)
      ~ layer_arn           = "arn:aws:lambda:us-east-1:xxxxxxx:layer:test-layer" -> (known after apply)
        layer_name          = "test-layer"
      ~ source_code_hash    = "7/8pf+lQgFMJfm+MIEboG+1sd5EBz36mw5Eczq15/6A=" -> "zjJMlGy7/M1po4YAhxhrPeUNDzViAQ+YF+2mBotbp2E=" # forces replacement
      ~ source_code_size    = 188 -> (known after apply)
      ~ version             = "3" -> (known after apply)
    }

Expected Behavior

It is expected to update lambda alias to point to the newest version

Actual Behavior

On updating layer code, layer version increased, lambda function also got updated (function version increased). But lambda alias is still pointing to the previous version

@ghost ghost added the service/lambda Issues and PRs that pertain to the lambda service. label Mar 17, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Mar 17, 2020
@VIKASPATID VIKASPATID changed the title Updating layer does not trigger lambda alias update Updating layer not triggering lambda alias update Mar 17, 2020
@justinretzolk
Copy link
Member

Hey @VIKASPATID 馃憢 Thank you for taking the time to file this issue. Given that there's been a number of AWS provider releases since you initially filed this, can you confirm whether you're still experiencing this behavior?

@justinretzolk justinretzolk added waiting-response Maintainers are waiting on response from community or contributor. and removed needs-triage Waiting for first response or review from a maintainer. labels Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service/lambda Issues and PRs that pertain to the lambda service. waiting-response Maintainers are waiting on response from community or contributor.
Projects
None yet
Development

No branches or pull requests

2 participants