microsoft / terraform-provider-azuredevops

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

azuredevops_build_definition 'name' is optional on documentation, but actually not #1122

Closed liyaoz closed 1 month ago

liyaoz commented 3 months ago

Community Note

Terraform (and Azure DevOps Provider) Version

Terraform v1.9.3 provider registry.terraform.io/microsoft/azuredevops v1.2.0

Affected Resource(s)

Terraform Configuration Files

resource "azuredevops_build_definition" "pipelines" {
  project_id = data.azuredevops_project.myproj.id
  # name       = "Some pipeline"  <-- The field in question
  path       = null

  ci_trigger {
    use_yaml = true
  }

  repository {
    repo_type   = "TfsGit"
    repo_id     = azuredevops_git_repository.example.id
    branch_name = "main"
    yml_path    = "xxx/xxx.yaml"
  }
}

Debug Output

Panic Output

│ Error: The string must have at least one non-white-space character.
│ Parameter name: definition.Name
│ 
│   with azuredevops_build_definition.pipelines,
│   on main.tf line 33, in resource "azuredevops_build_definition" "pipelines":
│   33: resource "azuredevops_build_definition" "pipelines" {

Expected Behavior

According to doco, the name is optional:

name - (Optional) The name of the build definition.

Actual Behavior

The configuration successfully passed terraform plan but errors on apply.

Steps to Reproduce

  1. terraform apply

Important Factoids

References