terrakube: executor is failed to download private terraform module from bitbucket
Bug description 🐞
i want to download bitbucket private module repositories is there way we can pass the sshkeys in executor and use that for cloning module when we are initializing terraform.
[ForkJoinPool-1-worker-4] INFO org.terrakube.executor.service.logs.LogsConsumer - ??? Error: Failed to download module
[ForkJoinPool-1-worker-4] INFO org.terrakube.executor.service.logs.LogsConsumer - ???
[ForkJoinPool-1-worker-4] INFO org.terrakube.executor.service.logs.LogsConsumer - ??? Could not download module "globalresource" (main.tf:22) source code from
[ForkJoinPool-1-worker-4] INFO org.terrakube.executor.service.logs.LogsConsumer - ??? "git::ssh://git@bitbucket.org/terraform-module-global-resources.git?ref=f1":
[ForkJoinPool-1-worker-4] INFO org.terrakube.executor.service.logs.LogsConsumer - ??? error downloading
[ForkJoinPool-1-worker-4] INFO org.terrakube.executor.service.logs.LogsConsumer - ??? 'ssh://git@bitbucket.org/terraform-module-global-resources.git?ref=f1':
[ForkJoinPool-1-worker-4] INFO org.terrakube.executor.service.logs.LogsConsumer - ??? /usr/bin/git exited with 128: Cloning into
[ForkJoinPool-1-worker-4] INFO org.terrakube.executor.service.logs.LogsConsumer - ??? '.terraform/modules/globalresource'...
[ForkJoinPool-1-worker-4] INFO org.terrakube.executor.service.logs.LogsConsumer - ??? Host key verification failed.
[ForkJoinPool-1-worker-4] INFO org.terrakube.executor.service.logs.LogsConsumer - ??? fatal: Could not read from remote repository.
[ForkJoinPool-1-worker-4] INFO org.terrakube.executor.service.logs.LogsConsumer - ???
[ForkJoinPool-1-worker-4] INFO org.terrakube.executor.service.logs.LogsConsumer - ??? Please make sure you have the correct access rights
[ForkJoinPool-1-worker-4] INFO org.terrakube.executor.service.logs.LogsConsumer - ??? and the repository exists.
[ForkJoinPool-1-worker-4] INFO org.terrakube.executor.service.logs.LogsConsumer - ???
[threadPoolTaskExecutor-1] WARN org.terrakube.executor.service.terraform.TerraformExecutorServiceImpl - No commands to run before terraform operation Job 2
Steps to reproduce
started terrakube in docker-compose on local provided sshkeys in setting section. when terraform initialize its failed to download private modules from bitbucket
Expected behavior
No response
Example repository
No response
Anything else?
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 25 (12 by maintainers)
Ok let me explain a little bit how terrakube executes jobs internally.
If you want to execute some custom script inside your workspace
This could be a new feature for terrakube import the “sh” files inside the “workspace” to the jobs execution environment and not only those inside the “extension repository” (you could create a new issue for this feature)
Finally you don’t see any information when you open the container directly because terrakube delete the folder every time the job is completed.
https://github.com/AzBuilder/terrakube/blob/main/executor/src/main/java/org/terrakube/executor/service/executor/ExecutorJobImpl.java#L87
I hope this information can help you.
Let me know if you have any additional question I will be happy to help 👍
Hello @thatsk
I got it working with docker-compose, you need to mount id_rsa and config
config file content:
The container is running with user “cnb”
So you need to set the correct permission for the file config and id_rsa before running docker-compose up
Once you set the correct permission for cnb user, it should be able to read the files
And when running the executor with a private repository from bitbucket it will work when using terraform
The tricky part was the file access for id_rsa and config files 👍 when running the container