繁体   English   中英

使用bitbucket git存储库源通过SSH下载模块时出现的问题

[英]Issues using bitbucket git repository source for downloading a module over SSH

从本地源调用模块时,一切正常,但是我决定重构Terraform代码以将git存储库用于模块。

我在我们的BitBucket帐户中创建了一个名称为terraform-modules的新存储库,并将模块的source属性重构为以下结构:

source     = "git::ssh://git@bitbucket.org:carepaydev/terraform-modules.git//modules/iam/iam_roles/assumable_role"

调用terraform init ,出现以下错误:

Error downloading modules: Error loading modules: error downloading 'ssh://git@bitbucket.org:<username>/terraform-modules.git': /usr/local/bin/git exited with 128: Cloning into '.terraform/modules/caf541f5e5ccbb1d204bce3b94091014'...
ssh: Could not resolve hostname bitbucket.org:<username>: nodename nor servname provided, or not known
fatal: Could not read from remote repository.

使用git clone克隆存储库确实可行。 我尝试将TF_LOG env var设置为TRACE以查看是否可以为我提供更多的见解,但这无济于事。

任何线索为什么失败了?

ssh://git@bitbucket.orgusername/repo之间的冒号更改为斜杠:

ssh://git@bitbucket.org/username/repo

以这种格式,冒号表示备用端口-如果您想执行ssh://git@altssh.bitbucket.org:443/username/repo ,则很有用,类似于您为其他协议指定备用端口的方式,例如HTTP。

尝试访问私有存储库时, hashicorp / terraform问题12696也有类似错误。

至少尝试设置git config --global core.sshCommand "ssh -Tvv" ,以查看git clone过程中Terraform durong实际使用了哪些私钥。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM