Replies: 1 comment 1 reply
-
Hey @ares-b , What might help you build a mental framework for how to use Terragrunt is to recognize that it is always going to:
In your circumstance, it appears that what you're not leveraging includes. This is how Terragrunt code gets dry. Are you aware of this configuration, and are you using it? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey,
Context
I've a personal project with a bunch of friends where we deploy some VMs in oracle cloud (within the always free tier) and then install docker on each of these VMs.
So everyone of us has a Oracle Cloud account, in which we deploy 1 single VM with maxed out resources (within the always free tier). And then we run an ansible playbook that installs docker and creates some unix users.
Our terraform repository looks like this:
docker_server_xx.tf
we just calloracle_alwaysfree
and thendocker_server
(docker_server
needs outputs fromoracle_alwaysfree
).2.1 On files
docker_server_xx.tf
we also set specific values for variables that are passed to modulesoracle_alwaysfree
anddocker_server
variables.tf
contains all our variables definitionpostgresql.tf
deploys a docker container with postgresql ondocker_server_01
.5.1 In this file we also handle users creation for postgresql and some other configurations
5.2 Here we're using
cyrilgdn/postgresql
to configure stuff once the container is deployed.vault.tf
deploys a docker container with postgresql ondocker_server_02
.6.1 In this file we also handle vault policies creation and other stuff
6.2 Here we're using
hashicorp/vault
provider to configure stuff once the container is deployedThe Problem
Basically we're trying to use terragrunt to solve all the problems above.
Can you please explain to us (with some code examples if possisble) how can we re-factor our terraform repository with terragrunt in the most "DRY" and consice way that also fixes the problems listed above ?
Researches
I've gone through the docs and I feel like I'm going round in circles because there are different ways of organizing this repository, but I can't figure out which is best suited for us.
For example for
1.
. I guess we have to create a directory for each account:account_1
,account_2
, etc. And then at the top levelterragrunt.hcl
file, we'd have something along these lines:s3_backend.tpl
file content:oci_provider.tpl
file content:For
2.
what comes in mind first is just having specificinputs
block in theterragrunt.hcl
file of each account folder, but that would make our Terragrunt Architecture not DRY, doesn't it ?For
5.
and6.
I honestly can't figure out how to fix those :/Beta Was this translation helpful? Give feedback.
All reactions