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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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.tfwe just calloracle_alwaysfreeand thendocker_server(docker_serverneeds outputs fromoracle_alwaysfree).2.1 On files
docker_server_xx.tfwe also set specific values for variables that are passed to modulesoracle_alwaysfreeanddocker_servervariables.tfcontains all our variables definitionpostgresql.tfdeploys 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/postgresqlto configure stuff once the container is deployed.vault.tfdeploys 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/vaultprovider 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.hclfile, we'd have something along these lines:s3_backend.tplfile content:oci_provider.tplfile content:For
2.what comes in mind first is just having specificinputsblock in theterragrunt.hclfile 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