#terragrunt - September 2019

terragruntArchived
18 messages

Terragrunt discussions
Archive: https://archive.sweetops.com/terragrunt/

September 2019
antonbabenko
antonbabenkoabout 7 years ago
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?
loren
lorenabout 7 years ago
solve? no... workaround, yes... it's not pretty
loren
lorenabout 7 years ago
basically just gitignoring the copied file 😕
loren
lorenabout 7 years ago(edited)
in terragrunt.hcl

  after_hook "provider" {
    commands = ["init-from-module"]
    execute  = ["cp", "${get_terragrunt_dir()}/../../provider.tf", "."]
  }
loren
lorenabout 7 years ago(edited)
in .gitignore

# Terragrunt files copied by hooks
dev/**/provider.tf
loren
lorenabout 7 years ago(edited)
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
antonbabenkoabout 7 years ago
Great, I solved workaround 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
lorenabout 7 years ago
yeah, i think we need the workflow to be part of terragrunt proper, rather than implemented with hooks
loren
lorenabout 7 years ago
it's not something the gruntwork folks do, so they just don't see it as a real use case at the moment
antonbabenko
antonbabenkoabout 7 years ago
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
lorenabout 7 years ago
Right, yeah, that also works, but is slow 😒
Mariano Godoy
Mariano Godoyabout 7 years ago(edited)
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::git@github.com: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"]
}
Sharanya
Sharanyaabout 7 years ago
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
aaratnabout 7 years ago
@Sharanya is terragrunt in your path ?
Andriy Knysh (Cloud Posse)
Andriy Knysh (Cloud Posse)about 7 years ago(edited)
in the PATH or is installed
aaratn
aaratnabout 7 years ago
+1
Sharanya
Sharanyaabout 7 years ago
i dont think terragrunt in installed on the server
aaratn
aaratnabout 7 years ago
You will need to install it