terraform-provider-sonarqube icon indicating copy to clipboard operation
terraform-provider-sonarqube copied to clipboard

[Feature] Project badge token

Open nimdeveloper opened this issue 2 years ago • 2 comments

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

nimdeveloper avatar Oct 16 '23 11:10 nimdeveloper

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

jdamata avatar Oct 17 '23 15:10 jdamata

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.

nimdeveloper avatar Oct 18 '23 07:10 nimdeveloper