From 3dac18fa4a82b7b38e2453bd97b87693e6e9e877 Mon Sep 17 00:00:00 2001 From: Vinod Kumar Nair Date: Sat, 17 Feb 2024 16:46:44 +0530 Subject: [PATCH 1/3] Updated the document with an example of Git depth. for issue#34676 --- website/docs/language/modules/sources.mdx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/website/docs/language/modules/sources.mdx b/website/docs/language/modules/sources.mdx index 40767165a134..eb637e3de651 100644 --- a/website/docs/language/modules/sources.mdx +++ b/website/docs/language/modules/sources.mdx @@ -262,8 +262,11 @@ to reduce the time taken to retrieve the remote repository. The `depth` URL argument corresponds to [the `--depth` argument to `git clone`](https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---depthltdepthgt), -telling Git to create a shallow clone with the history truncated to only -the specified number of commits. +instructs the Git to create a shallow clone with the history truncated to only +the specified number of commits. For example, if you want to perform a shallow clone with only the last 3 commits +of a repository, you would use the `--depth=3` parameter in the clone URL +like git::https://example.com/vpc.git?depth=3&ref=v1.2.0. This would fetch only the most recent 3 commits along with +the necessary data, making the clone faster and more efficient, especially for large repositories. However, because shallow clone requires different Git protocol behavior, setting the `depth` argument makes Terraform pass your [`ref` argument](#selecting-a-revision), From dfcb6ea2663e3ebbf85a4422f1d69b6b644acde4 Mon Sep 17 00:00:00 2001 From: Vinod Kumar <24762720+vinod827@users.noreply.github.com> Date: Mon, 19 Feb 2024 21:03:24 +0530 Subject: [PATCH 2/3] Update website/docs/language/modules/sources.mdx Co-authored-by: runephilosof-karnovgroup <101270124+runephilosof-karnovgroup@users.noreply.github.com> --- website/docs/language/modules/sources.mdx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/website/docs/language/modules/sources.mdx b/website/docs/language/modules/sources.mdx index eb637e3de651..bd026afcdd46 100644 --- a/website/docs/language/modules/sources.mdx +++ b/website/docs/language/modules/sources.mdx @@ -263,10 +263,15 @@ to reduce the time taken to retrieve the remote repository. The `depth` URL argument corresponds to [the `--depth` argument to `git clone`](https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---depthltdepthgt), instructs the Git to create a shallow clone with the history truncated to only -the specified number of commits. For example, if you want to perform a shallow clone with only the last 3 commits -of a repository, you would use the `--depth=3` parameter in the clone URL -like git::https://example.com/vpc.git?depth=3&ref=v1.2.0. This would fetch only the most recent 3 commits along with -the necessary data, making the clone faster and more efficient, especially for large repositories. +the specified number of commits. +Because Terraform only uses the most recent selected commit to find the source +code of your specified module, it is not typically useful to set `depth` +to any value other than `1`. +```hcl +module "vpc" { + source = "git::https://example.com/vpc.git?depth=1&ref=v1.2.0" +} +``` However, because shallow clone requires different Git protocol behavior, setting the `depth` argument makes Terraform pass your [`ref` argument](#selecting-a-revision), From 846f170d4dcbf9f0e81569aba7ef5d77a2f68fe8 Mon Sep 17 00:00:00 2001 From: Vinod Kumar <24762720+vinod827@users.noreply.github.com> Date: Thu, 7 Mar 2024 08:33:11 +0530 Subject: [PATCH 3/3] Update website/docs/language/modules/sources.mdx Co-authored-by: trujillo-adam <47586768+trujillo-adam@users.noreply.github.com> --- website/docs/language/modules/sources.mdx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/website/docs/language/modules/sources.mdx b/website/docs/language/modules/sources.mdx index bdb9b3b6a1b0..3156f0a446cc 100644 --- a/website/docs/language/modules/sources.mdx +++ b/website/docs/language/modules/sources.mdx @@ -262,11 +262,9 @@ to reduce the time taken to retrieve the remote repository. The `depth` URL argument corresponds to [the `--depth` argument to `git clone`](https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---depthltdepthgt), -instructs the Git to create a shallow clone with the history truncated to only -the specified number of commits. -Because Terraform only uses the most recent selected commit to find the source -code of your specified module, it is not typically useful to set `depth` -to any value other than `1`. +which instructs Git to create a shallow clone that includes +only the specified number of commits in the history. +Setting `depth` to `1` is suitable for most cases. This is because Terraform only uses the most recently selected commit to find the source. ```hcl module "vpc" { source = "git::https://example.com/vpc.git?depth=1&ref=v1.2.0"