terraform-cdk icon indicating copy to clipboard operation
terraform-cdk copied to clipboard

.cdktf/ is created in $HOME without any ability to override it

Open lestephane opened this issue 2 years ago • 1 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

My $HOME is not writable, so that whenever a tool tries to add something there, I know about it, and either drop the tool or create the directory myself, with a mask that I control. This has always me to keep my $HOME tidy.

I tried using cdktf for the first time today, and got the following error

Error: EACCES: permission denied, mkdir '/home/SCRUBBED/.cdktf'
    at Object.mkdirSync (node:fs:1349:3)
    at Object.Gz (/home/lestephane/GitRepos/cdktf-playground/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:7:7129)
    at GRe (/home/lestephane/GitRepos/cdktf-playground/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:392:3323)
    at Xzt (/home/lestephane/GitRepos/cdktf-playground/node_modules/cdktf-cli/bundle/bin/cmds/handlers.js:392:3594)

It is customary to make those locations overridable using environment variables (example: $TF_PLUGIN_CACHE_DIR).

References

lestephane avatar May 05 '22 14:05 lestephane

Hi @lestephane! Thank you for raising this.

We do offer an CDKTF_HOME environment variable, however there was one instance where it wasn't used. I created https://github.com/hashicorp/terraform-cdk/pull/1778 to fix that.

ansgarm avatar May 06 '22 09:05 ansgarm

Closed via #1778

ansgarm avatar Sep 07 '22 15:09 ansgarm

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've 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 Nov 24 '22 01:11 github-actions[bot]