terraform-provider-archive icon indicating copy to clipboard operation
terraform-provider-archive copied to clipboard

New tar archive sets file perms and last modified timestamps incorrectly

Open lewisdan91 opened this issue 5 months ago • 0 comments

Terraform CLI and Provider Versions

Terraform v1.8.3 hashicorp/archive version 2.6.0

Terraform Configuration

data "archive_file" "create_tar" {
  type        = "tar.gz"
  output_path = "mytar.tgz"
  output_file_mode = 0644

  source {
    content  = local_file.bundle_json.content
    filename = local.bundle
  }

  source {
    content  = data.local_file.main_js.content
    filename = local.main_js
  }
}

Expected Behavior

Files inside tar should have correct file permissions and retain last modified timestamps.

Actual Behavior

If output_file_mode is set, random file perms and incorrect last modified timestamps are shown:

$ tar -xvf mytar.tgz 
bundle.json
main.js
$ ls -l
total 32
--w----r-- 1 daniel users    83 Jan  1  1970 bundle.json
--w----r-- 1 daniel users 12746 Jan  1  1970 main.js
-rw-r--r-- 1 daniel users  3929 Sep 18 14:05 mytar.tgz

If no output_file_mode is set no file perms are set and incorrect last modified timestamps are shown:

$ tar -xvf mytar.tgz 
bundle.json
main.js
$ ls -l
total 32
---------- 1 daniel users    83 Jan  1  1970 bundle.json
---------- 1 daniel users 12746 Jan  1  1970 main.js
-rw-r--r-- 1 daniel users  3922 Sep 18 14:03 mytar.tgz

Steps to Reproduce

  1. terraform apply

How much impact is this issue causing?

High

Logs

No response

Additional Information

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

lewisdan91 avatar Sep 18 '24 13:09 lewisdan91