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

Default file permission misleading

Open tibeer opened this issue 1 year ago • 2 comments

Terraform CLI and Provider Versions

Terraform v1.3.2 on darwin_arm64

  • provider registry.terraform.io/hashicorp/local v2.2.3

Terraform Configuration

resource "local_file" "dummy_file" {
  content  = "foobar"
  filename = "./dummy.txt"
}

Expected Behavior

File is created according to the default value for attribute file_permission (0777) which would mean:

tf@hashicorp example % ls -al dummy.txt
-rwxrwxrwx  1 tf  staff  6  8 Oct 16:02 dummy.txt

Actual Behavior

File is created with the default umask permissions.

tf@hashicorp example % ls -al dummy.txt
-rwxr-xr-x  1 tf  staff  6  8 Oct 16:02 dummy.txt

Steps to Reproduce

  1. terraform apply
  2. ls -al dummy.txt

How much impact is this issue causing?

Low

Logs

No response

Additional Information

As per the documentation, if no file_permission attribute is set, the default value would be used (0777). Happily this does not seem to be the case currently because it might be a security issue. The same issue is present for directory_permission. Might also be that the documentation is misleading here or I am mistaken :)

Code of Conduct

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

tibeer avatar Oct 08 '22 14:10 tibeer

@tibeer what is the value of your umask?

curx avatar Oct 09 '22 10:10 curx

022

tibeer avatar Oct 10 '22 05:10 tibeer

Hi @tibeer, Thank you for raising this issue. I've updated our documentation in #155 regarding the file_permission and directory_permission attributes to clarify that those are the values before the umask is applied. Thanks again for bringing this to our attention and feel free to reach out with any questions/concerns!

SBGoods avatar Jan 12 '23 16:01 SBGoods

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

github-actions[bot] avatar May 23 '24 07:05 github-actions[bot]