microsoft / terraform-provider-azuredevops

Terraform Azure DevOps provider
https://www.terraform.io/docs/providers/azuredevops/
MIT License
387 stars 280 forks source link

azuredevops_git_repository with repository name of a repo that does not exist fails with "invalid memory address" #1063

Closed oocx closed 6 months ago

oocx commented 6 months ago

Community Note

Terraform (and Azure DevOps Provider) Version

Terraform 1.8.2 azuredevops provider 1.1.1

Affected Resource(s)

Terraform Configuration Files

data "azuredevops_git_repository" "template_repository" {
  project_id = "some_valid_id"
  name       = "thisrepodoesnotexist"
}

output "debug_template_repository_id" {
  value = data.azuredevops_git_repository.template_repository.id
}

terraform {

  required_version = "~> 1.8"

  required_providers {

    azuredevops = {
      source  = "microsoft/azuredevops"
      version = "~> 1.1.1"
    }

  }

}

provider "azuredevops" {
  org_service_url = "https://dev.azure.com/secret"
}

Debug Output

https://gist.github.com/oocx/99da19d3b90357730d3bd4c283727bac

Panic Output

Expected Behavior

A message that tells me that a repository with name 'thisrepodoesnotexist' does not exist in project with id 'some_valid_id'

Actual Behavior

panic: runtime error: invalid memory address or nil pointer dereference

Steps to Reproduce

  1. terraform apply
oocx commented 6 months ago

@xuzhang3 wow that was quick, thanks!