I want to commit a file (let’s say the README) on the default repository of a newly created project.
Below the code
resource "azuredevops_project" "example" {
name = "Example Project"
visibility = "private"
version_control = "Git"
work_item_template = "Agile"
}
resource "azuredevops_git_repository" "example" {
project_id = azuredevops_project.example.id
name = azuredevops_project.example.name
initialization {
init_type = "Clean"
}
}
resource "azuredevops_git_repository_file" "example" {
repository_id = azuredevops_git_repository.example.id
file = "README.md"
content = "foo bar"
branch = "refs/heads/master"
commit_message = "First commit"
overwrite_on_create = false
}
It gives me the following error:
Error creating repository in Azure DevOps: TF400948: A Git repository with the name Example Project already exists
I tried using the lifecycle argument with no luck and I also tried using a data source, but then the azuredevops_git_repository_file
resource complain about missing branch.
It seems to me there is no way to create a branch from terraform, what am I missing??