Run Terraform When a Dependent Local-Path Module is Updated
By default, list-targets lists updated root modules, but if a root module references a module by traversing up the directory hierarchy, updating that referenced module does not add the root module to the list.
foo/
tfaction.yaml
main.tf # References ../modules/db
modules/
db/
main.tf
module "db" {
source = "../modules/db"
}
By enabling update_local_path_module_caller in tfaction-root.yaml, root modules will also be added to the list when a dependent module is updated.
update_local_path_module_caller:
enabled: true
Internally, dependencies are analyzed using a tool called terraform-config-inspect.
This feature is relatively popular, but personally I am not a big fan of it.
- It takes time
- terraform-config-inspect needs to be built from source
- terraform-config-inspect must be run on all root modules, so execution time increases proportionally with the number of root modules
- Plan and apply run simultaneously on all dependent root modules
- You cannot apply to a development environment before production
- If a problem occurs in one root module causing a plan failure or a dangerous change, it blocks applying to all other root modules