Git Flow: terraform-provider-coder: create new `coder_git_repo` data source
- Lenguaje dominante
- Sin datos de lenguaje
- Estrellas
- 3
- Forks
- 0
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
Create a new `coder_git_repo` Coder data source to support the following use-cases:
1. Pre-defined Git repo with hard-coded branch:
```
data "coder_git_repo" "repo" {
provider = "my-github"
url = "git@github.com:coder/coder.git"
}
module "git-clone" {
url = data.coder_git_repo.repo.url
branch_name = "main"
git_providers = {
"git@github.com": "my-github"
}
}
```
2. Pre-defined Git repo with configurable branch:
```
data "coder_git_repo" "repo" {
provider = "my-github"
url = "git@github.com:coder/coder.git"
}
data "coder_parameter" "git_branch" {
type = "string"
default = data.coder_git_repo.repo.default_branch
}
module "git-clone" {
url = data.coder_git_repo.repo.url
branch_name = data.coder_parameter.git_branch.value
git_providers = {
"git@github.com": "my-github"
}
}
```
2. Configurable Git repo with configurable branch:
```
data "coder_parameter" "git_repo" {
type = "string"
default = "git@github.com:coder/coder.git"
}
data "coder_git_repo" "repo" {
provider = "my-github"
url = data.coder_parameter.git_repo.value
}
data "coder_parameter" "git_branch" {
type = "string"
default = data.coder_git_repo.repo.default_branch
}
module "git-clone" {
url = data.coder_git_repo.repo.url
branch_name = data.coder_parameter.git_branch.value
git_providers = {
"git@github.com": "my-github"
}
}
```
Implementation Notes:
* `coderd` will be responsible for querying the remote repository and setting the required data in the data source based on user inputs. We need to be using the existing user's oauth2 tokens to authenticate with the Git provider. Doing this in the provider means that typographical errors or issues cloning the repo will only be discovered at plan/apply time, and not while the user is still filling out the form.
* If possible, we should only allow one `coder_git_repo` data source per template.
* If possible, we should ensure that all `coder_parameter` references to this data source are immutable. Rationale: if a user later changes the git repo linked to their workspace, the expected behaviour is not clear.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Empieza revisando los patrones existentes de data source de terraform-provider-coder y las responsabilidades de coderd descritas en las notas de implementación. Define el comportamiento de URL, provider y default_branch de la data source para los tres ejemplos y, después, verifica que la búsqueda de repositorios basada en OAuth, los límites de una única data source y las referencias de parámetros inmutables cumplen los casos de uso indicados.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- terraform
- Área
- infrastructure
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 30/100