[codex] expose per-instance replica state on phala_app#7
Draft
[codex] expose per-instance replica state on phala_app#7
Conversation
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
This PR adds an additive per-instance view to
phala_appwithout changing the backend API shape.It keeps
phala_appas the app-level lifecycle resource and exposes current app members through a computedinstancesattribute sourced from the existing app/CVM APIs.What Changed
phala_app.instancesidapp_idnamevm_uuidinstance_idstatusregioninstance_typeendpointcreated_atcreated_atin the provider CVM response modelapp_instancesapp_instance_vm_uuidsapp_instance_idsWhy
Issue #243 asks for primitives closer to GCP MIG / StatefulSet semantics for stateful replica sets.
Without backend API changes, the smallest honest Terraform slice is not a new lifecycle resource or fake ordinal model. It is exposing the real per-instance identity that already exists in the backend/API:
vm_uuid= operator-safe per-instance handleinstance_id= runtime/workload identityThis PR makes that shape available in Terraform state while preserving backward compatibility for existing
phala_appusers.Intentionally Deferred
phala_app_instanceresource yetThose need either a stronger backend contract or a separate provider design pass.
Validation
go test ./internal/provider/...replicas=2phala_app.instancesreturned two concrete membersvm_uuidandinstance_idAdditional Fixes Found During Smoke
The live smoke run surfaced two provider bugs that are fixed in this PR:
instancesmust be a Terraformtypes.List, not a plain Go slice, so plan-time unknown values are handled correctly.regioninto state when the user leftregionunset, otherwise apply can fail with an inconsistent result.Closes #243