Skip to content

Source code changes missed due to InvalidParameterValueException #678

Open
@pjungels-paraport

Description

@pjungels-paraport

Description

Encountering InvalidParameterValueException (and perhaps other exceptions) during terraform apply causes source code changes to be missed. Subsequent successful terraform apply steps continue to miss original code changes.

Versions

  • Module version [Required]: 7.20.2

  • Terraform version: 1.3.8

  • Provider version(s): hashicorp/aws v5.97.0

Reproduction Code [Required]

Steps to reproduce the behavior:

  1. Run terraform apply with Lambda module:
module "lambda_function" {
  source = "terraform-aws-modules/lambda/aws"

  function_name = "my-lambda1"
  handler       = "index.lambda_handler"
  runtime       = "python3.11"

  create_package = true
  source_path = "../src/lambda-function1"
}
  1. In AWS Console, manually edit the Lambda's runtime management configuration: 1) set "Update runtime version" to Manual and 2) supply a version ARN (e.g. arn:aws:lambda:us-east-1::runtime:93841db3a9beab9ac5a6a1822362b2f10a99e5edf5f36ba23aec15e41ff97311)
  2. Modify Lambda function's source code (e.g., add a comment, add a log statement, etc.) and change the runtime in the Terraform to "python3.12"
  3. Run terraform apply. This will fail with message "Error: updating Lambda Function (my-lambda1) configuration: operation error Lambda: UpdateFunctionConfiguration, https response error StatusCode: 400, RequestID: 55289fd5-e9e9-4357-8627-cc046c827ac9, InvalidParameterValueException: Cannot change runtime identifier when runtime management configuration is set to 'Manual'. Change the runtime management configuration to 'Auto' or 'FunctionUpdate', then retry."
  4. In AWS Console, manually edit the Lambda's runtime management configuration: set "Update runtime version" to Auto.
  5. Re-run terraform apply.

Expected behavior

Terraform apply runs successfully, the Lambda's runtime is modified to Python 3.12, and the source code change from step 3 is applied.

Actual behavior

Terraform apply runs successfully and the Lambda's runtime is modified to Python 3.12. However, the source code change from step 3 is NOT applied.

Additional context

Introducing a new code change (which changes the hash) before a subsequent terraform apply will cause the source code to update properly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions