We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
The text was updated successfully, but these errors were encountered:
Are we looking to add a data source for badges? Whats the use case for this?
Sorry, something went wrong.
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.
Exact same problem !
Need data source or read-only attribute in project resource to find out the sqb_xxxxxx token
sqb_xxxxxx
as a workaround
data "http" "sonar_badge_token" { url = "${var.SONAR_HOST}/api/project_badges/token?project=${sonarqube_project.your_project.id}" request_headers = { Authorization = "Bearer ${var.SONAR_TOKEN}" } lifecycle { postcondition { condition = contains([200], self.status_code) error_message = "Status code invalid" } } } 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=${jsondecode(data.http.sonar_badge_token.response_body).token}" name = "quality-gate-status" }
No branches or pull requests
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:
Gitlab provider documentation:
https://registry.terraform.io/providers/gitlabhq/gitlab/latest/docs/resources/project_badge
The text was updated successfully, but these errors were encountered: