# Awkward manual pagination
Source: https://speakeasy.com/blog/release-terraform-globals-pagination

import { Callout } from "@/lib/mdx/components";

We're excited to announce three significant improvements to Terraform provider generation that bring it closer to SDK generation parity. These features eliminate manual workarounds, reduce code duplication, and provide a cleaner developer experience for Terraform users.

## 🌐 Provider-level globals

Define common configuration values once at the provider level instead of repeating them across every resource.

### What it solves

Before globals support, Terraform providers required manual coding to handle provider-level configuration like region settings or organization IDs. There was no clean workaround — teams had to implement custom solutions or accept repetitive configuration across resources.

Terraform consumers can choose the appropriate style of configuration for their use case:

* Per-resource: Same as before.
* Provider-only: Configure once at the provider level for all resource configurations.
* Provider with per-resource overrides: Configure the provider level with a default value while a resource level value will override.

### How it works

Globals use the same Speakeasy globals extension as SDK generation, ensuring consistency across all generated code. Simply add `x-speakeasy-globals` to your OpenAPI specification:

```yaml
x-speakeasy-globals:
  - name: region
    description: The AWS region to use
    type: string
  - name: orgId
    description: Organization identifier
    type: string
```

This generates clean provider-level configuration in your Terraform blocks:

```hcl
provider "myapi" {
  region = "us-west-2"
  org_id = "my-org-123"
}

resource "myapi_instance" "example" {
  # region and org_id automatically available
  name = "my-instance"
}
```

## 📄 Automatic pagination handling

Terraform data sources now handle paginated API responses automatically behind the scenes.

### What it solves

Previously, pagination handling was incomplete, requiring manual data resource creation. Paginated results are now fully handled and unnecessary pagination details are hidden from consumers.

### How it works

Using the same Speakeasy pagination extension as SDK generation, providers automatically handle all pagination types:

- Cursor-based pagination
- Offset/limit pagination
- Page-based pagination

Before pagination support, users had to manually handle paging:

```hcl

data "myapi_resources" "page1" {
  page_number = 1
  page_size   = 100
}

data "myapi_resources" "page2" {
  page_number = 2
  page_size   = 100
}
```

After pagination support, it's seamless:

```hcl