【发布时间】:2018-05-28 23:03:31
【问题描述】:
我的 terraform 模块位于通过 ssh 密钥访问的私有 bitbucket 存储库中。
我不知道 terraform 运行什么 git 命令或如何更改身份验证,但它似乎使用了不同的 ssh 配置。
这是我的.tf 文件:
module "sdfsdfs" {
source = "git::ssh://bitbucket.org/mycomp/my-module-root//submodule"
}
我在 jenkins 管道中运行它,并且我正在编辑 ssh 配置以使用特定密钥。我已经证明这是可行的:
sshagent (credentials: ['my-ssh-key']) {
bat 'git clone git@bitbucket.org:mycomp/my-module.git'
}
ssh 配置已正确修改并使用我在 jenkins 中的密钥存储。
我不知道 terraform 实际上正在运行从 git repo 中提取什么,但它不尊重 ssh 配置:
sshagent (credentials: ['my-ssh-key']) {
bat 'terraform init'
}
我收到此错误:
C:\Program Files\Git\cmd\git.exe exited with 128: Cloning into
'.terraform\modules\c760b746e09bd59ba86aae13dc9e9959'...
Permission denied (publickey).
fatal: Could not read from remote repository.
terraform 在这里做什么或不做什么?我只想为此会话进行配置,因此无法为我的 jenkins 服务器设置全局 ssh 配置。
【问题讨论】:
标签: git jenkins jenkins-plugins jenkins-pipeline terraform