state mv
returns 0 on invalid source address
#29365
Labels
Milestone
state mv
returns 0 on invalid source address
#29365
Terraform Version
Expected Behavior
When given a source address that does not exist in the state,
terraform state mv
should exit with a non-zero code to signal failure.Actual Behavior
An error is printed but 0 is returned.
Steps to Reproduce
It looks like this is an oversight in state_mv.go: in the case where
sourceAddrs
is empty, an error is added to the diags, but the code that checks diags for errors (and returns 1 if any are found) is only inside the loop oversourceAddrs
, so 1 is never returned. I could supply a simple patch to fix the issue, but I'm following the contribution guidelines by opening an issue first instead.The text was updated successfully, but these errors were encountered: