Skip to content

feat(images): settable custom image properties - #13

Merged
PF9-pushkar merged 2 commits into
mainfrom
feat/images-properties
Jul 12, 2026
Merged

feat(images): settable custom image properties#13
PF9-pushkar merged 2 commits into
mainfrom
feat/images-properties

Conversation

@PF9-pushkar

Copy link
Copy Markdown
Collaborator

Part of #2 (Phase 1 follow-ups). Makes pcd_images_image.properties user-settable (was read-only).

  • Set on create via images.CreateOpts.Properties; reconciled on update as a JSON-patch (add/replace/remove) from the plan-vs-state diff.
  • Echo-only Read: Glance returns dozens of system/read-only properties (os_hash_*, stores, direct_url, owner_specified.*, …) via RemainingKeys. Read tracks only the keys the user manages, preventing a perpetual plan diff and any attempt to patch read-only properties.
  • Acceptance test extended: add/replace/remove + the import quirk (echo-only means an imported resource starts with no managed keys).

Adversarial review fix included: dropped a system-property deny-list that was applied on top of the managed-key filter — it added no protection (the managed set already restricts to user keys) but wrongly stripped legitimate user properties whose names collide with it (e.g. location, size), which would have caused an "inconsistent result after apply" error.

build / vet / gofmt / golangci-lint (0 issues) / tfplugindocs all clean.

Make the pcd_images_image `properties` map user-settable (Optional+Computed).
User-defined key/value metadata is set on create via images.CreateOpts.Properties
and reconciled on update as a JSON-patch (add/replace/remove) built from the
plan-vs-state diff.

Read is echo-only: Glance returns dozens of system/read-only properties
(os_hash_*, stores, direct_url, owner_specified.*, ...) via RemainingKeys, so
flatten tracks only the keys the user manages, with a system-property deny-list
as a second guard. This prevents a perpetual plan diff and avoids attempts to
patch read-only properties. Acceptance test extended to cover add/replace/remove
and the import quirk. build/vet/gofmt/golangci-lint and tfplugindocs all clean.
The isSystemImageProperty deny-list was applied on top of the managed-key
filter in flatten, but the managed set already restricts tracking to keys the
user configured — so the deny-list added no leak protection and instead stripped
legitimate user properties whose names collide with it (e.g. "location",
"size"). That produced an 'inconsistent result after apply' error. Track by the
managed set alone and drop the unused deny-list. Found by adversarial review.
@PF9-pushkar
PF9-pushkar merged commit f7a6581 into main Jul 12, 2026
4 checks passed
@PF9-pushkar
PF9-pushkar deleted the feat/images-properties branch July 12, 2026 03:59
PF9-pushkar added a commit that referenced this pull request Jul 14, 2026
feat(images): settable custom image properties
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