允许GitLab CI / CD运行程序访问多个项目

时间:2020-08-03 13:41:43

标签: git gitlab terraform

我有一个引用另一个项目中资源的terraform项目。是否有内置机制允许GitLab CICD运行程序通过某个地方的单个配置访问多个项目?我希望避免对身份验证进行硬编码。

我的Terraform项目资源位于:

- Infrastructure/resources/tf-modules/...

我的实时基础设施位于:

- Infrastructure/live/...

但是,当我尝试运行实时基础结构时,当它尝试从另一个项目中获取资源时:

module dynamo_terraform_lock_table {
  source = "git::https://git.abc.com/infrastructure/resources/tf-modules/dynamodb/terraform-state-lock?ref=0.0.4"
}

我的CICD跑步者出现错误:

fatal: could not read Username for 'https://git.abc.com': No such
device or address

这是我的.gitlab-cy.yml的相关部分:

script:
    - git config --global user.name $CI_DEPLOY_USER
    - git config --global user.password $CI_DEPLOY_PASSWORD
    - cd terraform
    - terraform init
    - terraform plan

以上方法尝试使用特殊的部署令牌gitlab-deploy-token,但我想我不明白该怎么做。这似乎是理想的解决方案,因为它可以将所有事情都保留在幕后,但是我不确定自己在做什么错。

0 个答案:

没有答案