Skip to content

[Bug]: Restclient does not support pagination #587

@brinnjoyce

Description

@brinnjoyce

Terraform Core Version

1.13.4

ONTAP Provider Version

2.3.0

Affected Resource(s)

All - whenever the API decides to use pagination the restclient will just continue with the first page resulting in not being able to find resources like in #340

Expected Behavior

The rest client should handle pagination

Actual Behavior

The rest client just accepts any records in the first response as complete

Relevant Error/Panic Output Snippet

│ Error: No flexcahce found
│ 
│   with netapp-ontap_storage_flexcache_resource.storage_flexcache[25],
│   on flexcache.tf line 3, in resource "netapp-ontap_storage_flexcache_resource" "storage_flexcache":
│    3: resource "netapp-ontap_storage_flexcache_resource" "storage_flexcache" {
│ 
│ Flexcache "flexcache232" not found.
╵
╷
│ Error: No flexcahce found
│ 
│   with netapp-ontap_storage_flexcache_resource.storage_flexcache[0],
│   on flexcache.tf line 3, in resource "netapp-ontap_storage_flexcache_resource" "storage_flexcache":
│    3: resource "netapp-ontap_storage_flexcache_resource" "storage_flexcache" {
│ 
│ Flexcache "flexcache238" not found.

Terraform Configuration Files

This is a simple way to demonstrate the problem

data "netapp-ontap_flexcaches" "flexcaches" {
  cx_profile_name = "fsx"
}

resource "local_file" "flexcaches" {
  filename = "flexcaches.txt"
  content  = jsonencode(data.netapp-ontap_flexcaches.flexcaches)
}

Do a plan, apply and then another plan and it will change if there's enough flexcaches because it's getting a partial result.

Steps to Reproduce

The API doesn't seem to split records the same way on every request - it must be depending on load/request time. But creating a large number of flexcache volumes - 69 in our case makes it happen every time.

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions