> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kosli.com/llms.txt
> Use this file to discover all available pages before exploring further.

# kosli_repo data source

> Fetches one Kosli repo by its internal ID or by its name. Use the returned ID with the kosli_repo_tags resource to tag the repo.

Fetches one Kosli [repo](https://docs.kosli.com/tutorials/repositories.md), by its internal ID or by its name. Kosli records a repo when an attestation or trail references it. Use the returned `id` with the [`kosli_repo_tags` resource](https://docs.kosli.com/terraform-reference/resources/repo_tags) to tag the repo, or the [`kosli_repos` data source](https://docs.kosli.com/terraform-reference/data-sources/repos) to find several repos at once.

## Example usage

```terraform theme={"theme":"dracula","languages":{"custom":["/languages/rego.json"]}}
terraform {
  required_providers {
    kosli = {
      source = "kosli-dev/kosli"
    }
  }
}

# Look a repo up by name. Set vcs_provider when the name exists on more than one provider.
data "kosli_repo" "api" {
  name         = "acme/platform/api"
  vcs_provider = "github"
}

# Look a repo up by its internal ID, shown by `kosli get repo`
data "kosli_repo" "by_id" {
  id = "6f1c2a9e-3b7d-4c55-9e0a-1d2f3b4c5d6e"
}

output "api_repo_id" {
  description = "Internal ID of the repo, for use with kosli_repo_tags"
  value       = data.kosli_repo.api.id
}

output "repo_name_for_id" {
  description = "Name of the repo with the given ID"
  value       = data.kosli_repo.by_id.name
}
```

## Schema

### Optional

* `id` (String) Internal Kosli ID of the repo. Set either `id` or `name`.
* `name` (String) Full name of the repo, including its namespace, for example `acme/platform/api`. Set either `id` or `name`. Names can repeat across VCS providers; set `vcs_provider` when more than one repo has this name.
* `vcs_provider` (String) VCS provider of the repo, for example `github` or `gitlab`. When set, narrows a lookup by `name`; conflicts with `id`. When not set, Kosli's value is returned, or null when Kosli could not determine it.

### Read-only

* `tags` (Map of String) Key-value pairs tagging the repo.
* `url` (String) URL of the repo.
* `vcs_instance` (String) VCS host of the repo. Null when Kosli could not determine it.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.