jdamata / terraform-provider-sonarqube

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

Fix Portfolio default branch bug #150

Closed felixlut closed 1 year ago

felixlut commented 1 year ago

When you create a Portfolio in TAGS, REGEX or REST mode without specifying a branch, the Portfolio should pick the default branch (or as SonarQube calls it, "Main Branch") of the Project. When setting the mode via the API, an optional parameter branch can be used for this purpose. If it's left unset, then the Portfolio will pick the default branch of the project, but setting it to "" does not yield the same result as one might expect.

This PR fixes that by only appending the branch parameter when it is actually set in the Terraform resource.

Calling the API, we can see that this Portfolio, which does not pick up the default branch of its projects, and was created with the provider without setting the branch in the resource, still set branch to "" via the api/views/show?key=on-prem endpoint: bild

With this update, the resulting Portfolio looks like this instead: bild

github-advanced-security[bot] commented 1 year ago

You have successfully added a new CodeQL configuration .github/workflows/codeql-analysis.yml:analyze/language:go. As part of the setup process, we have scanned this repository and found no existing alerts. In the future, you will see all code scanning alerts on the repository Security tab.