5
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

terraformのmoduleをprivate githubから使用する

Last updated at Posted at 2020-09-25

https

module "private_module" {
  source = "git::https://github.com/private-org/private-repo.git?ref=${branch or tag}"
  ...
}

CIでhttps経由でmoduleを使う場合はtokenが必要になるため,gitの設定でtokenを設定

$ git config --global url."https://${GITHUB_TOKEN}:x-oauth-basic@github.com/private-org".insteadOf "https://github.com/private-org"

ssh

module "private_module" {
  source = "git::git@github.com:private-org/private-repo.git//backend?ref=${branch or tag}"
  ...
}

sshにしておきつつ、CIだけはtokenを使うようなケースではこうするとよい

$ git config --global url."https://${GITHUB_TOKEN}:x-oauth-basic@github.com/private-org".insteadOf "ssh://git@github.com/private-org"
5
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?