Lambda archive_file output_path error in module

Hi everyone.
I have embarked on moving our aws_lambda_function to a module to make things more abstract and reusable. This was a working code in production previously.
Unfortunately now that they are in the module, I have experienced error in the zip file content access for the aws_lambda_function when this terraform plan is executed in our Jenkins pipeline. The error is:
Unable to load “<zip file path’>”: open <zip file path’>: no such file or directory

The weird thing is, when I run it locally with my personal aws account it worked.
The source_file path works, and the zip file is placed where I expected them.
This is the folder structure:
– root folder
---- functions
---- terraform
------ modules

data "archive_file" "js" {
  type        = "zip"
  source_file = "functions/${var.folder_name}/index.js"
  output_path = "functions/${var.folder_name}/index.zip"
}

resource "aws_lambda_function" "fn" {
  filename          = data.archive_file.js.output_path
  function_name     = var.name
  role              = aws_iam_role.lambda_role.arn
  handler           = var.handler
  runtime           = var.runtime
  source_code_hash  = data.archive_file.js.output_base64sha256

  environment {
    variables = var.environment_variables
  }
}

Any insights is appreciated.

Darren.

You probably want to use path.module or path.root: References to Values - Configuration Language - Terraform by HashiCorp