feat(quotas): compute / network / blockstorage project quota resources - #20
Merged
Conversation
Add per-project quota management ported from terraform-provider-openstack: - pcd_compute_quotaset (Nova, 14 fields) - pcd_networking_quota (Neutron, 9 fields) - pcd_blockstorage_quotaset (Cinder, 7 scalar fields) Each resource manages a project's quota limits. Design: - Every quota field is Optional+Computed with UseStateForUnknown, so only the fields the user sets/changes are PUT (via *int omitempty); the server echoes the rest and they stay stable across plans (partial management). - No create API: Create calls Update then reads the values back. - Delete is a deliberate no-op (matches upstream RemoveFromState): destroying the resource stops managing the quotas without resetting them to defaults. - Composite <project_id>/<region> import id, tolerating the legacy bare <project_id> form; project_id and region are ForceNew. Matches upstream field-for-field except: the Cinder per-volume-type quota map (volume_type_quota) and the gophercloud-only nova "force" / neutron "trunk" fields are deferred (see DECISIONS.md). Region resolution uses the same IsNull/IsUnknown predicate in Create, Read, and Update so an explicit empty region does not thrash; Create and Update return on a read-back error instead of persisting unknown computed values. Includes per-service acceptance tests (create project -> set quotas -> verify via API -> update -> import), examples, and CHANGELOG/DECISIONS entries.
PF9-pushkar
added a commit
that referenced
this pull request
Jul 14, 2026
feat(quotas): compute / network / blockstorage project quota resources
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds per-project quota management (Phase 3), ported from
terraform-provider-openstackv3.4.0:pcd_compute_quotasetpcd_networking_quotapcd_blockstorage_quotasetDesign
Optional+ComputedwithUseStateForUnknown. Only fields the user sets/changes are PUT (*int+omitempty); the server echoes the rest and they stay stable across plans. Setting a field to0sends0;-1means unlimited (Neutron).CreatecallsUpdatethen reads the values back (same as upstream).schema.RemoveFromState: destroying the resource stops managing the quotas but does not reset them to defaults. gophercloud's reset-to-defaultsDeleteis intentionally not called.<project_id>/<region>id, tolerating the legacy bare<project_id>;project_idandregionareForceNew.Deliberate deferrals (see DECISIONS.md)
volume_type_quota(per-volume-type quota map via gophercloudExtra) — the most bug-prone part of the port (echo-on-write, read-back-only-for-configured-keys). Deferred so the scalar quotaset ships clean.forceand Neutrontrunk— exist in gophercloud but not in the upstream schema; omitted to match upstream exactly.Adversarial review — 2 real bugs found and fixed
A review workflow (3 finder dimensions → adversarial verify each, against Terraform core source) confirmed two defects, both fixed in this branch, both present in all three resources:
readIntoerror not returned (Create/Update). A transient read-back failure after a successfulUpdateleft unknownComputedfields in state; Terraform core's ungatedIsWhollyKnowncheck then raised a spurious "invalid result object after apply". Now Create/Updatereturnon a read-back error.region = ""thrashed. Create resolved region withIsNull()||IsUnknown()while Read/Update used== "", so an explicit empty region flipped toconfig.Regionon refresh and (region beingForceNew) forced a perpetual replace. Unified on theIsNull()||IsUnknown()predicate everywhere — the verifier flagged that the naive "fall back on empty" fix would instead cause "inconsistent result after apply".Testing
go build,go vet,gofmt,golangci-lint— clean (0 issues); unit tests pass;terraform fmtclean; docs regenerate cleanly with correct subcategories (Compute / Networking / Block Storage).TestAccComputeQuotaset,TestAccNetworkingQuota,TestAccBlockStorageQuotaset): create a project → set quotas → verify via the API → update a field → import. Not run live this session (CE lab credentials unavailable); tracked PENDING in DECISIONS.md.