Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I zip a folder via `archive_file` Terraform

Tags:

terraform

I am using terraform to zip a folder as below code.

data "archive_file" "src" {
  type        = "zip"
  source_dir  = "dist"
  output_path = ".build/src.zip"
}

It creates the zip file src.zip in .build directory. But the src.zip doesn't include the root folder which is dist. How can I zip the folder include the folder itself?

like image 794
Joey Yi Zhao Avatar asked Dec 14 '25 20:12

Joey Yi Zhao


1 Answers

So currently you're zipping a folder structure that looks like this:

dist
    ...

Is there anything stopping you from zipping a folder structure that looks like this?

my_archive_file_target
    dist
        ...
like image 167
Dan Monego Avatar answered Dec 16 '25 18:12

Dan Monego



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!