Gitlab 基础设施注册表对于 terraform 模块的优势

jsc*_*lfh 5 gitlab terraform

我很难理解 Gitlab 基础设施注册表发布 terraform 模块与仅引用 git 存储库相反的优势。使用差异

参考回购协议:

.gitlab-ci.yml:

before_script:
  - git config --global url."https://oauth2:${GITLAB_ACCESS_TOKEN}@gitlab.com/".insteadOf "https://gitlab.com"
Run Code Online (Sandbox Code Playgroud)

地形:

module "module_test" {
  source = "git::https://gitlab.com/terraform-modules/local_file?ref=v0.1.0"
}
Run Code Online (Sandbox Code Playgroud)

使用基础设施注册表

.gitlab-ci.yml

variables:
  TF_CLI_CONFIG_FILE: $CI_PROJECT_DIR/.terraformrc

before_script:
  - echo -e "credentials \"$CI_SERVER_HOST\" {\n  token = \"$CI_JOB_TOKEN\"\n}" > $TF_CLI_CONFIG_FILE
Run Code Online (Sandbox Code Playgroud)

地形:

module "my_module_name" {
  source = "gitlab.com/terraform-modules/local_file/local"
  version = "0.1.0"
}
Run Code Online (Sandbox Code Playgroud)

那么为什么要费心在基础设施注册表中创建模块呢?我缺少什么?