2017-12-14 12 views
1

내 terraform 모듈이 ssh 키를 통해 액세스되는 개인 bitbucket repo에 있습니다.Terraform이 git 용 ssh config를 준수하지 않음

terraform이 실행되는 git 명령이나 인증을 변경하는 방법을 모르지만 다른 ssh 구성을 사용하고있는 것으로 보입니다.

module "sdfsdfs" { 
    source = "git::ssh://bitbucket.org/mycomp/my-module-root//submodule" 
} 

임은 젠킨스 파이프 라인에서 이것을 실행하고 나는 특정 키를 사용하는 ssh를 설정을 편집하고 있습니다 :

이 내 TF 파일입니다. 나는이 작품을 입증했습니다 :

sshagent (credentials: ['my-ssh-key']) { 
    bat 'git clone [email protected]:mycomp/my-module.git' 
} 

ssh 구성이 올바르게 수정되고 jenkins에서 키 저장소를 사용합니다.

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. 

은 무엇인가 :

sshagent (credentials: ['my-ssh-key']) { 
    bat 'terraform init' 
} 

내가이 오류 :

나는 도대체 terraform 실제로 자식의 repo에서 끌어 실행되고 있지만이 ssh를 설정을 존중하지 모르겠어요 테라포밍은 여기서하고 있습니까? 또한 분명히이 세션에 대해서만이 설정을하고 싶기 때문에 제 젠킨스 서버에 대한 글로벌 ssh 설정을 할 수 없습니다.

답변

1

이것은 부분적으로 비트 버킷 제한이며 부분적으로는 the docs을 완전히 읽지 않습니다.

bitbucket api는 ssh 또는 무언가를 지원하지 않는 것 같습니다. 왜냐하면 terraform docs는 bitbucket으로 https 예제 만 가지고 있기 때문입니다. 일반적인 자식의 repo처럼이 치료

작동합니다

source = "git::ssh://[email protected]/mycomp/myrepo.git//my-sub-module"