jdamata / terraform-provider-sonarqube

Terraform provider for managing Sonarqube configuration
GNU General Public License v3.0
62 stars 50 forks source link

sonarqube_project_main_branch: Fails when branch name contains '/' #233

Open MAXxATTAXx opened 6 months ago

MAXxATTAXx commented 6 months ago

Hi there,

Thank you for opening an issue.

Affected Resource(s)

Please list the resources as a list, for example:

Terraform Configuration Files

resource "sonarqube_project" "this" {
  name    = "org:test"
  project = "org:test"
}

resource "sonarqube_project_main_branch" "this" {
  project = sonarqube_project.this.project
  name    = "feature/sonarqube"
}

Expected Behavior

What should have happened? The main branch for a project is renamed to "feature/sonarqube"

Actual Behavior

What actually happened? It gives an error: Error: resourceSonarqubeProjectMainBranchRead: Failed to find project main branch: org:test/feature/sonarqube

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform plan

Looking at the code in sonarqube/resource_sonarqube_project_main_branch.go it seems that a lot of the code relies in being able to split the ID with '/' separator. Issue is that branches in git are allowed to have '/' as part of their name, so the code fails to find the main branch.