Skip to content

feat(nfs): add size_unit to ionoscloud_nfs_cluster resource#986

Merged
mimihalescu merged 7 commits into
masterfrom
feat/SDK-2686-nfs-size-unit
May 15, 2026
Merged

feat(nfs): add size_unit to ionoscloud_nfs_cluster resource#986
mimihalescu merged 7 commits into
masterfrom
feat/SDK-2686-nfs-size-unit

Conversation

@mimihalescu
Copy link
Copy Markdown
Contributor

@mimihalescu mimihalescu commented May 12, 2026

Summary

  • Adds size_unit attribute (TiB or GiB) to the ionoscloud_nfs_cluster resource and data source
  • Upgrades the vendored NFS Go SDK to v2.0.2 which includes the SizeUnit field
  • Fixes tolist() usage for the TypeSet ips attribute in test configs

@mimihalescu mimihalescu force-pushed the feat/SDK-2686-nfs-size-unit branch 2 times, most recently from cb30263 to 6244f14 Compare May 13, 2026 13:15
mimihalescu and others added 2 commits May 13, 2026 16:17
Exposes the new sizeUnit API field on the ionoscloud_nfs_cluster
resource and data source, supported values "TiB" and "GiB".

- Add size_unit schema attribute with StringInSlice validation
- Upgrade vendored sdk-go-bundle/products/nfs to v2.0.2 which ships
  SizeUnit natively (replacing a temporary manual patch on v2.0.0)
- Update acceptance tests and examples to use size = 2048 / size_unit = "GiB"
- Remove static min/max values from docs since limits depend on size_unit

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
terraform-plugin-testing relies on hc-install to download the Terraform
CLI when TF_ACC_TERRAFORM_PATH is unset. hc-install v0.9.2 carries a
hardcoded HashiCorp OpenPGP key that has expired upstream, breaking the
SHA256SUMS signature check and causing all acceptance tests to fail with
"openpgp: key expired". v0.9.5 ships the rotated key.

Transitively bumps ProtonMail/go-crypto, cloudflare/circl,
hashicorp/go-retryablehttp, hashicorp/go-version, golang.org/x/{mod,net,tools}
to satisfy hc-install v0.9.5's declared minimum versions.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@mimihalescu mimihalescu force-pushed the feat/SDK-2686-nfs-size-unit branch from 6244f14 to b151c43 Compare May 13, 2026 13:18
mimihalescu and others added 2 commits May 13, 2026 16:30
NFS cluster and share acceptance tests previously referenced a long-lived
datacenter (88eeae0d-...) and server (1f77a37e-...) by hardcoded UUIDs
via data sources. That datacenter has been deleted, so every NFS
acceptance test fails at plan time with "404 Not Found".

Replace the data-source-based temporaryConfigSetup with a fresh
nfsTestSetup that creates its own datacenter (de/txl, the only region
where NFS is offered) and a private LAN, and use a static private CIDR
for the cluster's connection IP. Drops the unused random_password and
locals blocks left over from when this config was shared with InMemoryDB
tests.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Two test bugs uncovered once the NFS acceptance tests started reaching
the apply/destroy stages:

1. testAccCheckNFSClusterDestroy and testAccCheckNFSShareDestroy treated
   a 404 from the SDK as a failure. The SDK returns a non-nil err on
   any non-2xx response, so the post-404 `if err != nil` branch fired
   and reported "error fetching ..." even though 404 is exactly the
   state we want after destruction. Reorder the checks so 404 is a
   short-circuit success and any other (status, err) combination is
   classified correctly.

2. testAccCheckNFSShareConfigUpdate renamed the share, but the NFS API
   forbids renaming (common-0010: "changing share name is not allowed").
   Keep the share name stable in the update step so we only exercise
   the fields the API actually permits updating.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@mimihalescu
Copy link
Copy Markdown
Contributor Author

/test nfs

@mimihalescu mimihalescu marked this pull request as ready for review May 15, 2026 06:59
Copilot AI review requested due to automatic review settings May 15, 2026 06:59
Copy link
Copy Markdown
Contributor

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

Adds a new size_unit attribute (TiB/GiB) to the ionoscloud_nfs_cluster resource and data source so users can express cluster size in either unit. To support the new field, the vendored ionos-cloud/sdk-go-bundle/products/nfs/v2 is bumped from v2.0.0 to v2.0.2 (which exposes Cluster.SizeUnit), and a large set of transitive vendored dependencies are re-vendored as well. Acceptance tests are reworked to provision a fresh datacenter/LAN instead of relying on hard-coded pre-existing resources, and a couple of unrelated test fixes are included.

