git Provider

ℹ️

Introduced in Togomak v1.0.0

The git data provider clones a git repository to a specific directory

Opening the existing repository

data "git" "this" {
  url = "."
}

Cloning a new repository

{{#include ../../../examples/git/togomak.hcl}}

Reusing remote stages, using togomak

{{#include ../../../examples/remote-stages/togomak.hcl}} 

Arguments Reference

  • url - The URL of the repository to clone.
  • tag - The tag to checkout. tag takes precedence over branch.
  • ref - The reference to checkout, in the format refs/tags/v3 for example. ref takes precedence over tag and branch.
  • branch - The branch to checkout. ref and tag takes precedence over branch.
  • destination - The destination directory to clone the repository to, defaults to "memory", which clones into a temporary directory managed by togomak
  • commit - The commit to checkout.
  • depth - The depth of the clone.
  • ca_bundle - The path to a CA bundle file or directory, (deprecated, does nothing).
  • auth - The authentication credentials to use when cloning the repository. Structure documented below
  • files - The files to checkout from the repository. Accepts an array of file paths.

Attributes Reference

  • last_tag - The latest tag in the repository, defaults to ""
  • commits_since_last_tag - The number of commits since the last tag, defaults to 0
  • sha - The SHA of the commit, defaults to ""
  • ref - The ref of the commit, in the format refs/heads/<branch> or refs/tags/<tag>, defaults to ""
  • is_tag - Whether the ref is a tag, defaults to false
  • files - The files checked out from the repository. Returns a map, with the keys being the file paths and the values being the file contents.
  • branch - The branch checked out from the repository. Returns a string.
  • destination - The destination where the repository is stored.

The auth block supports:

  • username - The username to be used. If password is specified, and if the username is empty, it falls back to oauth2
  • password - The password to be used for connecting to the private repository.