Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
If you are interested in working on this issue or have submitted a pull request, please leave a comment
Description
Our team would like to be able to create new repos based on a private template repo we have. We currently need to supply a service connection with PAT to import this repo without creating a fork. Instead of using this service connection, we would like this resource to try creating the repo using the signed-in user/principal that the provider uses for other operations.
New or Affected Resource(s)
azuredevops_git_repository
Potential Terraform Configuration
Simply omitting the argument initialization.service_connection_id in the resource azuredevops_git_repository should try creating the repo with initialization type import using the logged-in user
data "azuredevops_project" "example" {
name = "Example Project"
}
data "azuredevops_git_repository" "example_source_repo" {
project_id = data.azuredevops_project.example.id
name = "Source Repository" #private repo
}
resource "azuredevops_git_repository" "example" {
project_id = data.azuredevops_project.example.id
name = "copied git repo"
initialization {
init_type = "Import"
source_type = "Git"
source_url = data.azuredevops_git_repository.example_source_repo.remote_url
}
}
References
Importing repos like this was added in #0402, but since then this provider has added the support for login with a Service Connection in #0747
@Pidgegeddon Service account/SPN login user cannot be used to import repositories. In fact, the credentials used to import repository are delegated to the service connection
Community Note
Description
Our team would like to be able to create new repos based on a private template repo we have. We currently need to supply a service connection with PAT to import this repo without creating a fork. Instead of using this service connection, we would like this resource to try creating the repo using the signed-in user/principal that the provider uses for other operations.
New or Affected Resource(s)
Potential Terraform Configuration
Simply omitting the argument
initialization.service_connection_id
in the resourceazuredevops_git_repository
should try creating the repo with initialization type import using the logged-in userReferences
Importing repos like this was added in #0402, but since then this provider has added the support for login with a Service Connection in #0747