Support resources in pulumi do#23215
Conversation
9ce9ca0 to
a1376fd
Compare
| cmd.AddCommand(pc.newResourceReadCommand(res)) | ||
| cmd.AddCommand(pc.newResourcePatchCommand(res)) | ||
| cmd.AddCommand(pc.newResourceDeleteCommand(res)) | ||
| if res.ListInputs != nil { |
There was a problem hiding this comment.
is this sound? we require non-nil ListInputs for a resource to be listable? in other words, a resource that doesn't need any additional inputs still needs something like {} or true in the schema?
There was a problem hiding this comment.
Yeh {"type": "object"}.
This is the marker we use to show its listable, rather than having a property on ResourceSpec like IsListable.
| summary, err := formatCreateSummary(res, checked, pc.showSecrets) | ||
| if err != nil { | ||
| return err | ||
| } |
There was a problem hiding this comment.
how will this differ from the stateful form (if at all)?
There was a problem hiding this comment.
For display? I'm not sure, it might be simpler to just leave them as separate display paths, but might be we do something with faking/intercepting engine events.
| // formatPatchSummary renders a human-readable summary of the changes a patch will apply, using the provider's | ||
| // Diff response. If the provider returns no DetailedDiff we fall back to a short "no detailed diff available" | ||
| // note — the operation can still proceed since Update is what actually applies the change. | ||
| func formatPatchSummary(res *schema.Resource, id resource.ID, diff plugin.DiffResult) string { |
There was a problem hiding this comment.
feels like this should take property values into account. if I'm reading it right it's only showing changed paths?
There was a problem hiding this comment.
Yeh, I'll see if we can print diffs like the normal display.
iwahbe
left a comment
There was a problem hiding this comment.
One suggestion, but otherwise LGTM
| result := resource.PropertyMap{ | ||
| "id": resource.NewProperty(string(id)), | ||
| "properties": resource.NewProperty(outputs), | ||
| } |
There was a problem hiding this comment.
Why not just make id a property? That's what other languages do. Resources are already not allowed to have a property called id for this reason.
|
This PR has been shipped in release v3.243.0. |
## (2026-05-22) ### Features - [cli] Make the `pulumi project new -y` command write a minimal project file with no template [pulumi#22847](pulumi#22847) - [cli] Suggest `pulumi neo` in `pulumi preview` and `pulumi up` diagnostics output [pulumi#23326](pulumi#23326) - [sdk] Add `List` to the Go `plugin.Provider` interface, wired to the streaming `ResourceProvider.List` RPC [pulumi#23287](pulumi#23287) - [sdkgen] Reserve the package names 'pulumi' and 'input' for internal use [pulumi#23321](pulumi#23321) - [cli/cloud] Prefer text/markdown over JSON in `pulumi api` when an endpoint produces both [pulumi#22963](pulumi#22963) - [cli/do] Add resource support to `pulumi do` [pulumi#23215](pulumi#23215) - [cli/neo] Pressing Esc in `pulumi neo` now clears the input box when it has text; with an empty box, Esc still cancels the agent's current turn [pulumi#23299](pulumi#23299) - [cli/new] Alias `pulumi new` to `pulumi project new` [pulumi#23265](pulumi#23265) ### Bug Fixes - [cli] Require `--yes` to confirm `pulumi deployment cancel`, `pulumi stack schedule remove`, `pulumi org webhook remove`, and `pulumi stack webhook remove` when running non-interactively [pulumi#23264](pulumi#23264) - [pcl] Don't silently ignore `...` in function arguments [pulumi#23309](pulumi#23309) - [sdkgen/nodejs] Cache package references per-deployment in generated SDKs to fix concurrent inline programs [pulumi#23068](pulumi#23068) - [backend/service] Error out when setting up journaler fails [pulumi#22671](pulumi#22671) ### Miscellaneous - [cli/package] Update the `pulumi package add --agent` documentation hint to use `<type-token>` as the placeholder for the `/docs/...` URL [pulumi#23294](pulumi#23294) - [cli/plugin] Rename plugin ls to list and rm to remove [pulumi#23291](pulumi#23291)
Support 'stateless' resources in
pulumi do. This adds the resource commands create/patch/read/delete/list.Mostly a mechanical calling of the provider methods. Only a few things of note, firstly
patchhas to do a read first, and we also bind the input file to allow missing required properties as the whole point is the user isn't specifying all the properties.Secondly there's some questionable semantics in Read and Delete where we're just working off
idand don't have state to pass to also match on. This might causes issues if any providers are relying on input state to determine what to actually read/delete.