Back to Terragrunt

Dependency Fetch Output From State

docs/src/data/experiments/dependency-fetch-output-from-state.mdx

1.1.43.3 KB
Original Source

Support for fetching dependency outputs directly from state files.

dependency-fetch-output-from-state - What it does

By default, Terragrunt retrieves dependency outputs by running tofu output or terraform output commands, which requires initializing the dependency unit and can be slow. When this experiment is enabled, Terragrunt will attempt to fetch dependency outputs directly from the remote state file, bypassing the need to initialize the dependency and significantly speeding up dependency processing.

Current Backend Support:

  • S3 and GCS backends: Direct state reads are supported
  • Azure Storage (azurerm) backend: Direct state reads are supported when the azure-backend experiment is also enabled
  • Other backends: Falls back to the normal method (using tofu/terraform output)

Azure state protected with customer_provided_key, and Azure configurations that rely on native-only authentication, metadata_host, or timeout_seconds, also use the normal method.

GCS configurations that rely on backend-only credential environment variables, inline credentials or relative credential-file paths, service-account impersonation, custom storage endpoints, custom universe domains, or competing credential sources with different precedence also use the normal method. This preserves the native backend's authentication and endpoint behavior.

Known Limitations:

This experiment is not compatible with OpenTofu state encryption. When OpenTofu's client-side state encryption is enabled, the state file is encrypted before upload. Since this experiment reads the raw state object directly through the backend's cloud storage API, it cannot decrypt the state and will fail with a JSON parsing error. If you are using OpenTofu state encryption, you must disable this experiment using the --no-dependency-fetch-output-from-state flag.

Disabling the feature:

You can disable the dependency-fetch-output-from-state feature using the --no-dependency-fetch-output-from-state flag, even when the experiment is enabled:

bash
terragrunt run --all --experiment-mode --no-dependency-fetch-output-from-state -- plan

dependency-fetch-output-from-state - How to provide feedback

Provide your feedback in the dedicated GitHub discussion page. When reporting issues or providing feedback, please include:

  • The backend type you're using
  • Any performance improvements you've observed
  • Any issues or edge cases you've encountered

dependency-fetch-output-from-state - Criteria for stabilization

To transition the dependency-fetch-output-from-state feature to a stable release, the following must be addressed, at a minimum:

  • Add support for additional backends (GCS and Azure Storage)
  • Live direct-state-read integration coverage for S3, GCS, and Azure Storage
  • Comprehensive integration testing across backend authentication, encryption, workspace, and error scenarios
  • Performance benchmarking to validate speed improvements
  • Error handling and edge case testing
  • Documentation of supported backends and limitations
  • Handle OpenTofu state encryption gracefully (fallback or explicit error message)
  • Community feedback on real-world usage