Skip to content

If the target supplied by --target does not exist, opentofu exits 0 #3729

@johnbarney

Description

@johnbarney

Community note

Tip

👋 Hi there, OpenTofu community! The OpenTofu team prioritizes issues based on upvotes. Please make sure to upvote this issue and describe how it affects you in detail in the comments to show your support.

OpenTofu Version

OpenTofu v1.11.4
on darwin_arm64

OpenTofu Configuration Files

resource "null_resource" "real_resource" {
  ...
}

Debug Output

N/A

Expected Behavior

I expect OpenTofu to fail if any resource specified in --target does not exist and take no action at all.

Actual Behavior

OpenTofu does nothing and exits 0.

Steps to Reproduce

tofu apply --target null_resource.fake_resource

Additional Context

I know behavior changes like this are always controversial.

We have a use case where we specify a very large number of targets.

If any of these do not exist, something has gone wrong and tofu should not continue. I can't imagine a scenario when this isn't the case. I'm sure someone has some strange edge case they have built off this behavior though (threads like this always surface a few).

References

No response

Pinned by apparentlymart

Metadata

Metadata

Assignees

Labels

acceptedThis issue has been accepted for implementation.enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions