# Configure resources within the cluster - no second provider needed
resource "platform_cluster_topic" "orders" {
  name       = "orders"
  server_url = platform_cluster.main.endpoint
  api_token  = var.cluster_token
}
```

The cluster topic resource accepts its own `server_url` and `api_token` configuration, pulling values directly from the cluster resource output. Users write a single Terraform configuration that handles both layers without managing multiple providers.

## How it works

Per-resource configuration uses the OpenAPI specification's operation-level security and server definitions. When your OpenAPI spec declares different servers or security requirements for specific operations, Speakeasy can expose these as resource-level configuration options in the Terraform provider.

This feature is disabled by default. Not every API with operation-level configuration needs per-resource settings exposed to end users. Enable it selectively for resources that genuinely require different endpoints or credentials.

### When to use per-resource configuration

This feature fits specific architectural patterns:

- **Admin APIs and data APIs**: Separate management planes and control planes with distinct authentication
- **Multi-tenant infrastructure**: Resources that connect to tenant-specific endpoints
- **Cluster-based systems**: Managing both cluster provisioning and internal cluster resources
- **Database platforms**: Controlling database instances plus in-database resources like schemas and users

## Configuration from a user perspective

Users configure per-resource settings just like any other resource attribute. The difference is these settings control how the provider connects to the API rather than what data gets sent.

Here's what it looks like with environment-specific clusters:

```hcl
resource "platform_cluster" "staging" {
  name = "staging"
}

resource "platform_cluster" "production" {
  name = "production"
}