diff --git a/README.md b/README.md index bf19372..0bcec1f 100644 --- a/README.md +++ b/README.md @@ -209,6 +209,18 @@ e.g. $ TFENV_TERRAFORM_VERSION=latest:^0.11. terraform --version ``` +##### `TFENV_NETRC_PATH` + +String (Default: "") + +If not empty string, this variable specifies the credentials file used to access the remote location (useful if used in conjunction with TFENV_REMOTE). + +e.g. + +```console +$ TFENV_NETRC_PATH="$PWD/.netrc.tfenv" +``` + #### Bashlog Logging Library ##### `BASHLOG_COLOURS` diff --git a/lib/helpers.sh b/lib/helpers.sh index 1e73dfc..ba58e5e 100755 --- a/lib/helpers.sh +++ b/lib/helpers.sh @@ -116,7 +116,13 @@ function curlw () { TLS_OPT=""; fi; - curl ${TLS_OPT} "$@"; + if [[ ! -z "${TFENV_NETRC_PATH:-""}" ]]; then + NETRC_OPT="--netrc-file ${TFENV_NETRC_PATH}"; + else + NETRC_OPT=""; + fi; + + curl ${TLS_OPT} ${NETRC_OPT} "$@"; } export -f curlw;