Skip to content

Commit

Permalink
Merge pull request #34692 from vinod827/main
Browse files Browse the repository at this point in the history
Updated the document with an example of Git depth. for issue#34676
  • Loading branch information
crw authored Mar 7, 2024
2 parents f90e5de + e157180 commit 0343af6
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions website/docs/language/modules/sources.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,14 @@ 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.
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"
}
```

However, because shallow clone requires different Git protocol behavior,
setting the `depth` argument makes Terraform pass your [`ref` argument](#selecting-a-revision),
Expand All @@ -272,9 +278,6 @@ if any, to
instead. That means it must specify a named branch or tag known to the remote
repository, and that raw commit IDs are not acceptable.

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`.

### "scp-like" address syntax

Expand Down

0 comments on commit 0343af6

Please sign in to comment.