feat(nfs): add size_unit to ionoscloud_nfs_cluster resource#986
Conversation
cb30263 to
6244f14
Compare
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>
6244f14 to
b151c43
Compare
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>
|
/test nfs |
There was a problem hiding this comment.
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_unitschema 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
temporaryConfigSetuptest scaffold with a self-containednfsTestSetupthat creates its own datacenter/LAN, and tightenDestroychecks 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
2and the maximum value is42" for TiB). The new wording drops the range entirely. Since the valid range now depends onsize_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 claimssize_unitdefaults toTiB, but the schema inionoscloud/resource_nfs_cluster.godoes not set aDefault; the default is effectively whatever the backend assigns. If you want this documented default to be authoritative on the provider side, addDefault: "TiB"to the schema (note: combiningDefaultwithComputed: trueis not allowed, so you'd need to dropComputedor 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.
|



Summary
size_unitattribute (TiBorGiB) to theionoscloud_nfs_clusterresource and data sourceSizeUnitfieldtolist()usage for theTypeSetipsattribute in test configs