pulumi/pkg/engine/lifecycletest
Thomas Gummerer 898a682ef6
Make sure non-targeted resources are not updated (#15476)
When the `--target` option is used, resources that already exist in the
snapshot, but aren't directly targeted should not be updated at all.
Internally in the engine, this is done by turning them into a
`SameStep`, meaning no updates will actually be preformed, and we will
make it look like the resource stayed the same.

However, we currently still write the "new" state of the resource (e.g.
updated dependencies, inputs, etc.) into the snapshot. This is mostly
fine as long as the new dependencies already exist. If a dependency on a
resource is that doesn't already exist is added however this breaks.
Since the resource that's being depended on doesn't exist in the
snapshot and isn't targeted, we won't create it. At the same time we're
adding a dependency on that virtually non-existing resource, which makes
the snapshot invalid.

Since we're in `--target` mode, we should do what we promised the user,
and only update the targeted resources, nothing else. Introduce a new
`NonTargetedSameStep` here, which does exactly that. It's essentially
the same as a `SameStep`, but we always use the *old* state instead of
the new one when writing it out. Since the resource is not targeted,
this leaves it in the same state as before.

Fixes #12096
Fixes #15382
2024-03-05 07:49:11 +00:00
..
alias_test.go Add an engine test for Construct and Call dependency maps (#15403) 2024-02-08 13:01:47 +00:00
analyzer_test.go Add an engine test for Construct and Call dependency maps (#15403) 2024-02-08 13:01:47 +00:00
delete_before_replace_test.go Add an engine test for Construct and Call dependency maps (#15403) 2024-02-08 13:01:47 +00:00
golang_sdk_test.go Add an engine test for Construct and Call dependency maps (#15403) 2024-02-08 13:01:47 +00:00
import_test.go Add an engine test for Construct and Call dependency maps (#15403) 2024-02-08 13:01:47 +00:00
pending_delete_test.go Update golangci-lint (#14624) 2023-11-21 15:16:13 +00:00
provider_test.go Add an engine test for Construct and Call dependency maps (#15403) 2024-02-08 13:01:47 +00:00
pulumi_test.go Ensure ArgsDependencies are filled in (#15450) 2024-02-21 09:15:38 +00:00
refresh_test.go Add an engine test for Construct and Call dependency maps (#15403) 2024-02-08 13:01:47 +00:00
resource_reference_test.go Add an engine test for Construct and Call dependency maps (#15403) 2024-02-08 13:01:47 +00:00
source_query_test.go Ensure ArgsDependencies are filled in (#15450) 2024-02-21 09:15:38 +00:00
step_generator_test.go Add an engine test for Construct and Call dependency maps (#15403) 2024-02-08 13:01:47 +00:00
target_test.go Make sure non-targeted resources are not updated (#15476) 2024-03-05 07:49:11 +00:00
test_plan.go [tests] testBuilder: Use specified package name (#15269) 2024-01-26 16:20:45 +00:00
transformation_test.go Engine support for remote transforms (#15290) 2024-02-21 16:30:46 +00:00
update_plan_test.go Add an engine test for Construct and Call dependency maps (#15403) 2024-02-08 13:01:47 +00:00