Open ohmer opened 6 days ago
Thanks for reporting this. We will look at this and get back to you asap!
Thanks!
Can't share code to reproduce easily, sorry. As I am working on a mono repo with 1298 stacks, I can provide serious testing.
Example of invalid deps graph below
Child referencing parent:
Parent referencing child:
@i4ki @snakster could you guys take a look at this please?
Hey @ohmer
can you check if the branch in this PR fixes the issue? I managed to reproduce it in parent-child case but maybe it's not the same case you are getting.
To install the branch, you can do:
go install github.com/terramate-io/terramate/cmd/terramate@i4k-fix-tg-after-cycle
You can also export GOBIN=<place>
to install it in a separate directory.
Let me know if it works.
Let me know if it works
Awesome, will do ASAP!
Looks better, but not a fix I believe. How I tested:
GOBIN=~/bin/ go install github.com/terramate-io/terramate/cmd/terramate@i4k-fix-tg-after-cycle
time ~/bin/terramate create --all-terragrunt
...
Created stack /support/global/default
Created stack /support/us-east-1/default
Error: failed to initialize Terragrunt modules
> validating stack fields: field after has duplicate "/prod/eu-west-3/data-biron/aurora" element
________________________________________________________
Executed in 509.13 secs fish external
usr time 668.92 secs 222.00 micros 668.92 secs
sys time 110.65 secs 881.00 micros 110.65 secs
> cycle detected: /preprod/eu-west-3/data -> /preprod/eu-west-3/data/kms -> /preprod/eu-west-3/data: checking node id "/preprod/eu-west-3/data"
FYI
find . -type f -name terragrunt.hcl -prune -not -path '*/.terragrunt-cache/*' | wc -l
1202
On the cyclic dependency:
❯ grep -A1 'dependency "' preprod/eu-west-3/data/terragrunt.hcl
dependency "web" {
config_path = "../web"
--
dependency "ecom_private" {
config_path = "../ecom-private"
--
dependency "erp" {
config_path = "../erp"
--
dependency "support_resources" {
config_path = "../../../support/eu-west-3/default/resources"
--
dependency "kong" {
config_path = "../kong"
--
dependency "control" {
config_path = "../../../support/eu-west-3/control/sns"
--
dependency "kms" {
config_path = "./kms"
❯ cat preprod/eu-west-3/data/stack.tm.hcl
stack {
name = "data"
description = "data"
after = ["/preprod/eu-west-3/data/kms", "/preprod/eu-west-3/ecom-private", "/preprod/eu-west-3/erp", "/preprod/eu-west-3/kong", "/preprod/eu-west-3/web", "/support/eu-west-3/control/sns", "/support/eu-west-3/default/resources"]
id = "ea79feb0-4c94-412d-af50-489fea414d60"
}
Since /preprod/eu-west-3/data/kms
is nested under /preprod/eu-west-3/data
, preprod/eu-west-3/data/stack.tm.hcl
should not add any of its children to the after list as it contradicts the implicit before
in the parent, correct?
Describe the bug
Terramate does not exclude implicit nested stacks from
after
field generating invalid stack dependency graph.To Reproduce
Steps to reproduce the behavior:
terramate create --all-terragrunt
. Terramate adds parent inafter
list instack.tm.hcl
terramate list --run-order
throwsInvalid stack configuration > cycle detected
Expected behavior Produce a valid dependency graph exclucing parent stack from Terramate dependency graph since its implicit.
Log Output Add logs from Terramate to help debug your problem.
Environment
14.5
2.45.2
0.9.0
Additional context I love Terramate, happy to help! Thanks for putting such a great tool out there!