-
Notifications
You must be signed in to change notification settings - Fork 92
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
feat: allow terramate and stack config from multiple files #216
Conversation
…-load-tm-config-multiple-files
Codecov Report
@@ Coverage Diff @@
## main #216 +/- ##
==========================================
+ Coverage 63.36% 63.64% +0.27%
==========================================
Files 30 30
Lines 5408 5391 -17
==========================================
+ Hits 3427 3431 +4
+ Misses 1797 1777 -20
+ Partials 184 183 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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.
lgtm but left some improvement comments, nothing serious.
return nil, errutil.Chain(ErrHCLSyntax, diags) | ||
} | ||
|
||
logger.Trace().Msg("Terramate config file parsed successfully") |
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.
❤️
Globals are still loaded from so having a separate
|
Ah yes, Im aware, I also added a comment on the PR description:
The idea is to incrementally bring all the code generation features to using multiple config files, but right now export_as_locals/globals and generate_hcl wont work yet. Since they would still work on terramate.tm.hcl and nothing would break I thought it would be OK to work on them incrementaly in a different PR. WDYT ? |
…-load-tm-config-multiple-files
Co-authored-by: Tiago de Bem Natel de Moura <t.nateldemoura@gmail.com>
Co-authored-by: Tiago de Bem Natel de Moura <t.nateldemoura@gmail.com>
Co-authored-by: Tiago de Bem Natel de Moura <t.nateldemoura@gmail.com>
Co-authored-by: Tiago de Bem Natel de Moura <t.nateldemoura@gmail.com>
I guess it's ok. |
…ineiros-io/terramate into katcipis-load-tm-config-multiple-files
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.
LGTM 🚀
Since the terramate block can include a different range of configurations, like:
It seemed useful to allow it to be defined on different files, multiple times. So this PR introduces that. For the stack block it seemed less useful, so it remains as it was before (only one block allowed).
Design wise the idea was to replace the function that would parse specific files/data for a function that given a dir parses the whole dir (all files matching *.tm or *tm.hcl). I kept the original logic as much as I could to avoid regressions + also did some piggybacking on the current tests to test with different filenames.
Globals and code generation still only loads the default file, so there is still more work to do.
As an example, this should work and list both stacks: