Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
blog
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nimrod
blog
Commits
0893e56b
Commit
0893e56b
authored
3 years ago
by
nimrod
Browse files
Options
Downloads
Patches
Plain Diff
fixup! Post about Terragrunt.
parent
5a7945e7
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#2149
passed
3 years ago
Stage: .pre
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
content/tf-project-structure.rst
+19
-18
19 additions, 18 deletions
content/tf-project-structure.rst
with
19 additions
and
18 deletions
content/tf-project-structure.rst
+
19
−
18
View file @
0893e56b
...
...
@@ -46,11 +46,10 @@ that has all of the changes (the sub-module changes, the calling modules
changes, any fallout from those changes).
This process fitted us nicely. The PR had the entire picture and we could really
see if the change improved anything (like adding an output to a module and
fetching it in a different module would be clear if you see it being used). We
did on occasion had conflicting changes and we did had to use targeted
:code:`plan` and :code:`apply` but as far as I can remember no more than once a
quarter.
see if the change improved anything (like adding an output to a module to be
used in a different module would be clear if you see it being used). We did on
occasion had conflicting changes and we did had to use targeted :code:`plan` and
:code:`apply` but as far as I can remember less than once a quarter.
Terragrunt recommends splitting the repository in 2, one for sub-modules and one
for actually deployed modules. Then you create :code:`terragrunt.hcl` files that
...
...
@@ -58,14 +57,15 @@ list the sub-modules needed with the Git ref used. This allows you to use the
RDS database sub-module from today but the auto-scaling group from last year. I
see little point in this.
The change process goes as follows, 1 PR for the sub-modules repository and (at
least) 1 for the live repository. Now I hear that the recommendation has
changed. The new recommendation is that each sub-module will be in a separate
repository. So more PRs for each change (that one change of adding an output and
using it became less obvious but requires more work, I wouldn't call it a win).
I wonder if there's any place that has 2 repositories, 1 for code 1 for the
tests and you change the code, and when it's merged you go to the tests repo and
update the tests there to use the new code to see if it passes?
The change process goes as follows, 1 PR for the sub-modules repository and 1
for the live repository (or more, we haven't gotten around to discussing
environments yet) Now I hear that the recommendation has changed. The new
recommendation is that each sub-module will be in a separate repository. So more
PRs for each change (that one change of adding an output and using it became
less obvious but requires more work, I wouldn't call it a win). I wonder if
there's any place that has 2 repositories, 1 for code 1 for the tests and you
change the code, and when it's merged you go to the tests repo and update the
tests there to use the new code to see if it passes?
Another outcome from this way of working I keep seeing is that because changes
are not applied (or planned) before merging the changes to the sub-module,
...
...
@@ -103,7 +103,8 @@ would look like this:
# Review the changes.
terraform apply tfplan
For making life a little easier I added the following snippet to each module:
For making life a little easier I also added the following snippet to each
module:
.. code:: terraform
...
...
@@ -131,10 +132,10 @@ with the Terraform commands and plan files to stich everything togethere. Even
on paper this doesn't look like a good idea and it isn't one in practice, making
debugging issues difficult.
It also suggests that you can have different versions of the
different
sub-modules in use
across different environments, putting emphais on having
the :code:`main` branch
match exactly what is each environment instead of
putting emphasis of avoiding
drift between the different environments.
It also suggests that you can have different versions of the
sub-modules in use
across different environments, putting emphais on having
the :code:`main` branch
match exactly what is each environment instead of
putting emphasis of avoiding
drift between the different environments.
Conclusions
-----------
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment