#terragrunt (2019-09)
Terragrunt discussions
Archive: https://archive.sweetops.com/terragrunt/
2019-09-06
![antonbabenko avatar](https://secure.gravatar.com/avatar/fc9fce3c16a287d672ec5433430f11ca.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0011-72.png)
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…
![loren avatar](https://secure.gravatar.com/avatar/d1e25dcfbc68a0857a04dd78c9afe952.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0003-72.png)
solve? no… workaround, yes… it’s not pretty
![loren avatar](https://secure.gravatar.com/avatar/d1e25dcfbc68a0857a04dd78c9afe952.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0003-72.png)
basically just gitignoring the copied file
![loren avatar](https://secure.gravatar.com/avatar/d1e25dcfbc68a0857a04dd78c9afe952.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0003-72.png)
in terragrunt.hcl
after_hook "provider" {
commands = ["init-from-module"]
execute = ["cp", "${get_terragrunt_dir()}/../../provider.tf", "."]
}
![loren avatar](https://secure.gravatar.com/avatar/d1e25dcfbc68a0857a04dd78c9afe952.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0003-72.png)
in .gitignore
# Terragrunt files copied by hooks
dev/**/provider.tf
![loren avatar](https://secure.gravatar.com/avatar/d1e25dcfbc68a0857a04dd78c9afe952.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0003-72.png)
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
![antonbabenko avatar](https://secure.gravatar.com/avatar/fc9fce3c16a287d672ec5433430f11ca.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0011-72.png)
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…
![loren avatar](https://secure.gravatar.com/avatar/d1e25dcfbc68a0857a04dd78c9afe952.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0003-72.png)
yeah, i think we need the workflow to be part of terragrunt proper, rather than implemented with hooks
![loren avatar](https://secure.gravatar.com/avatar/d1e25dcfbc68a0857a04dd78c9afe952.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0003-72.png)
it’s not something the gruntwork folks do, so they just don’t see it as a real use case at the moment
![antonbabenko avatar](https://secure.gravatar.com/avatar/fc9fce3c16a287d672ec5433430f11ca.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0011-72.png)
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.
![loren avatar](https://secure.gravatar.com/avatar/d1e25dcfbc68a0857a04dd78c9afe952.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0003-72.png)
Right, yeah, that also works, but is slow
![Adrian avatar](https://avatars.slack-edge.com/2023-10-26/6125977387504_c19919754493261edb59_72.jpg)
add some dep between modules and its very slow
2019-09-10
![Mariano Godoy avatar](https://secure.gravatar.com/avatar/376ec8c7c3dee08e1532c3071d354470.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0018-72.png)
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"]
}
![loren avatar](https://secure.gravatar.com/avatar/d1e25dcfbc68a0857a04dd78c9afe952.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0003-72.png)
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
![maarten avatar](https://avatars.slack-edge.com/2020-09-28/1393040065826_b0d13cfde15deff02026_72.png)
@cytopia
![maarten avatar](https://avatars.slack-edge.com/2020-09-28/1393040065826_b0d13cfde15deff02026_72.png)
@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
![Gustavo Adrián Crespi avatar](https://secure.gravatar.com/avatar/2bcbbc0b27bc365d384db0b305daabaa.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0015-72.png)
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.
![loren avatar](https://secure.gravatar.com/avatar/d1e25dcfbc68a0857a04dd78c9afe952.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0003-72.png)
no, not using plan
. but plan-all
should do exactly that
![loren avatar](https://secure.gravatar.com/avatar/d1e25dcfbc68a0857a04dd78c9afe952.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0003-72.png)
oh, but right, that will lock all the other directories, hrm…
![loren avatar](https://secure.gravatar.com/avatar/d1e25dcfbc68a0857a04dd78c9afe952.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0003-72.png)
maybe open a feature request for a new flag --terragrunt-process-dependencies
or somesuch
![Gustavo Adrián Crespi avatar](https://secure.gravatar.com/avatar/2bcbbc0b27bc365d384db0b305daabaa.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0015-72.png)
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)…
![AgustínGonzalezNicolini avatar](https://secure.gravatar.com/avatar/fb02f51e23f1d447002da0c44050df3d.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-72.png)
@Gustavo Adrián Crespi we may also consider opening a PR and colaborating
![Gustavo Adrián Crespi avatar](https://secure.gravatar.com/avatar/2bcbbc0b27bc365d384db0b305daabaa.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0015-72.png)
on *-all commands without asking on the prompt. This PR fixes #860
![AgustínGonzalezNicolini avatar](https://secure.gravatar.com/avatar/fb02f51e23f1d447002da0c44050df3d.jpg?s=72&d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0023-72.png)
2019-09-11
2019-09-16
![Sharanya avatar](https://avatars.slack-edge.com/2019-08-28/730147904066_371d42477a79b1177fc2_72.jpg)
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 ?
![aaratn avatar](https://avatars.slack-edge.com/2019-02-20/557134156454_f5d7fde6bbdd7b4ced9e_72.jpg)
![Andriy Knysh (Cloud Posse) avatar](https://avatars.slack-edge.com/2018-06-13/382332470551_54ed1a5d986e2068fd9c_72.jpg)
in the PATH or is installed
![aaratn avatar](https://avatars.slack-edge.com/2019-02-20/557134156454_f5d7fde6bbdd7b4ced9e_72.jpg)
+1
![Sharanya avatar](https://avatars.slack-edge.com/2019-08-28/730147904066_371d42477a79b1177fc2_72.jpg)
i dont think terragrunt in installed on the server
![aaratn avatar](https://avatars.slack-edge.com/2019-02-20/557134156454_f5d7fde6bbdd7b4ced9e_72.jpg)
You will need to install it