Skip to content

Support resources in pulumi do#23215

Merged
Frassle merged 4 commits into
masterfrom
fraser/resdo
May 21, 2026
Merged

Support resources in pulumi do#23215
Frassle merged 4 commits into
masterfrom
fraser/resdo

Conversation

@Frassle

@Frassle Frassle commented May 15, 2026

Copy link
Copy Markdown
Member

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 patch has 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 id and 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.

@Frassle Frassle changed the base branch from master to fraser/yamldo May 19, 2026 22:02
Base automatically changed from fraser/yamldo to master May 19, 2026 22:19
@Frassle Frassle force-pushed the fraser/resdo branch 7 times, most recently from 9ce9ca0 to a1376fd Compare May 20, 2026 20:31
@Frassle Frassle marked this pull request as ready for review May 20, 2026 20:34
@Frassle Frassle requested a review from a team as a code owner May 20, 2026 20:34
cmd.AddCommand(pc.newResourceReadCommand(res))
cmd.AddCommand(pc.newResourcePatchCommand(res))
cmd.AddCommand(pc.newResourceDeleteCommand(res))
if res.ListInputs != nil {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeh {"type": "object"}.
This is the marker we use to show its listable, rather than having a property on ResourceSpec like IsListable.

Comment on lines +137 to +140
summary, err := formatCreateSummary(res, checked, pc.showSecrets)
if err != nil {
return err
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how will this differ from the stateful form (if at all)?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread pkg/cmd/pulumi/do/do_resource.go Outdated
Comment on lines +491 to +494
// 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 {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feels like this should take property values into account. if I'm reading it right it's only showing changed paths?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeh, I'll see if we can print diffs like the normal display.

@iwahbe iwahbe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One suggestion, but otherwise LGTM

Comment thread pkg/cmd/pulumi/do/do_resource.go Outdated
Comment on lines +459 to +462
result := resource.PropertyMap{
"id": resource.NewProperty(string(id)),
"properties": resource.NewProperty(outputs),
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeh that makes sense

@Frassle Frassle enabled auto-merge May 21, 2026 12:35
@Frassle Frassle added this pull request to the merge queue May 21, 2026
Merged via the queue into master with commit 4701ed5 May 21, 2026
120 of 121 checks passed
@Frassle Frassle deleted the fraser/resdo branch May 21, 2026 14:01
@i-am-tom i-am-tom mentioned this pull request May 22, 2026
@pulumi-bot

Copy link
Copy Markdown
Contributor

This PR has been shipped in release v3.243.0.

pull Bot pushed a commit to Stars1233/pulumi that referenced this pull request May 22, 2026
##  (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)
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.

5 participants