Changes:

  • Introduce size_unit schema attribute on the NFS cluster resource and data source and wire it into the SDK request/response mapping.
  • Upgrade the vendored NFS SDK to v2.0.2 plus a wide refresh of other vendored modules (hc-install, go-version, go-retryablehttp, go-crypto, circl, golang.org/x/{net,mod,tools}, etc.).
  • Replace the data-source-based temporaryConfigSetup test scaffold with a self-contained nfsTestSetup that creates its own datacenter/LAN, and tighten Destroy checks for NFS cluster and share tests.

Reviewed changes

Copilot reviewed 9 out of 112 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
ionoscloud/resource_nfs_cluster.go Adds size_unit schema with TiB/GiB validation.
ionoscloud/data_source_nfs_cluster.go Exposes size_unit as a computed attribute on the data source.
services/nfs/cluster.go Reads/writes size_unit to and from the SDK Cluster model.
ionoscloud/resource_nfs_cluster_test.go Rewrites acceptance tests to use the new self-contained setup and asserts size_unit.
ionoscloud/resource_nfs_share_test.go Adjusts destroy check for nil response and fixes a stale "updated" name assertion.
ionoscloud/test_constants.go Replaces data-source-based scaffold with a real datacenter/LAN scaffold for NFS tests.
docs/resources/nfs_cluster.md Documents the new size_unit argument and updates examples.
CHANGELOG.md Notes the hc-install bump.
go.mod / go.sum Bumps NFS SDK and several other dependencies.
vendor/github.com/ionos-cloud/sdk-go-bundle/products/nfs/v2/** Vendored NFS SDK v2.0.2, including new SizeUnit field, MetadataWithUsage, doc/comment edits, and MarshalJSON additions.
vendor/github.com/hashicorp/hc-install/** Vendored update to v0.9.5, including a rotated PGP key and rewritten copyright headers.
vendor/github.com/hashicorp/go-version/** Vendored update to v1.9.0 (adds WithPrefix, lazy regex init) with rewritten copyright headers.
vendor/github.com/hashicorp/go-retryablehttp/** Vendored update to v0.7.8 with new RateLimitLinearJitterBackoff.
vendor/github.com/ProtonMail/go-crypto/** Vendored v1.4.1: new selectHash, decompression size limits, etc.
vendor/github.com/cloudflare/circl/** Minor vendored changes (added Seeded interface and lint annotations).
vendor/golang.org/x/net/http2/** Vendored doc comments marking user-provided write schedulers deprecated; minor canRetryError change.
vendor/golang.org/x/tools/go/packages/** Vendored optimization to mergeResponses, dedup logic, and -buildvcs=false.
vendor/modules.txt Records the new vendored module versions.
Comments suppressed due to low confidence (1)

docs/resources/nfs_cluster.md:132

  • The previous docs called out the valid size range ("The minimum value is 2 and the maximum value is 42" for TiB). The new wording drops the range entirely. Since the valid range now depends on size_unit (2–42 for TiB, 2048–43008 for GiB per the SDK model docs), it would be helpful to document both ranges so users know what to choose. Also, the description claims size_unit defaults to TiB, but the schema in ionoscloud/resource_nfs_cluster.go does not set a Default; the default is effectively whatever the backend assigns. If you want this documented default to be authoritative on the provider side, add Default: "TiB" to the schema (note: combining Default with Computed: true is not allowed, so you'd need to drop Computed or rely on the server default and update the doc wording).
- `size` - (Required) The size of the Network File Storage cluster. Note that the cluster size cannot be reduced after provisioning. This value determines the billing fees.
- `size_unit` - (Optional) The unit of the `size` attribute. Accepted values: `TiB`, `GiB`. Defaults to `TiB`.

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

Comment thread docs/resources/nfs_cluster.md
Comment thread ionoscloud/resource_nfs_share_test.go
Comment thread ionoscloud/resource_nfs_cluster.go
Comment thread services/nfs/cluster.go
Comment thread ionoscloud/test_constants.go
@sonarqubecloud
Copy link
Copy Markdown

@mimihalescu mimihalescu merged commit 9c075b8 into master May 15, 2026
10 checks passed
@mimihalescu mimihalescu deleted the feat/SDK-2686-nfs-size-unit branch May 15, 2026 09:23
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.

3 participants