gruntwork-io / terragrunt

Terragrunt is a flexible orchestration tool that allows Infrastructure as Code written in OpenTofu/Terraform to scale.
https://terragrunt.gruntwork.io/
MIT License
8.09k stars 981 forks source link

Deprecate, remove, and replace `dependencies` block #1863

Open yorinasub17 opened 3 years ago

yorinasub17 commented 3 years ago

With the introduction of dependency blocks, the functionality of dependencies is less useful as it is an implicit list of configurations. To avoid confusion, we should deprecate and remove the dependencies block.

Before removing however, there is one use case for dependencies block where it allows a concise representation of multiple dependencies. We should consider replacing the dependencies block by adding support for for_each to dependency blocks. E.g.:

dependency "all_deps" {
  for_each    = ["../vpc", "../mysql", "../redis"]
  config_path = each.value
}

Motivation

Currently, we use the old dependencies block for the configstack graph representation. This was done to speed up development of the dependency blocks, but has led to a few headaches, the latest one being https://github.com/gruntwork-io/terragrunt/issues/1852. We should take this opportunity to remove the dependencies block and consolidate the dependency handling logic around the internal representation of dependency blocks.

tjstansell commented 2 years ago

I just ran across this ticket while investigating long startup times for terragrunt. If I understand correctly, the two would provide the same functional and performance impact:


dependencies {
  paths = ["../vpc", "../mysql", "../redis"]
}

dependency {
  for_each     = ["../vpc", "../mysql", "../redis"]
  config_path  = each.value
  skip_outputs = true
}