# Terragrunt<no value>
// <!-- Required for asciidoctor -->
:toc:
// Set toclevels to be at least your hugo [markup.tableOfContents.endLevel] config key
:toclevels: 4

== Description

The Terragrunt crawler looks recursively for all Terragrunt files (*.hcl) containing a module definition from a specific root directory.
Then for each of them, it tries to automate its update.

It currently support two types of sources:
- link:{{< ref "registry" >}}[`terraform/registry`]
- link:{{< ref "gittag" >}}[`gittag`]

It will parsed the module source and infer the source type.

It will update the file using the link:{{< ref "hcl" >}}[`hcl`] target.

It supports the following module source definition and will update with prefixing accordingly

[,hcl]
----
terraform {
  source = "tfr://someModule?version=1.2.3
}
terraform {
  source = local.base_url
}
terraform {
  source = "tfr://${local.module}?version=${local.module_version}"
}
terraform {
  source = "tfr://someModule?version=${local.module_version}"
}
terraform {
  source = "tfr://${local.module}?version=1.2.3"
}
----

This crawler is enabled by default, so it can be used either automatically by running `updatecli diff` from a directory containing the files to update, or by providing a manifest.
The automatic discovery behavior can be tuned by providing a YAML manifest with a `terragrunt` crawler in top-level directive `autodiscovery` as explained in the link:/docs/core/autodiscovery/#_parameters["Autodiscovery" page].

== Generated manifests

The source kind is inferred from the module source:

* a `tfr://` source resolves through link:{{< ref "registry" >}}[`terraform/registry`],
* a `git::` source resolves through link:{{< ref "gittag" >}}[`gittag`], reading tags from the remote repository.

In both cases the version is written back with the link:{{< ref "hcl" >}}[`hcl`] target.

== Authentication

Git-hosted modules are queried over the network, so private repositories need credentials. Set `username` and `token` to authenticate against the git provider.

== Manifest
=== Parameters

{{< autodiscoveryparameters "terragrunt" >}}

=== Example

[source,yaml]
----
# updatecli.d/default.yaml
{{<include "assets/code_example/docs/plugins/autodiscovery/terragrunt/updatecli.d/default.yaml">}}
----
