Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: cdktf deploy - symlink not permitted #222

Closed
Satak opened this issue Jul 20, 2020 · 3 comments · Fixed by #344
Closed

Windows: cdktf deploy - symlink not permitted #222

Satak opened this issue Jul 20, 2020 · 3 comments · Fixed by #344
Labels
bug Something isn't working windows

Comments

@Satak
Copy link

Satak commented Jul 20, 2020

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

cdktf & Language Versions

cdktf version : 0.0.12-pre.4c00f2bafb17b79dcf2310a2a85a4ef9ed6518a1
TypeScript

Affected Resource(s)

All, Docker example

Debug Output

❯ cdktf deploy
⠸ synthesizing ...
internal/fs/utils.js:298
    throw err;
    ^

Error: EPERM: operation not permitted, symlink 'C:\Dev\satak\terraform-vm-test\.terraform' -> 'C:\Dev\satak\terraform-vm-test\cdktf.out\.terraform'
    at Object.symlinkSync (fs.js:1121:3)
    at MyStack.linkDotTerraform (C:\Dev\satak\terraform-vm-test\node_modules\cdktf\lib\terraform-stack.js:98:16)
    at MyStack.onSynthesize (C:\Dev\satak\terraform-vm-test\node_modules\cdktf\lib\terraform-stack.js:91:14)
    at Node.synthesize (C:\Dev\satak\terraform-vm-test\node_modules\constructs\lib\construct.js:342:27)
    at App.synth (C:\Dev\satak\terraform-vm-test\node_modules\cdktf\lib\app.js:32:36)
    at Object.<anonymous> (C:\Dev\satak\terraform-vm-test\main.js:26:5)
    at Module._compile (internal/modules/cjs/loader.js:1201:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1221:10)
    at Module.load (internal/modules/cjs/loader.js:1050:32)
    at Function.Module._load (internal/modules/cjs/loader.js:938:14) {
  errno: -4048,
  syscall: 'symlink',
  code: 'EPERM',
  path: 'C:\\Dev\\satak\\terraform-vm-test\\.terraform',
  dest: 'C:\\Dev\\satak\\terraform-vm-test\\cdktf.out\\.terraform'
⠼ synthesizing ...

Expected Behavior

deploy should work without elevated (terminal opened as admin) rights

Actual Behavior

Deploy fails on permissions while trying to create symlink

Steps to Reproduce

Try to deploy Docker example with TypeScript on VS Code terminal (pwsh 7.0) from terminal that is not opened as admin

Other

I can't open my terminal as admin since it's not company policy to have terminals opened as admin. Make a workaround to copy files without symlink, like:

try {
  fs.symlinkSync(absoluteFilePath, outputFilePath);
} catch(e) {
  const conentStr = fs.readFileSync(absoluteFilePath);
  fs.writeFileSync(outputFilePath, conentStr);
}
@Satak Satak added the bug Something isn't working label Jul 20, 2020
@Satak Satak changed the title Windows: cdkf deploy - symlink not permitted Windows: cdktf deploy - symlink not permitted Jul 20, 2020
@skorfmann
Copy link
Contributor

Thanks for your bug report.

The symlink is for the .terraform directory and it's purpose is to avoid re-downloading the Terraform providers. Besides from making these providers survive a removal of the cdktf.out directory, another intent was caching between cdktf get runs. I think cdktf get runs in a temp directory now and doesn't benefit from this anymore.

Alternatively, we should think about fully leveraging Terraform provider caching to have a more robust way of handling this.

This could be done by:

  • Documenting how to do it (e.g. via env)
  • Getting rid of the symlink logic in the code

what do you think? /cc @anubhavmishra

@skorfmann
Copy link
Contributor

Getting rid of the symlink would also fix this issue #189

skorfmann added a commit that referenced this issue Aug 24, 2020
Since the current symlink approach for caching poviders has multiple
drawbacks, this PR switches to the general plugin cache dir supported
by Terraform directly.

https://www.terraform.io/docs/commands/cli-config.html#provider-plugin-cache

Fixes #189
Fixes #222
@github-actions
Copy link
Contributor

github-actions bot commented Dec 7, 2022

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 github-actions bot locked as resolved and limited conversation to collaborators Dec 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants