I want to import a repo called iac-example-app
from Source Project
into imported-repo
in Destination Project
within the same org we’ll call devopsorg
, and am getting an error.
The plan works as expected:
# module.example.azuredevops_git_repository.imported_repo will be created
+ resource "azuredevops_git_repository" "imported_repo" {
+ default_branch = (known after apply)
+ id = (known after apply)
+ is_fork = (known after apply)
+ name = "imported-repo"
+ project_id = "<redacted>"
+ remote_url = (known after apply)
+ size = (known after apply)
+ ssh_url = (known after apply)
+ url = (known after apply)
+ web_url = (known after apply)
+ initialization {
+ init_type = "Import"
+ source_type = "git"
+ source_url = "https://dev.azure.com/<redacted>>"
}
}
The error is when they apply occurs.
Here is my error:
2020-09-03T20:29:28.6888902Z Error: Error expanding repository resource data: Initialization strategy not implemented: Import
2020-09-03T20:29:28.6889491Z
2020-09-03T20:29:28.6890346Z on .terraform\modules\example\main.tf line 291, in resource "azuredevops_git_repository" "imported_repo":
2020-09-03T20:29:28.6891220Z 291: resource "azuredevops_git_repository" "imported_repo" {
2020-09-03T20:29:28.6891681Z
Here is my code:
provider "azuredevops" {
alias = "devopsorg"
version = ">= 0.0.1"
org_service_url = "https://dev.azure.com/<redacted>/"
personal_access_token = "<redacted>"
}
# Get the data for the Source Project
data "azuredevops_project" "sourceproject" {
provider = azuredevops.devopsorg
project_name = "Source Project"
}
# Get the data for the Source Repo
data "azuredevops_git_repositories" "iac-example-app" {
provider = azuredevops.devopsorg
project_id = data.azuredevops_project.sourceproject.id
name = "iac-example-app"
}
# Get the data for the Destination Project
data "azuredevops_project" "destinationproject" {
provider = azuredevops.devopsorg
project_name = "Destination Project"
}
resource "azuredevops_git_repository" "imported_repo" {
provider = azuredevops.devopsorg
project_id = data.azuredevops_project.destinationproject.id
name = "imported-repo"
initialization {
init_type = "Import"
source_type = "git"
source_url = data.azuredevops_git_repositories.iac-example-app.repositories[0].url
}
}
The Azure DevOps personal access token being used has full access to everything in the org, and the user owning the PAT (myself) can import the repo manually.
Any ideas?