aws-ia / terraform-aws-runtask-iam-access-analyzer

Apache License 2.0
12 stars 4 forks source link

Archive directory not found error #83

Closed msato0731 closed 1 year ago

msato0731 commented 1 year ago

I get the following error when running terraform.

Planning failed. Terraform encountered an error while generating this plan.

╷
│ Error: error archiving directory: could not archive missing directory: .terraform/modules/runtask-iam-access-analyzer/lambda/runtask_eventbridge/site-packages/
│ 
│   with module.runtask-iam-access-analyzer.data.archive_file.runtask_eventbridge,
│   on .terraform/modules/runtask-iam-access-analyzer/data.tf line 15, in data "archive_file" "runtask_eventbridge":
│   15: data "archive_file" "runtask_eventbridge" {
│ 
╵
╷
│ Error: error archiving directory: could not archive missing directory: .terraform/modules/runtask-iam-access-analyzer/lambda/runtask_request/site-packages/
│ 
│   with module.runtask-iam-access-analyzer.data.archive_file.runtask_request,
│   on .terraform/modules/runtask-iam-access-analyzer/data.tf line 21, in data "archive_file" "runtask_request":
│   21: data "archive_file" "runtask_request" {
│ 
╵
╷
│ Error: error archiving directory: could not archive missing directory: .terraform/modules/runtask-iam-access-analyzer/lambda/runtask_fulfillment/site-packages/
│ 
│   with module.runtask-iam-access-analyzer.data.archive_file.runtask_fulfillment,
│   on .terraform/modules/runtask-iam-access-analyzer/data.tf line 27, in data "archive_file" "runtask_fulfillment":
│   27: data "archive_file" "runtask_fulfillment" {
│ 
╵
╷
│ Error: error archiving directory: could not archive missing directory: .terraform/modules/runtask-iam-access-analyzer/lambda/runtask_callback/site-packages
│ 
│   with module.runtask-iam-access-analyzer.data.archive_file.runtask_callback,
│   on .terraform/modules/runtask-iam-access-analyzer/data.tf line 33, in data "archive_file" "runtask_callback":
│   33: data "archive_file" "runtask_callback" {
│ 
╵

Here's what we ran.

terraform plan
# main.tf

module "runtask-iam-access-analyzer" {
  source           = "aws-ia/runtask-iam-access-analyzer/aws"
  version          = "0.0.2"
  aws_region       = "ap-northeast-1"
  tfc_org          = "<my-organization>"
  workspace_prefix = "test"
  deploy_waf       = false
}

Looking in the modules directory, there is no site-packages directory.

I removed site-pacages from the source_dir of data.tf in modules/ and the zip file was created successfully.

I do not think this approach is the correct response. How should we respond?

wellsiau-aws commented 1 year ago

Hi @msato0731

The error indicates that the Lambda source code is not build properly.

│ Error: error archiving directory: could not archive missing directory: .terraform/modules/runtask-iam-access-analyzer/lambda/runtask_eventbridge/site-packages/

Have you tried to run make all on the root of the module directory as indicated here

msato0731 commented 1 year ago

@wellsiau-aws

Thank you for answering.

The error was resolved when make all was done in the lambda directory of the installed module.