The Terraform provider incorrectly handles pagination when verifying SQL users in the state. When more than 100 SQL users are present, it only retrieves the first 100 due to the default page size. This causes warnings during each Terraform run for a SQL cluster with more than 100 users and errors when applying changes due to conflicts with existing, unfetched users.
The warning during the plan appears as below:
This cluster doesn't have a SQL user named... Removing from state..
Expected Behavior
The provider should correctly implement pagination to verify all SQL users when their count exceeds 100.
Steps to Reproduce:
Write Terraform code that would provision >100 SQL users for a cluster
Execute a terraform apply
Observe the success of the apply (assuming there were no existing users in the state)
Execute a terraform apply again
Observe the warnings indicating that some SQL users are missing, and that they will need to be recreated
Try to apply changes and observe the resultant errors due to user creation conflicts.
Issue Description:
The Terraform provider incorrectly handles pagination when verifying SQL users in the state. When more than 100 SQL users are present, it only retrieves the first 100 due to the default page size. This causes warnings during each Terraform run for a SQL cluster with more than 100 users and errors when applying changes due to conflicts with existing, unfetched users.
The warning during the plan appears as below:
Expected Behavior
The provider should correctly implement pagination to verify all SQL users when their count exceeds 100.
Steps to Reproduce:
terraform apply
terraform apply
againProposed Solution
I have created a PR to resolve this issue.