# SSH

Terrakube can use SSH keys to authenticate to your private repositories. The SSH keys can be uploaded inside the settings menu.

<figure><img src="/files/YF9qBcO4BXy0CQWD42Mb" alt=""><figcaption></figcaption></figure>

To handle SSH keys inside Terrakube your team should have "Manage VCS settings" access

<figure><img src="/files/fubeHOvZG5513qleRtYm" alt=""><figcaption></figcaption></figure>

Terrakube support keys with RSA and ED25519

<figure><img src="/files/FBvZEqWkZpy66LiuHLoW" alt=""><figcaption></figcaption></figure>

SSH keys can be used to authenticate to private repositories where you can store modules or workspaces

Once SSH keys are added inside your organization you can use them like the following example:

### Modules:

<figure><img src="/files/dF4h2HO8OYikjrrlkPhk" alt=""><figcaption></figcaption></figure>

### Workspace:

<figure><img src="/files/KX9UK92HCx6RKe1iz4W4" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
When using SSH keys make sure to use your repository URL using the ssh format. For github it is something like [***git@github.com***](mailto:git@github.com)***:AzBuilder/terrakube-docker-compose.git***
{% endhint %}

### SSH Key Injection

The selected SSH key will be used to clone the workspace information at runtime when running the job inside Terrakube, but it will also be injected to the job execution to be use inside our terraform code.

For example if you are using a module using a GIT connection like the following:

```
module "test" {
  source = "git@bitbucket.org:alfespa17/private-module.git"
}
```

When running the job, internally terraform will be using the selected SSH key to clone the necesary module dependencies like the below image:

<figure><img src="/files/V1l2USzGfPuG32bzjjR7" alt=""><figcaption></figcaption></figure>

When using a VCS connection you can select which SSH key should be injected when downloading modules in the workspace settings:

<figure><img src="/files/CRsUxIbvoohkiCHYDMxx" alt=""><figcaption></figcaption></figure>

This will allow to use modules using the git format inside a workspace with VCS connection like the following:

```
module "test" {
  source = "git@github.com:alfespa17/simple-terraform.git"
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.terrakube.io/user-guide/vcs-providers/ssh.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
