#terragrunt (2019-09)
Terragrunt discussions
Archive: https://archive.sweetops.com/terragrunt/
2019-09-06
Hi guys! @loren Have you found a solution to this https://github.com/gruntwork-io/terragrunt/issues/785 ? I wonder how people are solving odd (“new”) behavior of init
hooks?
Change-Request: Postpone check for checkTerraformCodeDefinesBackend() after before_hooks are run. I guess it makes sense to run a before_hook before deciding how to actually execute theterraform co…
solve? no… workaround, yes… it’s not pretty
basically just gitignoring the copied file
in terragrunt.hcl
after_hook "provider" {
commands = ["init-from-module"]
execute = ["cp", "${get_terragrunt_dir()}/../../provider.tf", "."]
}
in .gitignore
# Terragrunt files copied by hooks
dev/**/provider.tf
i tried your workaround of having a hook delete the file, but turns out we actually need it there because terragrunt tracks the files it copies from the terragrunt dir to its cache working dir, and purges anything from the cache working dir that it didn’t copy
Great, I ~solved~orkaround it exactly as you said. I am not sure there will be a proper fix in the near future. It starts to look a big ugly here and there with terragrunt…
yeah, i think we need the workflow to be part of terragrunt proper, rather than implemented with hooks
it’s not something the gruntwork folks do, so they just don’t see it as a real use case at the moment
As another not elegant hack I can run terragrunt plan --terragrunt-source-update
to get source reinitiated every time, then I can have after_hook which will remove the file.
Right, yeah, that also works, but is slow
add some dep between modules and its very slow
2019-09-10
Hi guys!, does anyone know how to solve dependencies between modules without having to run a terragrunt plan-all
from the root directory?
This is our current directory structure
root
├── dynamodb
│ ├── TableOneDir
│ │ └── terragrunt.hcl
│ ├── TableTwoDir
│ │ └── terragrunt.hcl
├── lambda
│ ├── LambdaOneDir
│ │ └── terragrunt.hcl
│ ├── LambdaTwoDir
│ │ └── terragrunt.hcl
├── secrets
│ └── terragrunt.hcl
├── sns
│ └── terragrunt.hcl
└── terragrunt.hcl
We need to run plan only in the LambdaOne directory and auto resolve a dependecy of a TableOneDir existing.
Also this are out hcl examples
terraform {
source = "git::[email protected]:Company/core-of-sources.git//lambda/LambdaOneDir?ref=branch-one"
}
# Include all settings from the root terragrunt.hcl file
include {
path = find_in_parent_folders()
}
# Dependencies
dependencies {
paths = ["../../dynamodb/TableOneDir"]
}
there are some very new features of terragrunt to support this… make sure you are using the latest version and then read these sections in the readme:
• https://github.com/gruntwork-io/terragrunt#passing-outputs-between-modules
• https://github.com/gruntwork-io/terragrunt#unapplied-dependency-and-mock-outputs
@cytopia
@antonbabenko this is nice https://github.com/gruntwork-io/terragrunt#passing-outputs-between-modules
Terragrunt is a thin wrapper for Terraform that provides extra tools for working with multiple Terraform modules. - gruntwork-io/terragrunt
Nice feature!
But still we have a problem we don’t really know how to solve.
Say we modify our implementation of the LambdaOne
module and also some configuration on dynamo’s TableOne
we need for the same feature, then we would like to run a plan for those changes.
We would like only to run terragrunt plan
inside of the LambdaOne
folder and doing so we expect it automatically to cascade the plan to its dependencies (in this case TableOne
) is that possible?
We understand that running terragrunt plan
on the root folder would solve this problem but since we are using Atlantis doing so would automatically lock all the directory and won’t allow us to work concurrently with other team mates.
no, not using plan
. but plan-all
should do exactly that
oh, but right, that will lock all the other directories, hrm…
maybe open a feature request for a new flag --terragrunt-process-dependencies
or somesuch
You are right! plan-all
is what we need to use, but I’ve found there is a problem with the non-interactive mode and that is that while setting this option on, there is no way to turn on the option to also apply the command on the dependencies of the module. I’ve spotted the Issue here:
https://github.com/gruntwork-io/terragrunt/issues/860
Today's behaviour defaults to not applying external dependencies in non-interactive mode as we can see in these lines of code. I would like to have some configuration (for example a cli option)…
@Gustavo Adrián Crespi we may also consider opening a PR and colaborating
on *-all commands without asking on the prompt. This PR fixes #860
2019-09-11
2019-09-16
quick question
- terragrunt –version /var/lib/jenkins/workspace/gc-vitr-landing-page_master@tmp/durable-dfb884a1/script.sh: line 1: terragrunt: command not found [Pipeline] } —- Have this error in my Jenkins build…. have any one come across this ever ?
in the PATH or is installed
+1
i dont think terragrunt in installed on the server
You will need to install it