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

Feature Request: variant export binary should bundle modules #28

Closed
osterman opened this issue Sep 18, 2020 · 2 comments · Fixed by #32
Closed

Feature Request: variant export binary should bundle modules #28

osterman opened this issue Sep 18, 2020 · 2 comments · Fixed by #32

Comments

@osterman
Copy link

osterman commented Sep 18, 2020

what

  • Running variant export binary should bundle all module dependencies into the binary
  • Currently, only the main "root" module is included and the rest of modules downloaded at run-time
  • This mostly a problem when using local modules, because then they must be distributed with the binary. For remote modules, this is less of an issue.

why

  • We want to distribute a fully functional binary as part of our toolchain
@mumoshu
Copy link
Owner

mumoshu commented Sep 26, 2020

@osterman Hey! I'm now working on this.

Firstly I tried to implement this by producing a “flattened” version of all the local and remote variant sources. The flattened sources can be embedded into the binary then.

It requires the modified (flattened) .variant file to the disk using some hcl2 functionality. But the functionality, hclwrite, seems very limited and unable to encode HCL2 construtcts used in Variant. So I’m going to abandon this idea.

01c55e4

@mumoshu
Copy link
Owner

mumoshu commented Sep 26, 2020

I'll try embedding the module files using statik (or packr, packr2, pkger, or whatever?) next.

Internally Variant2 will be changed to use an overlay filesystem composed of statik fs and the real os filesystem, and prefer reading from the former so that embedded files are read if exists and the os files are tried next(variant run and shim cases).

This seems a bit inelegant, but should work universally. And It's possible without interfering with complex hcl2 functionalities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants