jdamata / terraform-provider-sonarqube

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

How to add multiple groups as Visibility #246

Closed Sameer2307 closed 7 months ago

Sameer2307 commented 7 months ago

Hi there,

Thank you for opening an issue.

Affected Resource(s)

Terraform Configuration Files

# Copy-paste your Terraform configurations here - for large Terraform configs,
resource "sonarqube_project" "main" {
    name       = "SonarQube"
    project    = "my_project"
    visibility =  // How to add multiple group values here
}

Expected Behavior

I am trying to restrict the project to particular sonarqube group. But i am unable to

Actual Behavior

the visibility is expecting a string where I can add a single group

freeranger commented 7 months ago

Hello It looks like this resource mirrors the rather messy SonarQube API - the visibility property only accepts either public or private as you can see here: https://next.sonarqube.com/sonarqube/web_api/api/projects/create

It seems like you would need to set this to private and then use the sonar_permissions resource to set permissions for users for this project: https://github.com/jdamata/terraform-provider-sonarqube/blob/master/docs/resources/sonarqube_permissions.md#example-set-codeviewer--user-permissions-on-project-level-for-a-user-called-johndoe

Sameer2307 commented 7 months ago

Thanks a lot this makes sense to me, I was confused because the documentation mentions this : https://registry.terraform.io/providers/jdamata/sonarqube/latest/docs/resources/sonarqube_project#:~:text=Whether%20the%20created%20project%20should%20be%20visible%20to%20everyone%2C%20or%20only%20specific%20user/groups

Worth saying it can only be public or private But thanks a lot @freeranger

freeranger commented 7 months ago

Sure thing @Sameer2307 - to be fair I think the documentation is just copied from Sonar’s own documentation, which isn’t great. Feel free to submit a PR which improves the documentation ;)

Sameer2307 commented 6 months ago

https://github.com/jdamata/terraform-provider-sonarqube/pull/251