diff --git a/lib/modules/manager/terragrunt/__fixtures__/2.hcl b/lib/modules/manager/terragrunt/__fixtures__/2.hcl
index 29d30085460cf2faedb02ceade9910c8cff9567d..b99906d626d704db553478ac385448c044057d16 100644
--- a/lib/modules/manager/terragrunt/__fixtures__/2.hcl
+++ b/lib/modules/manager/terragrunt/__fixtures__/2.hcl
@@ -33,9 +33,9 @@ terraform {
   source = "github.com/hashicorp/example?ref=next"
 }
 
-#hostname
+#IP
 terraform {
-  source = "https://104.196.242.174"example?ref=next"
+  source = "https://104.196.242.174/example?ref=next"
 }
 
 #local hostname
@@ -63,7 +63,7 @@ terraform {
   source = "my.host.local/sources/example?ref=v1.2.1"
 }
 
-#ip
+#hostname
 terraform {
   source = "my.host/example?ref=next"
 }
diff --git a/lib/modules/manager/terragrunt/__fixtures__/3.hcl b/lib/modules/manager/terragrunt/__fixtures__/3.hcl
new file mode 100644
index 0000000000000000000000000000000000000000..bfb076653db87562aac26d56aac224e887c32f02
--- /dev/null
+++ b/lib/modules/manager/terragrunt/__fixtures__/3.hcl
@@ -0,0 +1,166 @@
+#real
+terraform {
+  extra_arguments "common_vars" {
+    commands = ["plan", "apply"]
+
+    arguments = [
+      "-var-file=../../common.tfvars",
+      "-var-file=../region.tfvars"
+    ]
+  }
+
+  before_hook "before_hook" {
+    commands     = ["apply", "plan"]
+    execute      = ["echo", "Running Terraform"]
+  }
+
+  source = "github.com/myuser/myrepo//folder/modules/moduleone?ref=v0.0.9&depth=1"
+
+  after_hook "after_hook" {
+    commands     = ["apply", "plan"]
+    execute      = ["echo", "Finished running Terraform"]
+    run_on_error = true
+  }
+}
+
+#foo
+terraform {
+  source = "github.com/hashicorp/example?ref=v1.0.0&depth=1"
+}
+
+#bar
+terraform {
+  source = "github.com/hashicorp/example?ref=next&depth=3"
+}
+
+#IP
+terraform {
+  source = "https://104.196.242.174/example?ref=next&depth=1"
+}
+
+#local hostname
+terraform {
+  source = "my.host.local/example?ref=v1.2.1&depth=1"
+}
+
+#local hostname
+terraform {
+  source = "my.host/modules/test"
+}
+
+#local hostname
+terraform {
+  source = "my.host/modules/test?ref=v1.2.1&depth=1"
+}
+
+#local hostname
+terraform {
+  source = "my.host"
+}
+
+#local hostname
+terraform {
+  source = "my.host.local/sources/example?ref=v1.2.1&depth=1"
+}
+
+#hostname
+terraform {
+  source = "my.host/example?ref=next&depth=1"
+}
+
+#invalid
+terraform {
+  source = "//terraform/module/test?ref=next&depth=1"
+}
+
+#repo-with-non-semver-ref
+terraform {
+  source = "github.com/githubuser/myrepo//terraform/modules/moduleone?ref=tfmodule_one-v0.0.9&depth=1"
+}
+
+#repo-with-dot
+terraform {
+  source = "github.com/hashicorp/example.2.3?ref=v1.0.0&depth=1"
+}
+
+#repo-with-dot-and-git-suffix
+terraform {
+  source = "github.com/hashicorp/example.2.3.git?ref=v1.0.0&depth=1"
+}
+
+#source without pinning
+terraform {
+  source  = "hashicorp/consul/aws"
+}
+
+# source with double-slash
+terraform {
+  source         = "github.com/tieto-cem/terraform-aws-ecs-task-definition//modules/container-definition?ref=v0.1.0&depth=1"
+}
+
+# regular sources
+terraform {
+  source = "github.com/tieto-cem/terraform-aws-ecs-task-definition?ref=v0.1.0&depth=1"
+}
+
+terraform {
+  source = "git@github.com:hashicorp/example.git?ref=v2.0.0&depth=1"
+}
+
+terraform {
+  source = "terraform-aws-modules/security-group/aws//modules/http-80"
+
+}
+
+terraform {
+  source  = "terraform-aws-modules/security-group/aws"
+}
+
+terraform {
+  source = "../../terraforms/fe"
+}
+
+# nosource, ignored by test since it does not have source on the next line
+terraform {
+  foo = "bar"
+}
+
+# foobar
+terraform {
+  source = "https://bitbucket.com/hashicorp/example?ref=v1.0.0&depth=1"
+}
+
+# gittags
+terraform {
+  source = "git::https://bitbucket.com/hashicorp/example?ref=v1.0.0&depth=1"
+}
+
+# gittags_badversion
+terraform {
+  source = "git::https://bitbucket.com/hashicorp/example?ref=next&depth=1"
+}
+
+# gittags_subdir
+terraform {
+  source = "git::https://bitbucket.com/hashicorp/example//subdir/test?ref=v1.0.1&depth=1"
+}
+
+# gittags_http
+terraform {
+  source = "git::http://bitbucket.com/hashicorp/example?ref=v1.0.2&depth=1"
+}
+
+# gittags_ssh
+terraform {
+  source = "git::ssh://git@bitbucket.com/hashicorp/example?ref=v1.0.3&depth=1"
+}
+
+# invalid, ignored by test since it does not have source on the next line
+terraform {
+}
+
+# unsupported terragrunt, ignored by test since it does not have source on the next line
+terraform {
+  name  = "foo"
+  dummy = "true"
+}
diff --git a/lib/modules/manager/terragrunt/__fixtures__/4.hcl b/lib/modules/manager/terragrunt/__fixtures__/4.hcl
new file mode 100644
index 0000000000000000000000000000000000000000..72889fb6aed347d71fdc5898c4ba6c3296978fdf
--- /dev/null
+++ b/lib/modules/manager/terragrunt/__fixtures__/4.hcl
@@ -0,0 +1,166 @@
+#real
+terraform {
+  extra_arguments "common_vars" {
+    commands = ["plan", "apply"]
+
+    arguments = [
+      "-var-file=../../common.tfvars",
+      "-var-file=../region.tfvars"
+    ]
+  }
+
+  before_hook "before_hook" {
+    commands     = ["apply", "plan"]
+    execute      = ["echo", "Running Terraform"]
+  }
+
+  source = "github.com/myuser/myrepo//folder/modules/moduleone?depth=1&ref=v0.0.9"
+
+  after_hook "after_hook" {
+    commands     = ["apply", "plan"]
+    execute      = ["echo", "Finished running Terraform"]
+    run_on_error = true
+  }
+}
+
+#foo
+terraform {
+  source = "github.com/hashicorp/example?depth=5&ref=v1.0.0"
+}
+
+#bar
+terraform {
+  source = "github.com/hashicorp/example?depth=1&ref=next"
+}
+
+#IP
+terraform {
+  source = "https://104.196.242.174/example?depth=1&ref=next"
+}
+
+#local hostname
+terraform {
+  source = "my.host.local/example?depth=1&ref=v1.2.1"
+}
+
+#local hostname
+terraform {
+  source = "my.host/modules/test"
+}
+
+#local hostname
+terraform {
+  source = "my.host/modules/test?depth=1&ref=v1.2.1"
+}
+
+#local hostname
+terraform {
+  source = "my.host"
+}
+
+#local hostname
+terraform {
+  source = "my.host.local/sources/example?depth=1&ref=v1.2.1"
+}
+
+#hostname
+terraform {
+  source = "my.host/example?depth=1&ref=next"
+}
+
+#invalid
+terraform {
+  source = "//terraform/module/test?depth=1&ref=next"
+}
+
+#repo-with-non-semver-ref
+terraform {
+  source = "github.com/githubuser/myrepo//terraform/modules/moduleone?depth=1&ref=tfmodule_one-v0.0.9"
+}
+
+#repo-with-dot
+terraform {
+  source = "github.com/hashicorp/example.2.3?depth=1&ref=v1.0.0"
+}
+
+#repo-with-dot-and-git-suffix
+terraform {
+  source = "github.com/hashicorp/example.2.3.git?depth=1&ref=v1.0.0"
+}
+
+#source without pinning
+terraform {
+  source  = "hashicorp/consul/aws"
+}
+
+# source with double-slash
+terraform {
+  source         = "github.com/tieto-cem/terraform-aws-ecs-task-definition//modules/container-definition?depth=1&ref=v0.1.0"
+}
+
+# regular sources
+terraform {
+  source = "github.com/tieto-cem/terraform-aws-ecs-task-definition?depth=1&ref=v0.1.0"
+}
+
+terraform {
+  source = "git@github.com:hashicorp/example.git?depth=1&ref=v2.0.0"
+}
+
+terraform {
+  source = "terraform-aws-modules/security-group/aws//modules/http-80"
+
+}
+
+terraform {
+  source  = "terraform-aws-modules/security-group/aws"
+}
+
+terraform {
+  source = "../../terraforms/fe"
+}
+
+# nosource, ignored by test since it does not have source on the next line
+terraform {
+  foo = "bar"
+}
+
+# foobar
+terraform {
+  source = "https://bitbucket.com/hashicorp/example?depth=1&ref=v1.0.0"
+}
+
+# gittags
+terraform {
+  source = "git::https://bitbucket.com/hashicorp/example?depth=1&ref=v1.0.0"
+}
+
+# gittags_badversion
+terraform {
+  source = "git::https://bitbucket.com/hashicorp/example?depth=1&ref=next"
+}
+
+# gittags_subdir
+terraform {
+  source = "git::https://bitbucket.com/hashicorp/example//subdir/test?depth=1&ref=v1.0.1"
+}
+
+# gittags_http
+terraform {
+  source = "git::http://bitbucket.com/hashicorp/example?depth=1&ref=v1.0.2"
+}
+
+# gittags_ssh
+terraform {
+  source = "git::ssh://git@bitbucket.com/hashicorp/example?depth=1&ref=v1.0.3"
+}
+
+# invalid, ignored by test since it does not have source on the next line
+terraform {
+}
+
+# unsupported terragrunt, ignored by test since it does not have source on the next line
+terraform {
+  name  = "foo"
+  dummy = "true"
+}
diff --git a/lib/modules/manager/terragrunt/__snapshots__/extract.spec.ts.snap b/lib/modules/manager/terragrunt/__snapshots__/extract.spec.ts.snap
deleted file mode 100644
index 84d85982b1cb2aadb4235877b9799135541219e0..0000000000000000000000000000000000000000
--- a/lib/modules/manager/terragrunt/__snapshots__/extract.spec.ts.snap
+++ /dev/null
@@ -1,171 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`modules/manager/terragrunt/extract extractPackageFile() extracts terragrunt sources 1`] = `
-{
-  "deps": [
-    {
-      "currentValue": "v0.0.9",
-      "datasource": "github-tags",
-      "depName": "github.com/myuser/myrepo",
-      "depType": "github",
-      "packageName": "myuser/myrepo",
-    },
-    {
-      "currentValue": "v1.0.0",
-      "datasource": "github-tags",
-      "depName": "github.com/hashicorp/example",
-      "depType": "github",
-      "packageName": "hashicorp/example",
-    },
-    {
-      "currentValue": "next",
-      "datasource": "github-tags",
-      "depName": "github.com/hashicorp/example",
-      "depType": "github",
-      "packageName": "hashicorp/example",
-    },
-    {
-      "skipReason": "no-source",
-    },
-    {},
-    {
-      "datasource": "terraform-module",
-      "depName": "my.host/modules/test",
-      "depType": "terragrunt",
-      "registryUrls": [
-        "https://my.host",
-      ],
-    },
-    {
-      "datasource": "terraform-module",
-      "depName": "my.host/modules/test?ref=v1.2.1",
-      "depType": "terragrunt",
-      "registryUrls": [
-        "https://my.host",
-      ],
-    },
-    {},
-    {
-      "datasource": "terraform-module",
-      "depName": "my.host.local/sources/example?ref=v1.2.1",
-      "depType": "terragrunt",
-      "registryUrls": [
-        "https://my.host.local",
-      ],
-    },
-    {},
-    {},
-    {
-      "currentValue": "tfmodule_one-v0.0.9",
-      "datasource": "github-tags",
-      "depName": "github.com/githubuser/myrepo",
-      "depType": "github",
-      "packageName": "githubuser/myrepo",
-    },
-    {
-      "currentValue": "v1.0.0",
-      "datasource": "github-tags",
-      "depName": "github.com/hashicorp/example.2.3",
-      "depType": "github",
-      "packageName": "hashicorp/example.2.3",
-    },
-    {
-      "currentValue": "v1.0.0",
-      "datasource": "github-tags",
-      "depName": "github.com/hashicorp/example.2.3",
-      "depType": "github",
-      "packageName": "hashicorp/example.2.3",
-    },
-    {
-      "datasource": "terraform-module",
-      "depName": "hashicorp/consul/aws",
-      "depType": "terragrunt",
-    },
-    {
-      "currentValue": "v0.1.0",
-      "datasource": "github-tags",
-      "depName": "github.com/tieto-cem/terraform-aws-ecs-task-definition",
-      "depType": "github",
-      "packageName": "tieto-cem/terraform-aws-ecs-task-definition",
-    },
-    {
-      "currentValue": "v0.1.0",
-      "datasource": "github-tags",
-      "depName": "github.com/tieto-cem/terraform-aws-ecs-task-definition",
-      "depType": "github",
-      "packageName": "tieto-cem/terraform-aws-ecs-task-definition",
-    },
-    {
-      "currentValue": "v2.0.0",
-      "datasource": "github-tags",
-      "depName": "github.com/hashicorp/example",
-      "depType": "github",
-      "packageName": "hashicorp/example",
-    },
-    {
-      "datasource": "terraform-module",
-      "depName": "terraform-aws-modules/security-group/aws",
-      "depType": "terragrunt",
-    },
-    {
-      "datasource": "terraform-module",
-      "depName": "terraform-aws-modules/security-group/aws",
-      "depType": "terragrunt",
-    },
-    {
-      "skipReason": "local",
-    },
-    {
-      "skipReason": "no-source",
-    },
-    {
-      "currentValue": "v1.0.0",
-      "datasource": "git-tags",
-      "depName": "bitbucket.com/hashicorp/example",
-      "depType": "gitTags",
-      "packageName": "https://bitbucket.com/hashicorp/example",
-    },
-    {
-      "currentValue": "v1.0.0",
-      "datasource": "git-tags",
-      "depName": "bitbucket.com/hashicorp/example",
-      "depType": "gitTags",
-      "packageName": "https://bitbucket.com/hashicorp/example",
-    },
-    {
-      "currentValue": "next",
-      "datasource": "git-tags",
-      "depName": "bitbucket.com/hashicorp/example",
-      "depType": "gitTags",
-      "packageName": "https://bitbucket.com/hashicorp/example",
-    },
-    {
-      "currentValue": "v1.0.1",
-      "datasource": "git-tags",
-      "depName": "bitbucket.com/hashicorp/example",
-      "depType": "gitTags",
-      "packageName": "https://bitbucket.com/hashicorp/example",
-    },
-    {
-      "currentValue": "v1.0.2",
-      "datasource": "git-tags",
-      "depName": "bitbucket.com/hashicorp/example",
-      "depType": "gitTags",
-      "packageName": "http://bitbucket.com/hashicorp/example",
-    },
-    {
-      "currentValue": "v1.0.3",
-      "datasource": "git-tags",
-      "depName": "bitbucket.com/hashicorp/example",
-      "depType": "gitTags",
-      "packageName": "ssh://git@bitbucket.com/hashicorp/example",
-    },
-    {
-      "skipReason": "no-source",
-    },
-    {
-      "skipReason": "no-source",
-    },
-  ],
-}
-`;
diff --git a/lib/modules/manager/terragrunt/extract.spec.ts b/lib/modules/manager/terragrunt/extract.spec.ts
index 9d9a201e1e9681728f3a7186f705cc4dbd260db3..d4720df6168e5a268b00d11403bab72634f6e0ee 100644
--- a/lib/modules/manager/terragrunt/extract.spec.ts
+++ b/lib/modules/manager/terragrunt/extract.spec.ts
@@ -8,10 +8,498 @@ describe('modules/manager/terragrunt/extract', () => {
     });
 
     it('extracts terragrunt sources', () => {
-      const res = extractPackageFile(Fixtures?.get('2.hcl'));
-      expect(res).toMatchSnapshot();
+      const res = extractPackageFile(Fixtures.get('2.hcl'));
+      expect(res).toEqual({
+        deps: [
+          {
+            currentValue: 'v0.0.9',
+            datasource: 'github-tags',
+            depName: 'github.com/myuser/myrepo',
+            depType: 'github',
+            packageName: 'myuser/myrepo',
+          },
+          {
+            currentValue: 'v1.0.0',
+            datasource: 'github-tags',
+            depName: 'github.com/hashicorp/example',
+            depType: 'github',
+            packageName: 'hashicorp/example',
+          },
+          {
+            currentValue: 'next',
+            datasource: 'github-tags',
+            depName: 'github.com/hashicorp/example',
+            depType: 'github',
+            packageName: 'hashicorp/example',
+          },
+          {},
+          {},
+          {
+            datasource: 'terraform-module',
+            depName: 'my.host/modules/test',
+            depType: 'terragrunt',
+            registryUrls: ['https://my.host'],
+          },
+          {
+            datasource: 'terraform-module',
+            depName: 'my.host/modules/test?ref=v1.2.1',
+            depType: 'terragrunt',
+            registryUrls: ['https://my.host'],
+          },
+          {},
+          {
+            datasource: 'terraform-module',
+            depName: 'my.host.local/sources/example?ref=v1.2.1',
+            depType: 'terragrunt',
+            registryUrls: ['https://my.host.local'],
+          },
+          {},
+          {},
+          {
+            currentValue: 'tfmodule_one-v0.0.9',
+            datasource: 'github-tags',
+            depName: 'github.com/githubuser/myrepo',
+            depType: 'github',
+            packageName: 'githubuser/myrepo',
+          },
+          {
+            currentValue: 'v1.0.0',
+            datasource: 'github-tags',
+            depName: 'github.com/hashicorp/example.2.3',
+            depType: 'github',
+            packageName: 'hashicorp/example.2.3',
+          },
+          {
+            currentValue: 'v1.0.0',
+            datasource: 'github-tags',
+            depName: 'github.com/hashicorp/example.2.3',
+            depType: 'github',
+            packageName: 'hashicorp/example.2.3',
+          },
+          {
+            datasource: 'terraform-module',
+            depName: 'hashicorp/consul/aws',
+            depType: 'terragrunt',
+          },
+          {
+            currentValue: 'v0.1.0',
+            datasource: 'github-tags',
+            depName: 'github.com/tieto-cem/terraform-aws-ecs-task-definition',
+            depType: 'github',
+            packageName: 'tieto-cem/terraform-aws-ecs-task-definition',
+          },
+          {
+            currentValue: 'v0.1.0',
+            datasource: 'github-tags',
+            depName: 'github.com/tieto-cem/terraform-aws-ecs-task-definition',
+            depType: 'github',
+            packageName: 'tieto-cem/terraform-aws-ecs-task-definition',
+          },
+          {
+            currentValue: 'v2.0.0',
+            datasource: 'github-tags',
+            depName: 'github.com/hashicorp/example',
+            depType: 'github',
+            packageName: 'hashicorp/example',
+          },
+          {
+            datasource: 'terraform-module',
+            depName: 'terraform-aws-modules/security-group/aws',
+            depType: 'terragrunt',
+          },
+          {
+            datasource: 'terraform-module',
+            depName: 'terraform-aws-modules/security-group/aws',
+            depType: 'terragrunt',
+          },
+          {
+            skipReason: 'local',
+          },
+          {
+            skipReason: 'no-source',
+          },
+          {
+            currentValue: 'v1.0.0',
+            datasource: 'git-tags',
+            depName: 'bitbucket.com/hashicorp/example',
+            depType: 'gitTags',
+            packageName: 'https://bitbucket.com/hashicorp/example',
+          },
+          {
+            currentValue: 'v1.0.0',
+            datasource: 'git-tags',
+            depName: 'bitbucket.com/hashicorp/example',
+            depType: 'gitTags',
+            packageName: 'https://bitbucket.com/hashicorp/example',
+          },
+          {
+            currentValue: 'next',
+            datasource: 'git-tags',
+            depName: 'bitbucket.com/hashicorp/example',
+            depType: 'gitTags',
+            packageName: 'https://bitbucket.com/hashicorp/example',
+          },
+          {
+            currentValue: 'v1.0.1',
+            datasource: 'git-tags',
+            depName: 'bitbucket.com/hashicorp/example',
+            depType: 'gitTags',
+            packageName: 'https://bitbucket.com/hashicorp/example',
+          },
+          {
+            currentValue: 'v1.0.2',
+            datasource: 'git-tags',
+            depName: 'bitbucket.com/hashicorp/example',
+            depType: 'gitTags',
+            packageName: 'http://bitbucket.com/hashicorp/example',
+          },
+          {
+            currentValue: 'v1.0.3',
+            datasource: 'git-tags',
+            depName: 'bitbucket.com/hashicorp/example',
+            depType: 'gitTags',
+            packageName: 'ssh://git@bitbucket.com/hashicorp/example',
+          },
+          {
+            skipReason: 'no-source',
+          },
+          {
+            skipReason: 'no-source',
+          },
+        ],
+      });
       expect(res?.deps).toHaveLength(30);
-      expect(res?.deps.filter((dep) => dep.skipReason)).toHaveLength(5);
+      expect(res?.deps.filter((dep) => dep.skipReason)).toHaveLength(4);
+    });
+
+    it('extracts terragrunt sources with depth specified after the branch', () => {
+      const res = extractPackageFile(Fixtures.get('3.hcl'));
+      expect(res).toEqual({
+        deps: [
+          {
+            currentValue: 'v0.0.9',
+            datasource: 'github-tags',
+            depName: 'github.com/myuser/myrepo',
+            depType: 'github',
+            packageName: 'myuser/myrepo',
+          },
+          {
+            currentValue: 'v1.0.0',
+            datasource: 'github-tags',
+            depName: 'github.com/hashicorp/example',
+            depType: 'github',
+            packageName: 'hashicorp/example',
+          },
+          {
+            currentValue: 'next',
+            datasource: 'github-tags',
+            depName: 'github.com/hashicorp/example',
+            depType: 'github',
+            packageName: 'hashicorp/example',
+          },
+          {},
+          {},
+          {
+            datasource: 'terraform-module',
+            depName: 'my.host/modules/test',
+            depType: 'terragrunt',
+            registryUrls: ['https://my.host'],
+          },
+          {
+            datasource: 'terraform-module',
+            depName: 'my.host/modules/test?ref=v1.2.1&depth=1',
+            depType: 'terragrunt',
+            registryUrls: ['https://my.host'],
+          },
+          {},
+          {
+            datasource: 'terraform-module',
+            depName: 'my.host.local/sources/example?ref=v1.2.1&depth=1',
+            depType: 'terragrunt',
+            registryUrls: ['https://my.host.local'],
+          },
+          {},
+          {},
+          {
+            currentValue: 'tfmodule_one-v0.0.9',
+            datasource: 'github-tags',
+            depName: 'github.com/githubuser/myrepo',
+            depType: 'github',
+            packageName: 'githubuser/myrepo',
+          },
+          {
+            currentValue: 'v1.0.0',
+            datasource: 'github-tags',
+            depName: 'github.com/hashicorp/example.2.3',
+            depType: 'github',
+            packageName: 'hashicorp/example.2.3',
+          },
+          {
+            currentValue: 'v1.0.0',
+            datasource: 'github-tags',
+            depName: 'github.com/hashicorp/example.2.3',
+            depType: 'github',
+            packageName: 'hashicorp/example.2.3',
+          },
+          {
+            datasource: 'terraform-module',
+            depName: 'hashicorp/consul/aws',
+            depType: 'terragrunt',
+          },
+          {
+            currentValue: 'v0.1.0',
+            datasource: 'github-tags',
+            depName: 'github.com/tieto-cem/terraform-aws-ecs-task-definition',
+            depType: 'github',
+            packageName: 'tieto-cem/terraform-aws-ecs-task-definition',
+          },
+          {
+            currentValue: 'v0.1.0',
+            datasource: 'github-tags',
+            depName: 'github.com/tieto-cem/terraform-aws-ecs-task-definition',
+            depType: 'github',
+            packageName: 'tieto-cem/terraform-aws-ecs-task-definition',
+          },
+          {
+            currentValue: 'v2.0.0',
+            datasource: 'github-tags',
+            depName: 'github.com/hashicorp/example',
+            depType: 'github',
+            packageName: 'hashicorp/example',
+          },
+          {
+            datasource: 'terraform-module',
+            depName: 'terraform-aws-modules/security-group/aws',
+            depType: 'terragrunt',
+          },
+          {
+            datasource: 'terraform-module',
+            depName: 'terraform-aws-modules/security-group/aws',
+            depType: 'terragrunt',
+          },
+          {
+            skipReason: 'local',
+          },
+          {
+            skipReason: 'no-source',
+          },
+          {
+            currentValue: 'v1.0.0',
+            datasource: 'git-tags',
+            depName: 'bitbucket.com/hashicorp/example',
+            depType: 'gitTags',
+            packageName: 'https://bitbucket.com/hashicorp/example',
+          },
+          {
+            currentValue: 'v1.0.0',
+            datasource: 'git-tags',
+            depName: 'bitbucket.com/hashicorp/example',
+            depType: 'gitTags',
+            packageName: 'https://bitbucket.com/hashicorp/example',
+          },
+          {
+            currentValue: 'next',
+            datasource: 'git-tags',
+            depName: 'bitbucket.com/hashicorp/example',
+            depType: 'gitTags',
+            packageName: 'https://bitbucket.com/hashicorp/example',
+          },
+          {
+            currentValue: 'v1.0.1',
+            datasource: 'git-tags',
+            depName: 'bitbucket.com/hashicorp/example',
+            depType: 'gitTags',
+            packageName: 'https://bitbucket.com/hashicorp/example',
+          },
+          {
+            currentValue: 'v1.0.2',
+            datasource: 'git-tags',
+            depName: 'bitbucket.com/hashicorp/example',
+            depType: 'gitTags',
+            packageName: 'http://bitbucket.com/hashicorp/example',
+          },
+          {
+            currentValue: 'v1.0.3',
+            datasource: 'git-tags',
+            depName: 'bitbucket.com/hashicorp/example',
+            depType: 'gitTags',
+            packageName: 'ssh://git@bitbucket.com/hashicorp/example',
+          },
+          {
+            skipReason: 'no-source',
+          },
+          {
+            skipReason: 'no-source',
+          },
+        ],
+      });
+      expect(res?.deps).toHaveLength(30);
+      expect(res?.deps.filter((dep) => dep.skipReason)).toHaveLength(4);
+    });
+
+    it('extracts terragrunt sources with depth specified before the branch', () => {
+      const res = extractPackageFile(Fixtures.get('4.hcl'));
+      expect(res).toEqual({
+        deps: [
+          {
+            currentValue: 'v0.0.9',
+            datasource: 'github-tags',
+            depName: 'github.com/myuser/myrepo',
+            depType: 'github',
+            packageName: 'myuser/myrepo',
+          },
+          {
+            currentValue: 'v1.0.0',
+            datasource: 'github-tags',
+            depName: 'github.com/hashicorp/example',
+            depType: 'github',
+            packageName: 'hashicorp/example',
+          },
+          {
+            currentValue: 'next',
+            datasource: 'github-tags',
+            depName: 'github.com/hashicorp/example',
+            depType: 'github',
+            packageName: 'hashicorp/example',
+          },
+          {},
+          {},
+          {
+            datasource: 'terraform-module',
+            depName: 'my.host/modules/test',
+            depType: 'terragrunt',
+            registryUrls: ['https://my.host'],
+          },
+          {
+            datasource: 'terraform-module',
+            depName: 'my.host/modules/test?depth=1&ref=v1.2.1',
+            depType: 'terragrunt',
+            registryUrls: ['https://my.host'],
+          },
+          {},
+          {
+            datasource: 'terraform-module',
+            depName: 'my.host.local/sources/example?depth=1&ref=v1.2.1',
+            depType: 'terragrunt',
+            registryUrls: ['https://my.host.local'],
+          },
+          {},
+          {},
+          {
+            currentValue: 'tfmodule_one-v0.0.9',
+            datasource: 'github-tags',
+            depName: 'github.com/githubuser/myrepo',
+            depType: 'github',
+            packageName: 'githubuser/myrepo',
+          },
+          {
+            currentValue: 'v1.0.0',
+            datasource: 'github-tags',
+            depName: 'github.com/hashicorp/example.2.3',
+            depType: 'github',
+            packageName: 'hashicorp/example.2.3',
+          },
+          {
+            currentValue: 'v1.0.0',
+            datasource: 'github-tags',
+            depName: 'github.com/hashicorp/example.2.3',
+            depType: 'github',
+            packageName: 'hashicorp/example.2.3',
+          },
+          {
+            datasource: 'terraform-module',
+            depName: 'hashicorp/consul/aws',
+            depType: 'terragrunt',
+          },
+          {
+            currentValue: 'v0.1.0',
+            datasource: 'github-tags',
+            depName: 'github.com/tieto-cem/terraform-aws-ecs-task-definition',
+            depType: 'github',
+            packageName: 'tieto-cem/terraform-aws-ecs-task-definition',
+          },
+          {
+            currentValue: 'v0.1.0',
+            datasource: 'github-tags',
+            depName: 'github.com/tieto-cem/terraform-aws-ecs-task-definition',
+            depType: 'github',
+            packageName: 'tieto-cem/terraform-aws-ecs-task-definition',
+          },
+          {
+            currentValue: 'v2.0.0',
+            datasource: 'github-tags',
+            depName: 'github.com/hashicorp/example',
+            depType: 'github',
+            packageName: 'hashicorp/example',
+          },
+          {
+            datasource: 'terraform-module',
+            depName: 'terraform-aws-modules/security-group/aws',
+            depType: 'terragrunt',
+          },
+          {
+            datasource: 'terraform-module',
+            depName: 'terraform-aws-modules/security-group/aws',
+            depType: 'terragrunt',
+          },
+          {
+            skipReason: 'local',
+          },
+          {
+            skipReason: 'no-source',
+          },
+          {
+            currentValue: 'v1.0.0',
+            datasource: 'git-tags',
+            depName: 'bitbucket.com/hashicorp/example',
+            depType: 'gitTags',
+            packageName: 'https://bitbucket.com/hashicorp/example',
+          },
+          {
+            currentValue: 'v1.0.0',
+            datasource: 'git-tags',
+            depName: 'bitbucket.com/hashicorp/example',
+            depType: 'gitTags',
+            packageName: 'https://bitbucket.com/hashicorp/example',
+          },
+          {
+            currentValue: 'next',
+            datasource: 'git-tags',
+            depName: 'bitbucket.com/hashicorp/example',
+            depType: 'gitTags',
+            packageName: 'https://bitbucket.com/hashicorp/example',
+          },
+          {
+            currentValue: 'v1.0.1',
+            datasource: 'git-tags',
+            depName: 'bitbucket.com/hashicorp/example',
+            depType: 'gitTags',
+            packageName: 'https://bitbucket.com/hashicorp/example',
+          },
+          {
+            currentValue: 'v1.0.2',
+            datasource: 'git-tags',
+            depName: 'bitbucket.com/hashicorp/example',
+            depType: 'gitTags',
+            packageName: 'http://bitbucket.com/hashicorp/example',
+          },
+          {
+            currentValue: 'v1.0.3',
+            datasource: 'git-tags',
+            depName: 'bitbucket.com/hashicorp/example',
+            depType: 'gitTags',
+            packageName: 'ssh://git@bitbucket.com/hashicorp/example',
+          },
+          {
+            skipReason: 'no-source',
+          },
+          {
+            skipReason: 'no-source',
+          },
+        ],
+      });
+      expect(res?.deps).toHaveLength(30);
+      expect(res?.deps.filter((dep) => dep.skipReason)).toHaveLength(4);
     });
 
     it('returns null if only local terragrunt deps', () => {
diff --git a/lib/modules/manager/terragrunt/modules.ts b/lib/modules/manager/terragrunt/modules.ts
index e4bd9901a739b98c2fec5ddf993838f2c31ab0ad..43a0987735f3efb9c8fac02b7e7e2326bed05b08 100644
--- a/lib/modules/manager/terragrunt/modules.ts
+++ b/lib/modules/manager/terragrunt/modules.ts
@@ -8,10 +8,10 @@ import { extractTerragruntProvider } from './providers';
 import type { ExtractionResult, TerraformManagerData } from './types';
 
 export const githubRefMatchRegex = regEx(
-  /github\.com([/:])(?<project>[^/]+\/[a-z0-9-_.]+).*\?ref=(?<tag>.*)$/i
+  /github\.com([/:])(?<project>[^/]+\/[a-z0-9-_.]+).*\?(depth=\d+&)?ref=(?<tag>.*?)(&depth=\d+)?$/i
 );
 export const gitTagsRefMatchRegex = regEx(
-  /(?:git::)?(?<url>(?:http|https|ssh):\/\/(?:.*@)?(?<path>.*.*\/(?<project>.*\/.*)))\?ref=(?<tag>.*)$/
+  /(?:git::)?(?<url>(?:http|https|ssh):\/\/(?:.*@)?(?<path>.*.*\/(?<project>.*\/.*)))\?(depth=\d+&)?ref=(?<tag>.*?)(&depth=\d+)?$/
 );
 const hostnameMatchRegex = regEx(/^(?<hostname>([\w|\d]+\.)+[\w|\d]+)/);