Skip to content

Comments

feat(cluster)!: use min_nodes instead of node_count#228

Merged
adambabik merged 3 commits intomainfrom
adamb/node-count-to-min-nodes
Feb 15, 2026
Merged

feat(cluster)!: use min_nodes instead of node_count#228
adambabik merged 3 commits intomainfrom
adamb/node-count-to-min-nodes

Conversation

@adambabik
Copy link
Collaborator

@adambabik adambabik commented Jan 17, 2026

Motivation

node_count is a static value which does not describe
the reality. ScyllaDB clusters are dynamic and
they scale out automatically when the disk is
running out of scape.

node_count also can't be used to resize the cluster
manually as any change to it results in recreation
of the resource.

This change introduces min_nodes and makes
node_count a computed property. min_nodes
issues a resize request and waits for the completion.

Note that there is no max_nodes as the platform
does not support it at the moment.

Summary

  • This PR introduces a breaking change.
  • node_count becomes a computed property.
  • min_nodes controls the minimum number of nodes. It works this way that any change to min_nodes, after the resource is created, issues a resize request. The value is updated only if the resize request succeeds.
  • Note that this change is only for the Standard clusters. In the future, Terraform Provider will support X Cloud where a scaling policy will be set and work to describe a desired state. The ScyllaDB Cloud internal services will monitor the cluster and resize it to conform to the desired state.

Todo

  • Test the following scenario: create a cluster using TF, scale-out using API, refresh the TF state. Expectation: node_count should be updated but the plan should be empty. Next, update min_nodes to equal node_count. Expectation: min_nodes should be updated, but no resize should be triggered.
  • Test the following scenario: create a cluster using TF with min_nodes = 6, scale-in using API, refresh the TF state. Expectations: node_count should be updated, the plan should result in resize.

@adambabik adambabik force-pushed the adamb/node-count-to-min-nodes branch from 100c97c to 2023d9e Compare January 17, 2026 20:18
@adambabik adambabik force-pushed the adamb/node-count-to-min-nodes branch from ac9ffde to 39d52ff Compare February 5, 2026 11:30
@adambabik adambabik marked this pull request as ready for review February 5, 2026 11:39
@adambabik adambabik force-pushed the adamb/node-count-to-min-nodes branch from 3a0e203 to 4d880f6 Compare February 9, 2026 08:19
@adambabik adambabik requested a review from Copilot February 12, 2026 07:02
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a breaking schema change for the scylladbcloud_cluster resource to model cluster sizing dynamically: node_count becomes computed, while min_nodes becomes the user-controlled input that triggers resize operations.

Changes:

  • Replaces node_count (static/ForceNew) with min_nodes (updatable) and makes node_count computed from actual active nodes.
  • Adds resize support in the Scylla client and implements update behavior to issue a resize request and wait for completion.
  • Updates acceptance tests and state migration (SchemaVersion 2) to support upgrading existing state from node_count to min_nodes.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
internal/tfcontext/context.go Removes provider endpoint logging helper; keeps HTTP request info fields.
internal/scylla/endpoints.go Adds ResizeCluster and refactors ListClusterRequest to accept a params struct.
internal/provider/serverless/serverless_cluster.go Updates cluster-request polling calls to new ListClusterRequest/wait helper naming.
internal/provider/provider_test.go Updates/extends acceptance tests for min_nodes behavior and migration coverage.
internal/provider/cluster/cluster_v1.go Adds schema v1 upgrader to migrate node_countmin_nodes.
internal/provider/cluster/cluster_v0.go Moves v0 state upgrade logic into versioned file (adds disk size upgrade).
internal/provider/cluster/cluster.go Implements SchemaVersion 2, adds min_nodes, adds resize-based Update, and introduces request-wait helpers.
go.mod / go.sum Adds testify and updates indirect deps for new test helpers.
Makefile Tweaks test timeouts/parallelism and adds a target to list acceptance tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@adambabik adambabik force-pushed the adamb/node-count-to-min-nodes branch 3 times, most recently from a190e24 to ddd2176 Compare February 12, 2026 13:22
adambabik and others added 3 commits February 15, 2026 10:18
node_count is a static value which does not describe
the reality. ScyllaDB clusters are dynamic and
they scale out automatically when the disk is
running out of scape.

node_count also can't be used to resize the cluster
manually as any change to it results in recreation
of the resource.

This change introduces min_nodes and makes
node_count a computed property. min_nodes can be
used for manual resizing as well.

Note that there is no max_nodes as the platform
does not support it at the moment.
… updates

Now that min_nodes is updatable in-place, the original reason for
commenting out ForceNew on enable_dns no longer applies (not all
user-facing attrs are ForceNew anymore). Without ForceNew, a change to
enable_dns is routed to Update which silently returns nil without making
any API call, leaving the cluster DNS setting out of sync with state.

Co-Authored-By: Claude <noreply@anthropic.com>
- Update docs/index.md to reflect that horizontal scaling is now
  supported via min_nodes attribute, removing outdated limitation
- Add documentation for scale-in behavior (may fail if insufficient
  disk space)
- Add 'Running Tests' section to CONTRIBUTING.md with instructions
  for unit tests and acceptance tests
- Document required environment variables including
  SCYLLADB_CLOUD_GCP_BYOA_ID for GCP BYOA tests
@adambabik adambabik force-pushed the adamb/node-count-to-min-nodes branch from ddd2176 to 70451a4 Compare February 15, 2026 09:18
@adambabik adambabik merged commit ca3ceaa into main Feb 15, 2026
8 checks passed
@adambabik adambabik deleted the adamb/node-count-to-min-nodes branch February 15, 2026 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant