Terraform - Lambda function unable to modify - Error: error modifying Lambda Function (lamda name)

I have created a lambda successfully thru terraform script. But now when I run an apply it throws the following error:

      Error: error modifying Lambda Function (mylambda) configuration 
     : ValidationException: 
     status code: 400, request id: d6c28f7c-49b4-4edd-848e-a2a763242e09

This is the code:

            data "archive_file" "lambda_zip_mylambda" {
                   type        = "zip"
                  source_dir = "./Packages/aaa/index"
                 excludes    = [ ".gitkeep" ]
                output_path = "./Packages/aaa/index/index.zip"
        }
              resource "aws_lambda_function" "mylambda" {
                      description      = "-"
                    function_name    = var.lambdafunctionname
                    handler          = "lambda_handler"
                    runtime          = "python3.8"
                      filename     = data.archive_file.lambda_zip_mylambda.output_path
                  source_code_hash =   
                                 data.archive_file.lambda_zip_mylambda.output_base64sha256
                                role             = var.lambda_role_arn
                                tags             = var.lambdatags
                                timeout          = 300
                                memory_size      = 128
                     }