Skip to content

[FEATURE] terragrunt support #114

Description

@ghulteen

In our env we use terragrunt. so I created symlink "localterraform -> terragrunt" and updated the modules/ftwrapper.py which got me closer but it seems that terravision now cannot find the .tf files in the local directory. My guess right now is that it doesn't understand the module config. Are there any plan to test/add terragrunt support?

Activity

  1. patrickchugh commented on Jan 31, 2026

    @patrickchugh
    Owner

    Hi @ghulteen could you share an example repo using Terragrunt and how would you expect it to work?

  2. lgg42 commented on Mar 26, 2026

    @lgg42

    Hi @ghulteen could you share an example repo using Terragrunt and how would you expect it to work?

    I have this same issue. Following terragrunt best practices, our infra repo is similar to:

    account
     └ _global
     └ region
        └ _global
        └ environment
           └ resource
    

    I'd expect going to an environment folder and run terravision there, wrapping terragrunt generated files, rendering the whole environment diagram.

  3. self-assigned this
    on Mar 29, 2026
  4. added a commit that references this issue on Mar 29, 2026
    1070484
  5. patrickchugh commented on Mar 29, 2026

    @patrickchugh
    Owner

    @ghulteen @lgg42 My friend Claude and I have added terragrunt support with the latest release, can you try it out and give me your feedback?

  6. lgg42 commented on Mar 29, 2026

    @lgg42

    @ghulteen @lgg42 My friend Claude and I have added terragrunt support with the latest release, can you try it out and give me your feedback?

    Woah! such fast! thanks a lot! I give it a go and I suspect I ran into a layer 8 problem..

    I want to first try it out against a single terragrunt unit in infrastructure/live/staging/us-east-1/data-stores/rds/shared (RDS DB)

    So that's my CWD having a terragrunt.hcl file. I run terravision the following way:

    docker run -it --rm  -v $(pwd):/project  -e AWS_ACCESS_KEY_ID=REDACTED -e AWS_SECRET_ACCESS_KEY=REDACTED -e AWS_SESSION_TOKEN=REDACTED  -v /usr/local/bin/terragrunt:/usr/local/bin/terragrunt patrickchugh/terravision:0.26.0 draw --source /project
    

    I have the following error:

     _____                          _     _             
    /__   \___ _ __ _ __ __ ___   _(_)___(_) ___  _ __  
      / /\/ _ \ '__| '__/ _` \ \ / / / __| |/ _ \| '_ \ 
     / / |  __/ |  | | | (_| |\ V /| \__ \ | (_) | | | |
     \/   \___|_|  |_|  \__,_| \_/ |_|___/_|\___/|_| |_|
    
    
    
    Preflight check..
      dot command detected: /usr/bin/dot
      gvpr command detected: /usr/bin/gvpr
      git command detected: /usr/bin/git
      terraform command detected: /usr/local/bin/terraform
      terraform version detected: Terraform v1.14.8
    
    
    
    Terragrunt detected (single-module)
    
    
    Running Terragrunt Init..
    
    Unhandled error: <class 'RuntimeError'>, Terragrunt init failed:
    12:30:25.888 ERROR  Error: Error in function call
    12:30:25.888 ERROR    on ./terragrunt.hcl line 16, in include "root":
    12:30:25.888 ERROR    16:   path = find_in_parent_folders("root.hcl")
    12:30:25.889 ERROR  Call to function "find_in_parent_folders" failed: ParentFileNotFoundError: Could
    12:30:25.889 ERROR  not find a root.hcl in any of the parent folders of ./terragrunt.hcl.
    12:30:25.889 ERROR  Cause: Traversed all the way to the root..
    12:30:25.889 ERROR  Error: Unsuitable value type
    12:30:25.889 ERROR    on ./terragrunt.hcl line 16, in include "root":
    12:30:25.889 ERROR    16:   path = find_in_parent_folders("root.hcl")
    12:30:25.890 ERROR  Unsuitable value: value must be known
    12:30:25.891 ERROR  Error: Error in function call
    12:30:25.891 ERROR    on ./terragrunt.hcl line 2, in locals:
    12:30:25.891 ERROR     2:   account_vars = read_terragrunt_config(find_in_parent_folders("account.hcl"))
    12:30:25.892 ERROR  Call to function "find_in_parent_folders" failed: ParentFileNotFoundError: Could
    12:30:25.892 ERROR  not find a account.hcl in any of the parent folders of ./terragrunt.hcl.
    12:30:25.892 ERROR  Cause: Traversed all the way to the root..
    12:30:25.892 ERROR  2 errors occurred:
    
    * ./terragrunt.hcl:16,10-33: Error in function call; Call to function "find_in_parent_folders" failed: ParentFileNotFoundError: Could not find a root.hcl in any of the parent folders of ./terragrunt.hcl. Cause: Traversed all the way to the root.., and 1 other diagnostic(s)
    
    * ./terragrunt.hcl:2,41-64: Error in function call; Call to function "find_in_parent_folders" failed: ParentFileNotFoundError: Could not find a account.hcl in any of the parent folders of ./terragrunt.hcl. Cause: Traversed all the way to the root..
    
    12:30:25.892 ERROR  Unable to determine underlying exit code, so Terragrunt will exit with error code 1
    
    Traceback (most recent call last):
      File "/usr/bin/terravision", line 8, in <module>
        sys.exit(main())
                 ^^^^^^
      File "/usr/lib/python3.12/site-packages/terravision/terravision.py", line 527, in main
        cli(
      File "/usr/lib/python3.12/site-packages/click/core.py", line 1485, in __call__
        return self.main(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.12/site-packages/click/core.py", line 1406, in main
        rv = self.invoke(ctx)
             ^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.12/site-packages/click/core.py", line 1873, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.12/site-packages/click/core.py", line 1269, in invoke
        return ctx.invoke(self.callback, **ctx.params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.12/site-packages/click/core.py", line 824, in invoke
        return callback(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.12/site-packages/terravision/terravision.py", line 381, in draw
        tfdata = compile_tfdata(
                 ^^^^^^^^^^^^^^^
      File "/usr/lib/python3.12/site-packages/terravision/terravision.py", line 192, in compile_tfdata
        tfdata = tgwrapper.tg_initplan(
                 ^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.12/site-packages/modules/tgwrapper.py", line 291, in tg_initplan
        _run_terragrunt_init(codepath, debug)
      File "/usr/lib/python3.12/site-packages/modules/tgwrapper.py", line 195, in _run_terragrunt_init
        raise RuntimeError(f"Terragrunt init failed:\n{stderr}{hint}")
    RuntimeError: Terragrunt init failed:
    12:30:25.888 ERROR  Error: Error in function call
    12:30:25.888 ERROR    on ./terragrunt.hcl line 16, in include "root":
    12:30:25.888 ERROR    16:   path = find_in_parent_folders("root.hcl")
    12:30:25.889 ERROR  Call to function "find_in_parent_folders" failed: ParentFileNotFoundError: Could
    12:30:25.889 ERROR  not find a root.hcl in any of the parent folders of ./terragrunt.hcl.
    12:30:25.889 ERROR  Cause: Traversed all the way to the root..
    12:30:25.889 ERROR  Error: Unsuitable value type
    12:30:25.889 ERROR    on ./terragrunt.hcl line 16, in include "root":
    12:30:25.889 ERROR    16:   path = find_in_parent_folders("root.hcl")
    12:30:25.890 ERROR  Unsuitable value: value must be known
    12:30:25.891 ERROR  Error: Error in function call
    12:30:25.891 ERROR    on ./terragrunt.hcl line 2, in locals:
    12:30:25.891 ERROR     2:   account_vars = read_terragrunt_config(find_in_parent_folders("account.hcl"))
    12:30:25.892 ERROR  Call to function "find_in_parent_folders" failed: ParentFileNotFoundError: Could
    12:30:25.892 ERROR  not find a account.hcl in any of the parent folders of ./terragrunt.hcl.
    12:30:25.892 ERROR  Cause: Traversed all the way to the root..
    12:30:25.892 ERROR  2 errors occurred:
    
    * ./terragrunt.hcl:16,10-33: Error in function call; Call to function "find_in_parent_folders" failed: ParentFileNotFoundError: Could not find a root.hcl in any of the parent folders of ./terragrunt.hcl. Cause: Traversed all the way to the root.., and 1 other diagnostic(s)
    
    * ./terragrunt.hcl:2,41-64: Error in function call; Call to function "find_in_parent_folders" failed: ParentFileNotFoundError: Could not find a account.hcl in any of the parent folders of ./terragrunt.hcl. Cause: Traversed all the way to the root..
    
    12:30:25.892 ERROR  Unable to determine underlying exit code, so Terragrunt will exit with error code 1
    

    I tried also changing the CWD to infrastructure/live/staging/us-east-1/data-stores/ which has:

    .
    ├── backup
    │   └── rds
    ├── dynamodb
    │   ├── bar
    │   └── foo
    ├── mongodb
    │   ├── foo
    │   └── bar
    ├── rds
    │   └── shared
    ├── redis
    │   ├── redis-foo
    │   └── shared-cache
    └── s3
        ├── bucket-foo
        └── bucket-bar
    

    And I have the same results.

    The terragrunt.hcl files in my infra repo normally have several includes and dependencies, example:

    locals {
      account_vars = read_terragrunt_config(find_in_parent_folders("account.hcl"))
      environment  = local.account_vars.locals.environment
      tags = {
        Service     = "foo"
        Environment = local.environment
        Component   = "PostgreSQL"
      }
    }
    
    terraform {
      source = "git@github.com:contoso/terraform-aws-rds.git?ref=v0.1.0"
    }
    
    include "root" {
      path = find_in_parent_folders("root.hcl")
    }
    
    dependency "vpc" {
      config_path = "../../../networking/vpc"
    }
    
    dependency "ec2_github-runner" {
      config_path = "../../../compute/asg/github-runner/"
    }

    I think I might need to mount just the root of the infra repo instead so it finds all the files, I'm gonna give it a go now

  7. lgg42 commented on Mar 29, 2026

    @lgg42

    Ok, if I set my CWD in infrastructure/live, having:

    production  root.hcl staging  templates  testing
    

    And running:

    docker run -it --rm  -v $(pwd):/project  -e AWS_ACCESS_KEY_ID=REDACTED -e AWS_SECRET_ACCESS_KEY=REDACTED -e AWS_SESSION_TOKEN=REDACTED -v /usr/local/bin/terragrunt:/usr/local/bin/terragrunt patrickchugh/terravision:0.26.0 draw --source /project/staging
    

    Then I get up to the init phase but it breaks due to failing cloning private git repos. Example

     _____                          _     _             
    /__   \___ _ __ _ __ __ ___   _(_)___(_) ___  _ __  
      / /\/ _ \ '__| '__/ _` \ \ / / / __| |/ _ \| '_ \ 
     / / |  __/ |  | | | (_| |\ V /| \__ \ | (_) | | | |
     \/   \___|_|  |_|  \__,_| \_/ |_|___/_|\___/|_| |_|
    
    
    
    Preflight check..
      dot command detected: /usr/bin/dot
      gvpr command detected: /usr/bin/gvpr
      git command detected: /usr/bin/git
      terraform command detected: /usr/local/bin/terraform
      terraform version detected: Terraform v1.14.8
    
    
    
    Terragrunt detected (multi-module, 154 child modules)
    
    
    Processing Terragrunt module: us-east-1_application-integration_eventbridge_foo-email-digest
    
    
    Running Terragrunt Init..
    
    Unhandled error: <class 'RuntimeError'>, Terragrunt init failed:
    12:41:59.054 INFO   Downloading Terraform configurations from git::ssh://git@github.com/contoso/terraform-aws-eventbridge.git?ref=v0.1.0 into ./.terragrunt-cache/MsYv3OjwMRMTNbUJ7nX16X8sjd0/Y94v-nvQ2bKryyj1zmPx6JxPHRU
    12:41:59.059 ERROR  downloading source url git::ssh://git@github.com/contoso/terraform-aws-eventbridge.git?ref=v0.1.0
    error occurred:
    
    * error downloading 'ssh://git@github.com/contoso/terraform-aws-eventbridge.git?ref=v0.1.0': /usr/bin/git exited with 128: Cloning into './.terragrunt-cache/MsYv3OjwMRMTNbUJ7nX16X8sjd0/Y94v-nvQ2bKryyj1zmPx6JxPHRU'...
      error: cannot run ssh: No such file or directory
      fatal: unable to fork
    

    I'll check and try to carry out a local install instead of a docker run

  8. lgg42 commented on Mar 29, 2026

    @lgg42

    Ok, local install did the trick, now I have newer errors...

    If I try to run it against a single terragrunt unit (CWD: .../rds/shared) having a terragrunt.hcl file:

     _____                          _     _             
    /__   \___ _ __ _ __ __ ___   _(_)___(_) ___  _ __  
      / /\/ _ \ '__| '__/ _` \ \ / / / __| |/ _ \| '_ \ 
     / / |  __/ |  | | | (_| |\ V /| \__ \ | (_) | | | |
     \/   \___|_|  |_|  \__,_| \_/ |_|___/_|\___/|_| |_|
    
    
    
    Preflight check..
      dot command detected: /usr/bin/dot
      gvpr command detected: /usr/bin/gvpr
      git command detected: /usr/bin/git
      terraform command detected: /usr/local/bin/terraform
      terraform version detected: Terraform v1.7.5
    
    
    
    Terragrunt detected (single-module)
    
    
    Running Terragrunt Init..
    
    Unhandled error: <class 'RuntimeError'>, Terragrunt init failed:
    ╷
    │ Error: Backend initialization required, please run "terraform init"
    │ 
    │ Reason: Initial configuration of the requested backend "s3"
    │ 
    │ The "backend" is the interface that Terraform uses to store state,
    │ perform operations, etc. If this message is showing up, it means that the
    │ Terraform configuration you're using is using a custom configuration for
    │ the Terraform backend.
    │ 
    │ Changes to backend configurations require reinitialization. This allows
    │ Terraform to set up the new configuration, copy existing state, etc. Please
    │ run
    │ "terraform init" with either the "-reconfigure" or "-migrate-state" flags
    │ to
    │ use the current configuration.
    │ 
    │ If the change reason above is incorrect, please verify your configuration
    │ hasn't changed and try again. At this point, no changes to your existing
    │ configuration or state have been made.
    ╵
    

    If I try to run it against a whole environment stack (live/staging)

    14:57 $ terravision draw --source .
    
    
     _____                          _     _             
    /__   \___ _ __ _ __ __ ___   _(_)___(_) ___  _ __  
      / /\/ _ \ '__| '__/ _` \ \ / / / __| |/ _ \| '_ \ 
     / / |  __/ |  | | | (_| |\ V /| \__ \ | (_) | | | |
     \/   \___|_|  |_|  \__,_| \_/ |_|___/_|\___/|_| |_|
    
    
    
    Preflight check..
      dot command detected: /usr/bin/dot
      gvpr command detected: /usr/bin/gvpr
      git command detected: /usr/bin/git
      terraform command detected: /usr/local/bin/terraform
      terraform version detected: Terraform v1.7.5
    
    
    
    Terragrunt detected (multi-module, 353 child modules)
    
    
    Processing Terragrunt module: billing_us-east-1_data-stores_backup_dynamodb
    
    
    Running Terragrunt Init..
    
    Unhandled error: <class 'RuntimeError'>, Terragrunt init failed:
    ╷
    │ Error: Backend initialization required, please run "terraform init"
    │ 
    │ Reason: Initial configuration of the requested backend "s3"
    │ 
    │ The "backend" is the interface that Terraform uses to store state,
    │ perform operations, etc. If this message is showing up, it means that the
    │ Terraform configuration you're using is using a custom configuration for
    │ the Terraform backend.
    │ 
    │ Changes to backend configurations require reinitialization. This allows
    │ Terraform to set up the new configuration, copy existing state, etc. Please
    │ run
    │ "terraform init" with either the "-reconfigure" or "-migrate-state" flags
    │ to
    │ use the current configuration.
    │ 
    │ If the change reason above is incorrect, please verify your configuration
    │ hasn't changed and try again. At this point, no changes to your existing
    │ configuration or state have been made.
    ╵
    
    Traceback (most recent call last):
      File "/home/user/devel/infrastructure/live/.venv/bin/terravision", line 6, in <module>
        sys.exit(main())
                 ^^^^^^
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/terravision/terravision.py", line 527, in main
        cli(
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/click/core.py", line 1485, in __call__
        return self.main(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/click/core.py", line 1406, in main
        rv = self.invoke(ctx)
             ^^^^^^^^^^^^^^^^
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/click/core.py", line 1873, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/click/core.py", line 1269, in invoke
        return ctx.invoke(self.callback, **ctx.params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/click/core.py", line 824, in invoke
        return callback(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/terravision/terravision.py", line 381, in draw
        tfdata = compile_tfdata(
                 ^^^^^^^^^^^^^^^
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/terravision/terravision.py", line 188, in compile_tfdata
        tfdata = tgwrapper.tg_run_all_plan(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/modules/tgwrapper.py", line 509, in tg_run_all_plan
        return _run_all_modules(
               ^^^^^^^^^^^^^^^^^
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/modules/tgwrapper.py", line 540, in _run_all_modules
        mod_tfdata = tg_initplan(module_path, varfile, workspace, debug, upgrade)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/modules/tgwrapper.py", line 291, in tg_initplan
        _run_terragrunt_init(codepath, debug)
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/modules/tgwrapper.py", line 195, in _run_terragrunt_init
        raise RuntimeError(f"Terragrunt init failed:\n{stderr}{hint}")
    

    Side to side this is a diff comparison of the different stack traces: (multi-unit vs single-unit)

    Image
  9. added a commit that references this issue on Mar 29, 2026
    b7b9e5d
  10. patrickchugh commented on Mar 29, 2026

    @patrickchugh
    Owner

    @lgg42 Thanks for the detailed bug reports and code examples — they were super helpful in tracking down the root cause. We have shipped fixes in v0.27.0 that address the issues you hit. Here is what changed:

    What was wrong

    1. Backend conflict with generate backend / remote_state: TerraVision writes a terravision_override.tf to force a local backend (we do not need remote state — we just need the plan output). But the override file was not being picked up correctly in the .terragrunt-cache directory, so Terraform kept trying to configure the S3 backend and failing with "Backend initialization required".

    2. //subfolder in remote sources: For source URLs like git::https://...//modules/db_subnet_group, Terragrunt runs terraform in the subfolder, not the repo root. We were looking in the wrong directory for plan output.

    3. Dependency resolution during init: When module A depends on module B, Terragrunt auto-initialises module B to read its outputs. The local backend override now gets written to all child modules upfront and -reconfigure is passed via TF_CLI_ARGS_init so auto-inits accept it too.

    What you should see now

    • include root with find_in_parent_folders works
    • locals with read_terragrunt_config works
    • dependency blocks with mock_outputs works
    • Remote git sources (git::https://... or git@github.com:...) works
    • generate backend with S3/GCS/Azure backends works

    Better error messages

    If things still go wrong, you should now get actionable hints:

    • find_in_parent_folders failure: Suggests mounting the full infra repo root when using Docker
    • SSH/download errors: Suggests mounting ~/.ssh inside Docker containers

    I have pushed a docker image and pypi package for version 0.27 with the latest fixes. Please check it out when you have time.

    Would love to hear if this resolves your issues. If you hit anything else, the --debug flag will dump tfdata.json which helps us diagnose.

  11. robinbowes commented on Mar 30, 2026

    @robinbowes

    This is a very timely development as we use Terragrunt!

    However, when I run terravision to create a diagram of our multi-module setup, I get an error.

    Note: the top-level of the project is /Users/robin/code/test/project/infra and there are three sub-modules, one for each cloud: aws,, azure, gcp.

    ❯ terravision draw --show
    
    
     _____                          _     _
    /__   \___ _ __ _ __ __ ___   _(_)___(_) ___  _ __
      / /\/ _ \ '__| '__/ _` \ \ / / / __| |/ _ \| '_ \
     / / |  __/ |  | | | (_| |\ V /| \__ \ | (_) | | | |
     \/   \___|_|  |_|  \__,_| \_/ |_|___/_|\___/|_| |_|
    
    
    
    Preflight check..
      dot command detected: /opt/homebrew/bin/dot
      gvpr command detected: /opt/homebrew/bin/gvpr
      git command detected: /opt/homebrew/bin/git
      terraform command detected: /Users/robin/.local/share/mise/installs/terraform/1.13.4/terraform
      terraform version detected: Terraform v1.13.4
    
    
    
    Terragrunt detected (multi-module, 3 child modules)
    
    
    Processing Terragrunt module: aws
    
    
    Running Terragrunt Init..
    
    
    Generating Terragrunt Plan..
    
    
    Processing Terragrunt module: az
    
    
    Running Terragrunt Init..
    
    
    Generating Terragrunt Plan..
    
    
    Processing Terragrunt module: gcp
    
    
    Running Terragrunt Init..
    
    
    Generating Terragrunt Plan..
    
    
    Parsing Terraform Source Files..
      Added Source Location: /Users/robin/code/test/project/infra/aws
    ERROR: No Terraform .tf files found in current directory or your source location. Use --source parameter to specify directory or Github URL of source files
    

    Any idea how to fix, or diagnose what might be the problem?

  12. lgg42 commented on Mar 30, 2026

    @lgg42

    Thanks a lot for the quick support and help @patrickchugh ! I tried it again with 0.27.0, with multi unit and single unit. I've got the same error so I'm going to focus in the single unit here. This time is only the init error:

    $ terravision draw --debug --source .
    
    
     _____                          _     _             
    /__   \___ _ __ _ __ __ ___   _(_)___(_) ___  _ __  
      / /\/ _ \ '__| '__/ _` \ \ / / / __| |/ _ \| '_ \ 
     / / |  __/ |  | | | (_| |\ V /| \__ \ | (_) | | | |
     \/   \___|_|  |_|  \__,_| \_/ |_|___/_|\___/|_| |_|
    
    
    
    Preflight check..
      dot command detected: /usr/bin/dot
      gvpr command detected: /usr/bin/gvpr
      git command detected: /usr/bin/git
      terraform command detected: /usr/local/bin/terraform
      terraform version detected: Terraform v1.7.5
    
    
    
    Terragrunt detected (single-module)
    
    
    Running Terragrunt Init..
    
    ╷
    │ Error: Backend initialization required, please run "terraform init"
    │ 
    │ Reason: Initial configuration of the requested backend "s3"
    │ 
    │ The "backend" is the interface that Terraform uses to store state,
    │ perform operations, etc. If this message is showing up, it means that the
    │ Terraform configuration you're using is using a custom configuration for
    │ the Terraform backend.
    │ 
    │ Changes to backend configurations require reinitialization. This allows
    │ Terraform to set up the new configuration, copy existing state, etc. Please
    │ run
    │ "terraform init" with either the "-reconfigure" or "-migrate-state" flags
    │ to
    │ use the current configuration.
    │ 
    │ If the change reason above is incorrect, please verify your configuration
    │ hasn't changed and try again. At this point, no changes to your existing
    │ configuration or state have been made.
    ╵
    ╷
    │ Error: Backend initialization required, please run "terraform init"
    │ 
    │ Reason: Initial configuration of the requested backend "s3"
    │ 
    │ The "backend" is the interface that Terraform uses to store state,
    │ perform operations, etc. If this message is showing up, it means that the
    │ Terraform configuration you're using is using a custom configuration for
    │ the Terraform backend.
    │ 
    │ Changes to backend configurations require reinitialization. This allows
    │ Terraform to set up the new configuration, copy existing state, etc. Please
    │ run
    │ "terraform init" with either the "-reconfigure" or "-migrate-state" flags
    │ to
    │ use the current configuration.
    │ 
    │ If the change reason above is incorrect, please verify your configuration
    │ hasn't changed and try again. At this point, no changes to your existing
    │ configuration or state have been made.
    ╵
    Traceback (most recent call last):
      File "/home/user/devel/infrastructure/live/.venv/bin/terravision", line 6, in <module>
        sys.exit(main())
                 ^^^^^^
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/terravision/terravision.py", line 527, in main
        cli(
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/click/core.py", line 1130, in __call__
        return self.main(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/click/core.py", line 1055, in main
        rv = self.invoke(ctx)
             ^^^^^^^^^^^^^^^^
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/click/core.py", line 1404, in invoke
        return ctx.invoke(self.callback, **ctx.params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/click/core.py", line 760, in invoke
        return __callback(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/terravision/terravision.py", line 381, in draw
        tfdata = compile_tfdata(
                 ^^^^^^^^^^^^^^^
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/terravision/terravision.py", line 192, in compile_tfdata
        tfdata = tgwrapper.tg_initplan(
                 ^^^^^^^^^^^^^^^^^^^^^^
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/modules/tgwrapper.py", line 346, in tg_initplan
        _run_terragrunt_init(codepath, debug)
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/modules/tgwrapper.py", line 246, in _run_terragrunt_init
        raise RuntimeError(f"Terragrunt init failed:\n{stderr}{hint}")
    RuntimeError: Terragrunt init failed:
    

    For whatever reason I didnt't have a tfdata.json created or I wasn't able to find it.

    I'm able to run normally a terragrunt init and terragrunt plan in the unit folder.

    terragrunt plan

    $ terragrunt plan
    Acquiring state lock. This may take a few moments...
    module.rds-master.module.db_instance.random_id.snapshot_identifier[0]: Refreshing state... [id=PKytAQ]
    random_password.postgres_roles_passwords["serviceadmin"]: Refreshing state... [id=none]
    ...
    postgresql_grant.grants["fooadmin-schema"]: Refreshing state... [id=fooadmin_foo_foo_schema]
    postgresql_extension.extension["pgcrypto-bar"]: Refreshing state... [id=bar.pgcrypto]
    postgresql_extension.extension["citext-bar"]: Refreshing state... [id=bar.citext]
    
    No changes. Your infrastructure matches the configuration.
    
    Terraform has compared your real infrastructure against your configuration
    and found no differences, so no changes are needed.
    

    terragrunt init

    $ terragrunt init
    
    Initializing the backend...
    Initializing modules...
    
    Initializing provider plugins...
    - Reusing previous version of hashicorp/helm from the dependency lock file
    - Reusing previous version of hashicorp/random from the dependency lock file
    - Reusing previous version of hashicorp/aws from the dependency lock file
    - Reusing previous version of cyrilgdn/postgresql from the dependency lock file
    - Reusing previous version of alekc/kubectl from the dependency lock file
    - Using previously-installed hashicorp/helm v2.17.0
    - Using previously-installed hashicorp/random v3.8.1
    - Using previously-installed hashicorp/aws v6.36.0
    - Using previously-installed cyrilgdn/postgresql v1.22.0
    - Using previously-installed alekc/kubectl v2.1.3
    
    Terraform has been successfully initialized!
    
    You may now begin working with Terraform. Try running "terraform plan" to see
    any changes that are required for your infrastructure. All Terraform commands
    should now work.
    
    If you ever set or change modules or backend configuration for Terraform,
    rerun this command to reinitialize your working directory. If you forget, other
    commands will detect it and remind you to do so if necessary.
    

    terragrunt version 0.94.0
    terraform version 1.7.5

  13. patrickchugh commented on Apr 3, 2026

    @patrickchugh
    Owner

    @lgg42 @robinbowes @ghulteen Thanks for the detailed bug reports and patience — they were incredibly helpful in tracking down the root causes. We've been doing deep testing and found several issues that explain what you've been hitting:

    What we found

    1. Backend override not reaching dependency modules
      When you run TerraVision on a single module (e.g. rds/shared) that has dependency blocks, Terragrunt auto-initializes those dependencies to read their outputs. Our backend override (terravision_override.tf) was only being written to the target module's directory — not to dependency modules like vpc. So the dependency auto-init would try to configure the real S3 backend and fail.

    2. "No Terraform .tf files found" (@robinbowes's issue)
      After init/plan succeeded, TerraVision was looking for .tf files in the module directory (which only contains terragrunt.hcl). The actual .tf files live inside .terragrunt-cache/. We now correctly resolve the cache path and point the source parser there.

    What we fixed
    Override files are now written to all dependency module directories before init, so Terragrunt's auto-init picks up the local backend override everywhere
    codepath now points to the .terragrunt-cache working directory where the .tf files actually live
    Added a safety net that writes the override directly to the cache directory after init
    If init fails on backend, we attempt recovery via terraform init -reconfigure directly in the cache

    Hope this works. If there are any issues with the final diagram the --debug flag will dump tfdata.json which helps us diagnose.

    Let me know how it goes and thanks for your patience in making terragrunt support a reality.

  14. patrickchugh commented on Apr 7, 2026

    @patrickchugh
    Owner

    @lgg42 any luck trying this ?

  15. lgg42 commented on Apr 7, 2026

    @lgg42

    Hi! I just tried out the single unit scenario rds/shared. ⚠️ These past days I have upgraded my terraform binary.

    terravision 0.32.0
    terragrunt 0.94.0
    terraform 1.14.8

    I do rm -rf .terragrunt-cache* first

    then terragrunt init, then terragrunt plan, everything ok.

    Then I execute terravision draw --debug --source ., this is the output:

    $ terravision draw --debug --source .
    
    
     _____                          _     _             
    /__   \___ _ __ _ __ __ ___   _(_)___(_) ___  _ __  
      / /\/ _ \ '__| '__/ _` \ \ / / / __| |/ _ \| '_ \ 
     / / |  __/ |  | | | (_| |\ V /| \__ \ | (_) | | | |
     \/   \___|_|  |_|  \__,_| \_/ |_|___/_|\___/|_| |_|
    
    
    
    Preflight check..
      dot command detected: /usr/bin/dot
      gvpr command detected: /usr/bin/gvpr
      git command detected: /usr/bin/git
      terraform command detected: /usr/local/bin/terraform
      terraform version detected: Terraform v1.14.8
    
    
    
    Terragrunt detected (single-module)
    
    
    Running Terragrunt Init..
    
    ╷
    │ Error: Backend initialization required, please run "terraform init"
    │ 
    │ Reason: Initial configuration of the requested backend "s3"
    │ 
    │ The "backend" is the interface that Terraform uses to store state,
    │ perform operations, etc. If this message is showing up, it means that the
    │ Terraform configuration you're using is using a custom configuration for
    │ the Terraform backend.
    │ 
    │ Changes to backend configurations require reinitialization. This allows
    │ Terraform to set up the new configuration, copy existing state, etc. Please
    │ run
    │ "terraform init" with either the "-reconfigure" or "-migrate-state" flags
    │ to
    │ use the current configuration.
    │ 
    │ If the change reason above is incorrect, please verify your configuration
    │ hasn't changed and try again. At this point, no changes to your existing
    │ configuration or state have been made.
    ╵
    ╷
    │ Error: Backend initialization required, please run "terraform init"
    │ 
    │ Reason: Initial configuration of the requested backend "s3"
    │ 
    │ The "backend" is the interface that Terraform uses to store state,
    │ perform operations, etc. If this message is showing up, it means that the
    │ Terraform configuration you're using is using a custom configuration for
    │ the Terraform backend.
    │ 
    │ Changes to backend configurations require reinitialization. This allows
    │ Terraform to set up the new configuration, copy existing state, etc. Please
    │ run
    │ "terraform init" with either the "-reconfigure" or "-migrate-state" flags
    │ to
    │ use the current configuration.
    │ 
    │ If the change reason above is incorrect, please verify your configuration
    │ hasn't changed and try again. At this point, no changes to your existing
    │ configuration or state have been made.
    ╵
    Initializing the backend...
    
    Successfully configured the backend "local"! Terraform will automatically
    use this backend unless the backend configuration changes.
    Initializing modules...
    Downloading registry.terraform.io/terraform-aws-modules/security-group/aws 5.3.1 for db_security_group...
    - db_security_group in /tmp/tmpsl1cop4q/modules/db_security_group
    Downloading registry.terraform.io/terraform-aws-modules/rds/aws 6.13.1 for rds-master...
    - rds-master in /tmp/tmpsl1cop4q/modules/rds-master
    - rds-master.db_instance in /tmp/tmpsl1cop4q/modules/rds-master/modules/db_instance
    - rds-master.db_instance_role_association in /tmp/tmpsl1cop4q/modules/rds-master/modules/db_instance_role_association
    - rds-master.db_option_group in /tmp/tmpsl1cop4q/modules/rds-master/modules/db_option_group
    - rds-master.db_parameter_group in /tmp/tmpsl1cop4q/modules/rds-master/modules/db_parameter_group
    - rds-master.db_subnet_group in /tmp/tmpsl1cop4q/modules/rds-master/modules/db_subnet_group
    Downloading registry.terraform.io/terraform-aws-modules/rds/aws 6.13.1 for rds-replica...
    - rds-replica in /tmp/tmpsl1cop4q/modules/rds-replica
    - rds-replica.db_instance in /tmp/tmpsl1cop4q/modules/rds-replica/modules/db_instance
    - rds-replica.db_instance_role_association in /tmp/tmpsl1cop4q/modules/rds-replica/modules/db_instance_role_association
    - rds-replica.db_option_group in /tmp/tmpsl1cop4q/modules/rds-replica/modules/db_option_group
    - rds-replica.db_parameter_group in /tmp/tmpsl1cop4q/modules/rds-replica/modules/db_parameter_group
    - rds-replica.db_subnet_group in /tmp/tmpsl1cop4q/modules/rds-replica/modules/db_subnet_group
    Initializing provider plugins...
    - Reusing previous version of hashicorp/helm from the dependency lock file
    - Reusing previous version of hashicorp/aws from the dependency lock file
    - Reusing previous version of hashicorp/random from the dependency lock file
    - Reusing previous version of cyrilgdn/postgresql from the dependency lock file
    - Reusing previous version of alekc/kubectl from the dependency lock file
    - Installing hashicorp/helm v2.17.0...
    - Installed hashicorp/helm v2.17.0 (signed by HashiCorp)
    - Installing hashicorp/aws v6.36.0...
    - Installed hashicorp/aws v6.36.0 (signed by HashiCorp)
    - Installing hashicorp/random v3.8.1...
    - Installed hashicorp/random v3.8.1 (signed by HashiCorp)
    - Installing cyrilgdn/postgresql v1.22.0...
    - Installed cyrilgdn/postgresql v1.22.0 (self-signed, key ID 3918DD444A3876A6)
    - Installing alekc/kubectl v2.1.3...
    - Installed alekc/kubectl v2.1.3 (self-signed, key ID 772FB27A86DAFCE7)
    Partner and community providers are signed by their developers.
    If you'd like to know more about provider signing, you can read about it here:
    https://developer.hashicorp.com/terraform/cli/plugins/signing
    
    Terraform has been successfully initialized!
    
    You may now begin working with Terraform. Try running "terraform plan" to see
    any changes that are required for your infrastructure. All Terraform commands
    should now work.
    
    If you ever set or change modules or backend configuration for Terraform,
    rerun this command to reinitialize your working directory. If you forget, other
    commands will detect it and remind you to do so if necessary.
    
    Generating Terragrunt Plan..
    
    ╷
    │ Error: Backend initialization required: please run "terraform init"
    │ 
    │ Reason: Backend type changed from "local" to "s3"
    │ 
    │ The "backend" is the interface that Terraform uses to store state,
    │ perform operations, etc. If this message is showing up, it means that the
    │ Terraform configuration you're using is using a custom configuration for
    │ the Terraform backend.
    │ 
    │ Changes to backend configurations require reinitialization. This allows
    │ Terraform to set up the new configuration, copy existing state, etc. Please
    │ run
    │ "terraform init" with either the "-reconfigure" or "-migrate-state" flags
    │ to
    │ use the current configuration.
    │ 
    │ If the change reason above is incorrect, please verify your configuration
    │ hasn't changed and try again. At this point, no changes to your existing
    │ configuration or state have been made.
    ╵
    ╷
    │ Error: Backend initialization required: please run "terraform init"
    │ 
    │ Reason: Backend type changed from "local" to "s3"
    │ 
    │ The "backend" is the interface that Terraform uses to store state,
    │ perform operations, etc. If this message is showing up, it means that the
    │ Terraform configuration you're using is using a custom configuration for
    │ the Terraform backend.
    │ 
    │ Changes to backend configurations require reinitialization. This allows
    │ Terraform to set up the new configuration, copy existing state, etc. Please
    │ run
    │ "terraform init" with either the "-reconfigure" or "-migrate-state" flags
    │ to
    │ use the current configuration.
    │ 
    │ If the change reason above is incorrect, please verify your configuration
    │ hasn't changed and try again. At this point, no changes to your existing
    │ configuration or state have been made.
    ╵
    Traceback (most recent call last):
      File "/home/user/devel/infrastructure/live/.venv/bin/terravision", line 6, in <module>
        sys.exit(main())
                 ^^^^^^
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/terravision/terravision.py", line 652, in main
        cli(
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/click/core.py", line 1130, in __call__
        return self.main(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/click/core.py", line 1055, in main
        rv = self.invoke(ctx)
             ^^^^^^^^^^^^^^^^
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/click/core.py", line 1404, in invoke
        return ctx.invoke(self.callback, **ctx.params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/click/core.py", line 760, in invoke
        return __callback(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/terravision/terravision.py", line 382, in draw
        tfdata = compile_tfdata(
                 ^^^^^^^^^^^^^^^
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/terravision/terravision.py", line 193, in compile_tfdata
        tfdata = tgwrapper.tg_initplan(
                 ^^^^^^^^^^^^^^^^^^^^^^
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/modules/tgwrapper.py", line 436, in tg_initplan
        _run_terragrunt_plan(codepath, varfile, tfplan_path, debug)
      File "/home/user/devel/infrastructure/live/.venv/lib/python3.11/site-packages/modules/tgwrapper.py", line 358, in _run_terragrunt_plan
        raise RuntimeError(f"Terragrunt plan failed:\n{stderr}{hint}")
    RuntimeError: Terragrunt plan failed:
    

    If I run the terravision comand again the output is the same.

    I also noticed that I have activated provider caching but I thiiiiink terravision is always downloading them

    $ env | grep CACHE
    TG_PROVIDER_CACHE=1
    TERRAGRUNT_PROVIDER_CACHE=1
    TG_PROVIDER_CACHE_DIR=/home/user/.terragrunt_provider_cache
    TERRAGRUNT_PROVIDER_CACHE_DIR=/home/user/.terragrunt_provider_cache
    
  16. robinbowes commented on Apr 7, 2026

    @robinbowes

    @patrickchugh I tried again with the latest version (0.32.0) and I now see init and plan executed for all three clouds.

    However, I get this backtrace before the graph is shown:

    Traceback (most recent call last):
      File "/Users/robin/.local/bin/terravision", line 10, in <module>
        sys.exit(main())
                 ^^^^^^
      File "/Users/robin/.local/share/uv/tools/terravision/lib/python3.12/site-packages/terravision/terravision.py", line 652, in main
        cli(
      File "/Users/robin/.local/share/uv/tools/terravision/lib/python3.12/site-packages/click/core.py", line 1130, in __call__
        return self.main(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/robin/.local/share/uv/tools/terravision/lib/python3.12/site-packages/click/core.py", line 1055, in main
        rv = self.invoke(ctx)
             ^^^^^^^^^^^^^^^^
      File "/Users/robin/.local/share/uv/tools/terravision/lib/python3.12/site-packages/click/core.py", line 1657, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/robin/.local/share/uv/tools/terravision/lib/python3.12/site-packages/click/core.py", line 1404, in invoke
        return ctx.invoke(self.callback, **ctx.params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/robin/.local/share/uv/tools/terravision/lib/python3.12/site-packages/click/core.py", line 760, in invoke
        return __callback(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/robin/.local/share/uv/tools/terravision/lib/python3.12/site-packages/terravision/terravision.py", line 382, in draw
        tfdata = compile_tfdata(
                 ^^^^^^^^^^^^^^^
      File "/Users/robin/.local/share/uv/tools/terravision/lib/python3.12/site-packages/terravision/terravision.py", line 245, in compile_tfdata
        tfdata = _enrich_graph_data(tfdata, debug, already_processed)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/robin/.local/share/uv/tools/terravision/lib/python3.12/site-packages/terravision/terravision.py", line 106, in _enrich_graph_data
        tfdata = interpreter.resolve_all_variables(tfdata, debug, already_processed)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/robin/.local/share/uv/tools/terravision/lib/python3.12/site-packages/modules/interpreter.py", line 46, in resolve_all_variables
        tfdata = inject_module_variables(tfdata)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/robin/.local/share/uv/tools/terravision/lib/python3.12/site-packages/modules/interpreter.py", line 113, in inject_module_variables
        value = handle_module_vars(str(value), tfdata)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/robin/.local/share/uv/tools/terravision/lib/python3.12/site-packages/modules/interpreter.py", line 91, in handle_module_vars
        eval_string = helpers.cleanup_curlies(eval_string.replace(modulevar, outvalue))
                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    TypeError: replace() argument 2 must be str, not dict
    

    I have a tfdata.json - I can't share it, but I'm happy to issue any debug commands that might help figure out what the problem is.

  17. patrickchugh commented on Apr 11, 2026

    @patrickchugh
    Owner

    @lgg42 New release out with --debug improvements and targeted Terragrunt diagnostics aimed at your "backend keeps changing" symptom.

    I've tried hard to reproduce locally — terragrunt 0.94.0, real S3 backend, your exact dependency + generate "backend" pattern, with TG_PROVIDER_CACHE set — and can't trigger it. Something specific to your env is in play.

    Could you upgrade and re-run terravision draw --debug --source .?

    The new diagnostic prints --- [tg-debug] --- sections at four checkpoints (after init, after fallback init, before plan, after plan). Each shows whether terravision_override.tf exists, what backend backend.tf declares, what terraform's stored state claims, and every .tf-containing dir under .terragrunt-cache/. Paste those sections (sanitized) and we should be able to pinpoint exactly when things go wrong.

    Also helpful:

    1. Sanitized root.hcl generate "backend" block and rds/terragrunt.hcl
    2. Whether running terragrunt directly with terravision's exact args fails the same way:
    cd <rds dir>
    TF_CLI_ARGS_init=-reconfigure TF_INPUT=false terragrunt init -reconfigure
    TF_CLI_ARGS_init=-reconfigure TF_INPUT=false terragrunt plan -refresh=false -out=/tmp/tg-plan.bin
    

    If that fails standalone → terragrunt/config bug. If it succeeds but terravision still fails → terravision is doing something extra.

    1. Sanity check: try unset TG_PROVIDER_CACHE TERRAGRUNT_PROVIDER_CACHE TG_PROVIDER_CACHE_DIR TERRAGRUNT_PROVIDER_CACHE_DIR before running terravision. If the bug goes away, the provider cache is involved.

    Thanks for sticking with this.

  18. patrickchugh commented on Apr 11, 2026

    @patrickchugh
    Owner

    @robinbowes Can you try again with the latest code? That was a bug unrealted to terragrunt and it should be fixed

  19. lgg42 commented on Apr 12, 2026

    @lgg42

    @lgg42 New release out with --debug improvements and targeted Terragrunt diagnostics aimed at your "backend keeps changing" symptom.

    I've tried hard to reproduce locally — terragrunt 0.94.0, real S3 backend, your exact dependency + generate "backend" pattern, with TG_PROVIDER_CACHE set — and can't trigger it. Something specific to your env is in play.

    Could you upgrade and re-run terravision draw --debug --source .?

    The new diagnostic prints --- [tg-debug] --- sections at four checkpoints (after init, after fallback init, before plan, after plan). Each shows whether terravision_override.tf exists, what backend backend.tf declares, what terraform's stored state claims, and every .tf-containing dir under .terragrunt-cache/. Paste those sections (sanitized) and we should be able to pinpoint exactly when things go wrong.

    Also helpful:

    1. Sanitized root.hcl generate "backend" block and rds/terragrunt.hcl
    2. Whether running terragrunt directly with terravision's exact args fails the same way:
    cd <rds dir>
    TF_CLI_ARGS_init=-reconfigure TF_INPUT=false terragrunt init -reconfigure
    TF_CLI_ARGS_init=-reconfigure TF_INPUT=false terragrunt plan -refresh=false -out=/tmp/tg-plan.bin
    

    If that fails standalone → terragrunt/config bug. If it succeeds but terravision still fails → terravision is doing something extra.

    1. Sanity check: try unset TG_PROVIDER_CACHE TERRAGRUNT_PROVIDER_CACHE TG_PROVIDER_CACHE_DIR TERRAGRUNT_PROVIDER_CACHE_DIR before running terravision. If the bug goes away, the provider cache is involved.

    Thanks for sticking with this.

    Hey! Thanks! I need to dedicate some time to execute these steps carefully and provide you with the info you request. In the meanwhile, here's the new output with the new terravision version 0.33.0 (the rest of the error is the same as before)

    [tg-debug] _find_terragrunt_cache_dir candidates (2):
      SDfN2i3sTq0VOYvEujwmY4M7xRo/jqFGG9H7GHjRW01WwSdma-8YcIg: marker=backend.tf terragrunt_sig_in_first_200B=True
      SDfN2i3sTq0VOYvEujwmY4M7xRo/jqFGG9H7GHjRW01WwSdma-8YcIg: marker=provider.tf terragrunt_sig_in_first_200B=True
    [tg-debug] picked: SDfN2i3sTq0VOYvEujwmY4M7xRo/jqFGG9H7GHjRW01WwSdma-8YcIg
    
    --- [tg-debug] after terragrunt init ---
      cache_dir: /home/luis/devel/infrastructure/live/staging/us-east-1/data-stores/rds/shared/.terragrunt-cache/SDfN2i3sTq0VOYvEujwmY4M7xRo/jqFGG9H7GHjRW01WwSdma-8YcIg
      TF_DATA_DIR: /tmp/tmpt3uydbm6
      override file: MISSING
      backend.tf: EXISTS (325 bytes)
        backend type in file: s3
      stored state (TF_DATA_DIR): MISSING (/tmp/tmpt3uydbm6/terraform.tfstate)
      stored .terraform/terraform.tfstate (cache_dir): backend.type='s3'
      .tf files in cache_dir: ['backend.tf', 'main.tf', 'outputs.tf', 'provider.tf', 'variables.tf', 'versions.tf']
      all .tf-containing dirs in .terragrunt-cache (2 found):
        SDfN2i3sTq0VOYvEujwmY4M7xRo/jqFGG9H7GHjRW01WwSdma-8YcIg [PICKED]: markers=['backend.tf', 'provider.tf'] has_local_state=True
        SDfN2i3sTq0VOYvEujwmY4M7xRo/jqFGG9H7GHjRW01WwSdma-8YcIg/examples/complete: markers=[] has_local_state=False
    

    --- [tg-debug] after fallback terraform init ---
      cache_dir: /home/luis/devel/infrastructure/live/staging/us-east-1/data-stores/rds/shared/.terragrunt-cache/SDfN2i3sTq0VOYvEujwmY4M7xRo/jqFGG9H7GHjRW01WwSdma-8YcIg
      TF_DATA_DIR: /tmp/tmpt3uydbm6
      override file: EXISTS (39 bytes)
        content: 'terraform {\n  backend "local" {\n\n  }\n}\n'
      backend.tf: EXISTS (325 bytes)
        backend type in file: s3
      stored .terraform/terraform.tfstate (TF_DATA_DIR): backend.type='local'
      stored .terraform/terraform.tfstate (cache_dir): backend.type='s3'
      .tf files in cache_dir: ['backend.tf', 'main.tf', 'outputs.tf', 'provider.tf', 'terravision_override.tf', 'variables.tf', 'versions.tf']
      all .tf-containing dirs in .terragrunt-cache (2 found):
        SDfN2i3sTq0VOYvEujwmY4M7xRo/jqFGG9H7GHjRW01WwSdma-8YcIg [PICKED]: markers=['backend.tf', 'provider.tf', 'terravision_override.tf'] has_local_state=True
        SDfN2i3sTq0VOYvEujwmY4M7xRo/jqFGG9H7GHjRW01WwSdma-8YcIg/examples/complete: markers=[] has_local_state=False
    
    --- [tg-debug] before terragrunt plan ---
      cache_dir: /home/luis/devel/infrastructure/live/staging/us-east-1/data-stores/rds/shared/.terragrunt-cache/SDfN2i3sTq0VOYvEujwmY4M7xRo/jqFGG9H7GHjRW01WwSdma-8YcIg
      TF_DATA_DIR: /tmp/tmpt3uydbm6
      override file: EXISTS (39 bytes)
        content: 'terraform {\n  backend "local" {\n\n  }\n}\n'
      backend.tf: EXISTS (325 bytes)
        backend type in file: s3
      stored .terraform/terraform.tfstate (TF_DATA_DIR): backend.type='local'
      stored .terraform/terraform.tfstate (cache_dir): backend.type='s3'
      .tf files in cache_dir: ['backend.tf', 'main.tf', 'outputs.tf', 'provider.tf', 'terravision_override.tf', 'variables.tf', 'versions.tf']
      all .tf-containing dirs in .terragrunt-cache (2 found):
        SDfN2i3sTq0VOYvEujwmY4M7xRo/jqFGG9H7GHjRW01WwSdma-8YcIg [PICKED]: markers=['backend.tf', 'provider.tf', 'terravision_override.tf'] has_local_state=True
        SDfN2i3sTq0VOYvEujwmY4M7xRo/jqFGG9H7GHjRW01WwSdma-8YcIg/examples/complete: markers=[] has_local_state=False
    

    --- [tg-debug] after terragrunt plan ---
      cache_dir: /home/luis/devel/infrastructure/live/staging/us-east-1/data-stores/rds/shared/.terragrunt-cache/SDfN2i3sTq0VOYvEujwmY4M7xRo/jqFGG9H7GHjRW01WwSdma-8YcIg
      TF_DATA_DIR: /tmp/tmpt3uydbm6
      override file: EXISTS (39 bytes)
        content: 'terraform {\n  backend "local" {\n\n  }\n}\n'
      backend.tf: EXISTS (325 bytes)
        backend type in file: s3
      stored .terraform/terraform.tfstate (TF_DATA_DIR): backend.type='local'
      stored .terraform/terraform.tfstate (cache_dir): backend.type='s3'
      .tf files in cache_dir: ['backend.tf', 'main.tf', 'outputs.tf', 'provider.tf', 'terravision_override.tf', 'variables.tf', 'versions.tf']
      all .tf-containing dirs in .terragrunt-cache (2 found):
        SDfN2i3sTq0VOYvEujwmY4M7xRo/jqFGG9H7GHjRW01WwSdma-8YcIg [PICKED]: markers=['backend.tf', 'provider.tf', 'terravision_override.tf'] has_local_state=True
        SDfN2i3sTq0VOYvEujwmY4M7xRo/jqFGG9H7GHjRW01WwSdma-8YcIg/examples/complete: markers=[] has_local_state=False
    
    
  20. added a commit that references this issue on Apr 14, 2026
  21. patrickchugh commented on Apr 14, 2026

    @patrickchugh
    Owner

    @lgg42 We implemented a fix. Can you try with the latest version? I still cannot reproduce your problem locally so if it still doesn't work just share the debug output again. Thanks.

  22. robinbowes commented on Apr 14, 2026

    @robinbowes

    @robinbowes Can you try again with the latest code? That was a bug unrealted to terragrunt and it should be fixed

    Hi @patrickchugh,

    I still see the same error:

    ERROR: replace() argument 2 must be str, not dict
    

    I also see lots of warnings:

    WARNING: Cannot resolve variable after 50 iterations: toset(keys(module.security_groups.security_groups))
    

    and:

    WARNING: Cannot resolve variable after 50 iterations: module.security_groups.security_group_entries
    

    Both warnings show for various variables and resources, not just the two listed above.

  23. patrickchugh commented on Apr 14, 2026

    @patrickchugh
    Owner

    @robinbowes Can you produce a diagram in the end? If so, can you please run terravision with the --debug flag, and then share your tfdata.json dump file so I can try to re-produce the error? You can do a find/replace on the JSON to replace any account numbers or other data you wish to mask before sharing.

    @robinbowes Can you try again with the latest code? That was a bug unrealted to terragrunt and it should be fixed

    Hi @patrickchugh,

    I still see the same error:

    ERROR: replace() argument 2 must be str, not dict
    
    WARNING: Cannot resolve variable after 50 iterations: module.security_groups.security_group_entries
    
  24. lgg42 commented on Apr 15, 2026

    @lgg42

    @lgg42 We implemented a fix. Can you try with the latest version? I still cannot reproduce your problem locally so if it still doesn't work just share the debug output again. Thanks.

    For the rds/shared unit it shows the same error, but I tried a different unit and it worked and generated the diagram. I've tried another single-module and multi-modules and it fails in some of them and succeed in other

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions