Skip to content

HTTP

An HTTP source is identified by its URL. Unless the URL pins a checksum=, Terragrunt cannot key it by a content hash up front, so it asks the server for a validator (an ETag or Last-Modified value) and keys the cached tree by that validator, scoped to the URL.

The probe Terragrunt uses to attempt to avoid fetching HTTP sources is a HEAD request to the source URL. Terragrunt reads the ETag header when present, falling back to Last-Modified. Whichever it finds becomes the cache key.

go-getter consumes a few query parameters itself rather than forwarding them to the server (archive, checksum, and filename). Terragrunt sends the HEAD request without them and keys the cached tree by the URL with archive and filename kept, so a raw download and an extracted one are stored apart.

A checksum= pin replaces the probe. The cached tree is keyed by the URL and the checksum, so the first run downloads and verifies the content, and later runs link it from the store without a request. A checksum=file: reference has no key until the file is read, so Terragrunt downloads and verifies the source on every run, and fails under --cas-offline.

The validator is treated as opaque, and the key is scoped to the URL. An ETag is not a portable content hash: a server may assign it however it likes, and multipart or weak ETags are not hashes of the body. Two different URLs that serve byte-identical content therefore do not deduplicate at the tree level. The underlying file blobs are still content-addressed, so identical files across sources continue to share blob storage.

Weak-validator markers (W/) and surrounding quotes are normalized, so the same response keyed either way maps to one entry.

If the probe produces no usable validator, or the validator is not yet present in the store, Terragrunt downloads the resource, walks it, hashes its files, and stores the tree. When the probe produced a key, the tree is stored under that key so the next run hits; when it did not, the tree is keyed by the content hash of what was downloaded.

When the probe returns a validator already present in the store, Terragrunt links the cached tree and skips downloading the body.

Any network error, non-2xx response, or timeout makes the probe yield no key. Terragrunt then falls back to downloading and content-hashing the result. The fetch still happens; only the short-circuit is skipped.

http:// and https:// URLs are accepted. The go-getter magic parameters (archive=, checksum=, filename=) are honored on the download. The HEAD request carries none of them; the cache key keeps archive= and filename=, and a checksum= pin replaces the validator. .netrc credentials are honored on the download.