From d05e280ad5e43bce1373e1343343629a738058eb Mon Sep 17 00:00:00 2001 From: Rees Pozzi Date: Thu, 4 May 2023 16:40:30 +0100 Subject: [PATCH 1/2] Fix small typo in `Error: Moved resource instances excluded by targeting` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When running terraform plan with `-target` but also using terraform move blocks, an error of ``` │ Error: Moved resource instances excluded by targeting │ │ Resource instances in your current state have moved to new addresses in the latest configuration. Terraform must include those resource │ instances while planning in order to ensure a correct result, but your -target=... options to not fully cover all of those resource │ instances. ``` Pops up, which includes a minor typo. This PR updates to fix the typo --- internal/terraform/context_plan.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/terraform/context_plan.go b/internal/terraform/context_plan.go index 3ade28c1ce62..64f214d7c4b8 100644 --- a/internal/terraform/context_plan.go +++ b/internal/terraform/context_plan.go @@ -500,7 +500,7 @@ func (c *Context) prePlanVerifyTargetedMoves(moveResults refactoring.MoveResults tfdiags.Error, "Moved resource instances excluded by targeting", fmt.Sprintf( - "Resource instances in your current state have moved to new addresses in the latest configuration. Terraform must include those resource instances while planning in order to ensure a correct result, but your -target=... options to not fully cover all of those resource instances.\n\nTo create a valid plan, either remove your -target=... options altogether or add the following additional target options:%s\n\nNote that adding these options may include further additional resource instances in your plan, in order to respect object dependencies.", + "Resource instances in your current state have moved to new addresses in the latest configuration. Terraform must include those resource instances while planning in order to ensure a correct result, but your -target=... options do not fully cover all of those resource instances.\n\nTo create a valid plan, either remove your -target=... options altogether or add the following additional target options:%s\n\nNote that adding these options may include further additional resource instances in your plan, in order to respect object dependencies.", listBuf.String(), ), )) From 0a947f0cbc02c9baca563c320d1092b46b48779b Mon Sep 17 00:00:00 2001 From: Rees Pozzi Date: Thu, 4 May 2023 17:09:31 +0100 Subject: [PATCH 2/2] Update unit tests to include typo fix --- internal/terraform/context_plan2_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/terraform/context_plan2_test.go b/internal/terraform/context_plan2_test.go index 45822e9017b4..f59ddcc16835 100644 --- a/internal/terraform/context_plan2_test.go +++ b/internal/terraform/context_plan2_test.go @@ -1574,7 +1574,7 @@ The -target option is not for routine use, and is provided only for exceptional tfdiags.Sourceless( tfdiags.Error, "Moved resource instances excluded by targeting", - `Resource instances in your current state have moved to new addresses in the latest configuration. Terraform must include those resource instances while planning in order to ensure a correct result, but your -target=... options to not fully cover all of those resource instances. + `Resource instances in your current state have moved to new addresses in the latest configuration. Terraform must include those resource instances while planning in order to ensure a correct result, but your -target=... options do not fully cover all of those resource instances. To create a valid plan, either remove your -target=... options altogether or add the following additional target options: -target="test_object.a" @@ -1614,7 +1614,7 @@ The -target option is not for routine use, and is provided only for exceptional tfdiags.Sourceless( tfdiags.Error, "Moved resource instances excluded by targeting", - `Resource instances in your current state have moved to new addresses in the latest configuration. Terraform must include those resource instances while planning in order to ensure a correct result, but your -target=... options to not fully cover all of those resource instances. + `Resource instances in your current state have moved to new addresses in the latest configuration. Terraform must include those resource instances while planning in order to ensure a correct result, but your -target=... options do not fully cover all of those resource instances. To create a valid plan, either remove your -target=... options altogether or add the following additional target options: -target="test_object.b" @@ -1654,7 +1654,7 @@ The -target option is not for routine use, and is provided only for exceptional tfdiags.Sourceless( tfdiags.Error, "Moved resource instances excluded by targeting", - `Resource instances in your current state have moved to new addresses in the latest configuration. Terraform must include those resource instances while planning in order to ensure a correct result, but your -target=... options to not fully cover all of those resource instances. + `Resource instances in your current state have moved to new addresses in the latest configuration. Terraform must include those resource instances while planning in order to ensure a correct result, but your -target=... options do not fully cover all of those resource instances. To create a valid plan, either remove your -target=... options altogether or add the following additional target options: -target="test_object.a"