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

Import sonarqube_group for paginated entries

Open scurow-bdr opened this issue 4 years ago • 3 comments

Hello @jdamata,

I found a bug while importing a sonarqube group, which isn't delivered via the sonarqube API (/api/user_groups/search?q=) on the first page. Sonarqube paginates results and the terraform provider doesn't browse "pages" in order to find the group.

Terraform Version

$ terraform -v
Terraform v1.0.1
on darwin_amd64
+ provider registry.terraform.io/jdamata/sonarqube v0.0.6

Affected Resource(s)

  • sonarqube_group
  • maybe more... I haven't tested, but I can imagine it affects all paginated resources

Example GIST

https://gist.github.com/scurow-bdr/9d38c438028de7d0c69e17376ec2914b

Expected Behavior

The provider should recognize paginated entries while importing.

Actual Behavior

The provider does not find paginated entries while importing.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. ./run.sh in the aforementioned GIST https://gist.github.com/scurow-bdr/9d38c438028de7d0c69e17376ec2914b

scurow-bdr avatar Jul 07 '21 07:07 scurow-bdr

This is present for projects as well.

I have 119 projects currently loaded into my sonarqube instance and the provider fails on retrieving their statuses.

n0rig avatar May 06 '22 01:05 n0rig

This is present for projects as well.

I have 119 projects currently loaded into my sonarqube instance and the provider fails on retrieving their statuses.

I think for projects this can be somewhat fixed by increasing page size with ps query parameter in https://github.com/jdamata/terraform-provider-sonarqube/blob/master/sonarqube/resource_sonarqube_project.go#L111 if implementing pagination is difficult. Similar query parameter can be added to https://github.com/jdamata/terraform-provider-sonarqube/blob/master/sonarqube/resource_sonarqube_group.go#L96 . Maximum number of entries is 500

eslng avatar Feb 20 '23 19:02 eslng

This is present for projects as well. I have 119 projects currently loaded into my sonarqube instance and the provider fails on retrieving their statuses.

I think for projects this can be somewhat fixed by increasing page size with ps query parameter in https://github.com/jdamata/terraform-provider-sonarqube/blob/master/sonarqube/resource_sonarqube_project.go#L111 if implementing pagination is difficult. Similar query parameter can be added to https://github.com/jdamata/terraform-provider-sonarqube/blob/master/sonarqube/resource_sonarqube_group.go#L96 . Maximum number of entries is 500

Pagination shouldn't be too difficult to implement. I just haven't had the time to look into this. If you wanted to open a PR to hardcode the ps parameter to 500 for projects, i would be ok approving/merging that until we get pagination going

jdamata avatar Feb 23 '23 18:02 jdamata