You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support terraform resources outside the given template directory #5677
When creating a Coder template, I would like to reference local files outside the given template directory.
Context: I want to re-use common files/terraform modules between multiple templates in a repository. To do this right now, one needs to copy-paste common resources into each template's directory, which is inconvenient and increases the risk of introducing skew.
A practical example: These two templates are near-identical, yet it's not feasible to share common resources between then
that's totally reasonable for the linked case, but there are some valid use cases where this doesn't make sense
e.g., $WORK uses a large, shared monorepo, and there are often resources in far-flung relative directories (e.g., ../../../../resources/some-other-team/some-other-product/resource.yml) that we want to include - an approach like this would require committing nearly the entire repository as a template.
would it be possible to resolve file() resources and include them in the uploaded tarball, so that they can be used in the template?
As per my understanding, doing a tar of directory to push template is the only option to follow symlinks as coder templates push does not follow symlinks, correct?
As per my understanding, doing a tar of directory to push template is the only option to follow symlinks as coder templates push does not follow symlinks, correct?
That's correct. In general we don't want to go feature-to-feature with tar, so we promote using that for all advanced directory serialization.
Activity
kylecarbs commentedon Jan 11, 2023
@denbeigh2000 could you create a Terraform module to accomplish this instead?
denbeigh2000 commentedon Jan 11, 2023
that'd work if i were willing to split the module out into another repository and import it, but it leaves a few shortcomings:
../between these templateskylecarbs commentedon Jan 11, 2023
Ahh, I see. I wonder if it'd be best to upload the entire directory as a template, and be able to specify a subdirectory to execute out of?
denbeigh2000 commentedon Jan 11, 2023
that's totally reasonable for the linked case, but there are some valid use cases where this doesn't make sense
e.g.,
$WORKuses a large, shared monorepo, and there are often resources in far-flung relative directories (e.g.,../../../../resources/some-other-team/some-other-product/resource.yml) that we want to include - an approach like this would require committing nearly the entire repository as a template.would it be possible to resolve
file()resources and include them in the uploaded tarball, so that they can be used in the template?ammario commentedon Jan 12, 2023
What if the tarring process traversed symlinks?
denbeigh2000 commentedon Jan 12, 2023
I'd have no issue with making a few relative symlinks to address this 👍
ammario commentedon Jan 15, 2023
After #5720 is in you'll be able to do:
denbeigh2000 commentedon Jan 17, 2023
Thank you very, very much 🙏
ofey404 commentedon May 27, 2023
I like this feature, thanks @denbeigh2000
pasuder commentedon Dec 12, 2023
As per my understanding, doing a tar of directory to push template is the only option to follow symlinks as
coder templates pushdoes not follow symlinks, correct?ammario commentedon Dec 12, 2023
That's correct. In general we don't want to go feature-to-feature with
tar, so we promote using that for all advanced directory serialization.pasuder commentedon Dec 14, 2023
Good, it does work with this way:
Thanks!