-
Notifications
You must be signed in to change notification settings - Fork 875
Extend coder to allow reuse of template terraform code #6117
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
Comments
Do you want to avoid shipping the module as a part of each template? You could reference a module from a GitHub repo to avoid duplication and then just extend it or pass template-specific parameters/resources. # template1/main.tf
module "central-coder-module" {
source = "github.com/yourorg/central-coder-module"
myparam = "custom-for-template1"
}
resource "ebs_volume` `custom_template1_only_resource ` {
} # template2/main.tf
module "central-coder-module" {
source = "github.com/yourorg/central-coder-module"
myparam = "custom-for-template2"
myparam2 = "bar"
}
resource "aws_instance` `custom_template2_only_resource ` {
} |
Hi, The module is locally and I would like to ship the module together with the template.
|
One workaround that came up earlier is to symlink the module directory inside the template directory and then
FWIW: We were trying use this approach but switched to remote modules like @bpmct mentioned which we found easier to manage/version. |
Do you plan on managing all the projects in the same GitHub repo? If so, you could do the symlink or copy approach to include the module if you push via CI/CD. |
It seems a bit risky for Coder to have a feature that grabs/copies arbitrary files from outside of the directory you are in. |
I feel like we don't have great plans to fix this right now... and we wouldn't want to stray away from Terraform primitives unless required. Closing for now, but please feel free to contribute ideas! We're open to them :) |
As a coder administrator, I want to avoid the need of copying the common logic for each new template I create. (dry principle)
The common logic is currently part of a terraform module that I would like to ship together with the template.
One idea suggested by the authors is to add a
dir
property that allows the authors to execute Terraform in a subdirectory and have the general files in the root directory.The text was updated successfully, but these errors were encountered: