More verbose error for whole resource move failure
When running state mv with a resource source, but the destination fails, provide a hint that the source is a resource (not an instance) in case the user means to address it this way
This commit is contained in:
parent
52c77ba33e
commit
9371b60d71
|
@ -184,7 +184,7 @@ func (c *StateMvCommand) Run(args []string) int {
|
|||
diags = diags.Append(tfdiags.Sourceless(
|
||||
tfdiags.Error,
|
||||
msgInvalidTarget,
|
||||
fmt.Sprintf("Cannot move %s to %s: the target must also be a whole resource.", addrFrom, destAddr),
|
||||
fmt.Sprintf("Cannot move %s to %s: the source is a whole resource (not a resource instance) so the target must also be a whole resource.", addrFrom, destAddr),
|
||||
))
|
||||
c.showDiagnostics(diags)
|
||||
return 1
|
||||
|
|
|
@ -293,8 +293,9 @@ func TestStateMv_resourceToInstanceErr(t *testing.T) {
|
|||
expectedErr := `
|
||||
Error: Invalid target address
|
||||
|
||||
Cannot move test_instance.foo to test_instance.bar[0]: the target must also be
|
||||
a whole resource.
|
||||
Cannot move test_instance.foo to test_instance.bar[0]: the source is a whole
|
||||
resource (not a resource instance) so the target must also be a whole
|
||||
resource.
|
||||
|
||||
`
|
||||
errOutput := ui.ErrorWriter.String()
|
||||
|
|
Loading…
Reference in New Issue