Visitar URL original
[engine] Propagate target/exclude dependents through read resources by i-am-tom · Pull Request #24538 · pulumi/pulumi · GitHub
Skip to content

[engine] Propagate target/exclude dependents through read resources - #24538

Merged
i-am-tom merged 1 commit into
masterfrom
claude/laughing-solomon-b6411d
Sep 9, 2026
Merged

i-am-tom merged 1 commit into
masterfrom
claude/laughing-solomon-b6411d

Conversation

@i-am-tom

@i-am-tom i-am-tom commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

When we get an (unmanaged) resource, we go through GenerateReadSteps rather than generateResourceSteps, and we don't add the relevant resources to targetsActual or excludesActual. This means that if you --target-dependents, everything under an unmanaged resource gets ignored silently.

This PR adds the targetActual/excludesActual tracking to GenerateReadSteps, and fixes this.

Fixes #12368.

🤖 Generated with Claude Code

`--target-dependents` and `--exclude-dependents` walk the dependency graph in
topological order, adding each resource to `targetsActual`/`excludesActual` as
it is visited so that its dependents can see it. `generateResourceSteps` did
this for registered resources, but `GenerateReadSteps` never did, so a resource
read with `.get()` was silently dropped from the set and the propagation chain
broke there: anything depending on the read resource was treated as untargeted
and emitted a `Same` step.

Extract the existing block into `recordActualTargeting` and call it from the
read path as well.

Fixes #12368

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
return nil, fmt.Errorf("Expected an ID for %v", urn)
}

sg.recordActualTargeting(sg.isIncludedInOperation(newState), newState)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Tada

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.

Hmm reading this do we always do a Read step even if its not targetted? That's probably fine but does feel a bit odd.

@i-am-tom
i-am-tom marked this pull request as ready for review September 8, 2026 15:47
@i-am-tom
i-am-tom requested a review from a team as a code owner September 8, 2026 15:47

@Frassle Frassle 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.

actual change looks ok

@i-am-tom
i-am-tom added this pull request to the merge queue Sep 9, 2026
Merged via the queue into master with commit 86f7ef7 Sep 9, 2026
245 of 247 checks passed
@i-am-tom
i-am-tom deleted the claude/laughing-solomon-b6411d branch September 9, 2026 15:28
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.

Pulumi up with --target <URN> --target-dependents not targeting transitive dependencies properly when using .get()

2 participants