jdamata / terraform-provider-sonarqube

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

[Feature] Project badge token #213

Open nimdeveloper opened 8 months ago

nimdeveloper commented 8 months ago

It would be great if we had a data source for the badge token so we could use it to set badges automatically. related API: https://next.sonarqube.com/sonarqube/web_api/api/project_badges/token Example usage with Gitlab provider:

resource "gitlab_project" "foo" {
  name = "foo-project"
}

data "sonarqube_badge_token" "sample_badge" {
   project = var.project_key
}

resource "gitlab_project_badge" "example" {
  project   = gitlab_project.foo.id
  link_url  = "https://<sonar_host>/dashboard?id=${var.project_key}"
  image_url = "https://<sonar_host>/api/project_badges/measure?project=${var.project_key}&metric=alert_status&token=${data.sonarqube_badge_token.sample_badge.token}"
  name      = "quality-gate-status"
}

Gitlab provider documentation: https://registry.terraform.io/providers/gitlabhq/gitlab/latest/docs/resources/project_badge

jdamata commented 8 months ago

Are we looking to add a data source for badges? Whats the use case for this?

nimdeveloper commented 8 months ago

Are we looking to add a data source for badges? Whats the use case for this?

Sorry, I updated the description; I put an example of what we can do with the badge token. It will be helpful if we have a data source for that.