-
Notifications
You must be signed in to change notification settings - Fork 888
refactor: Add minimal terraform project #308
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
refactor: Add minimal terraform project #308
Conversation
Codecov Report
@@ Coverage Diff @@
## main #308 +/- ##
==========================================
+ Coverage 64.81% 67.39% +2.58%
==========================================
Files 67 140 +73
Lines 756 7407 +6651
Branches 74 77 +3
==========================================
+ Hits 490 4992 +4502
- Misses 251 1904 +1653
- Partials 15 511 +496
Continue to review full report at Codecov.
|
examples/minimal-project/main.tf
Outdated
@@ -0,0 +1,8 @@ | |||
terraform { | |||
required_version = ">= 0.12.26" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated to your change, but this brings up a few questions for me:
- Do we anticipate that we'll need to be able to handle multiple different versions of Terraform being co-installed? I don't know what their compatibility story is like
- Do we expect that each project will have one (and only one) Terraform file? Of course it can include submodules, but if the amount of infrastructure managed by a given project grows too much, it can make things really slow
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good questions!
Do we anticipate that we'll need to be able to handle multiple different versions of Terraform being co-installed?
I believe our provisionerd
will be tied to a certain version of terraform
, but I could be wrong. We'll need to communicate out a requirement as to what terraform
binary needs to be available. It'd be great to have a health-check, too, to verify that terraform is in the environment and at a supported version.
Do we expect that each project will have one (and only one) Terraform file? Of course it can include submodules, but if the amount of infrastructure managed by a given project grows too much, it can make things really slow
I suspect most projects will have more terraform files than in the example. The project create
workflow zips up the entire folder into a tar.gz
, and sends it as collateral for the command - so we support having more than just a single file.
@@ -10,7 +10,8 @@ This repository contains source code for Coder V2. Additional documentation: | |||
## Directory Structure | |||
|
|||
- `.github/`: Settings for [Dependabot for updating dependencies](https://docs.github.com/en/code-security/supply-chain-security/customizing-dependency-updates) and [build/deploy pipelines with GitHub Actions](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions). | |||
- [`semantic.yaml`](./github/semantic.yaml): Configuration for [semantic pull requests](https://github.com/apps/semantic-pull-requests) | |||
- [`semantic.yaml`](./github/semantic.yaml): Configuration for [semantic pull requests](https://github.com/apps/semantic-pull-requests)\ | |||
- `examples`: Example terraform project templates. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking we'll eventually rename this to templates
(once that product functionality exists), but this is great for now!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! I'll switch it over as part of this PR, so we're closer to the ideal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I totally missed that we already have a templates
folder (with a simple example like this PR has) - introduced here #246
That does the same job as this PR - so I'll close this out and use templates/null
in my workflow
Closing this because there is already |
From discussion in #318 (comment) - I'll bring this back and keep it in |
I was thinking it might be nice to have some example projects (especially as we on-board new developers) to make it easy to create new projects.
This adds the most basic possible terraform module... just an output block. However, it's enough to run
coder projects create
and go through the whole lifecycle of creating a project and workspace (although, it's really boring since there are no parameters).The folder structure I added looks like this:
examples
minimal-project
Open to ideas though - other possibilities: