jdamata / terraform-provider-sonarqube

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

fix: missing support for permission_template name instead of id #236

Closed PabloHiro closed 8 months ago

PabloHiro commented 8 months ago

The following block of code:

resource "sonarqube_permission_template" "this" {
    name = "foo"
}
resource "sonarqube_permissions" "bar" {
  login_name  = "bar"
  template_name = "foo"
  permissions = sort(["codeviewer", "scan", "user"])
}

Will not work as expected and try to implement Global permissions ([admin, gateadmin, profileadmin, provisioning, scan]) instead of Permission template permissions (["admin", "codeviewer", "scan", "user"]).

This is because upon creation of a resource the current code does not check if template_name is defined, only looks for template_id.