Diagnostic messages

Signed-off-by: Ilia Gogotchuri <ilia.gogotchuri0@gmail.com>
This commit is contained in:
Ilia Gogotchuri
2025-12-04 18:36:55 +04:00
parent 26b34f08ba
commit 93f441a777
5 changed files with 29 additions and 29 deletions

View File

@@ -621,7 +621,7 @@ func actionDescription(action plans.Action) string {
case plans.DeleteThenCreate:
return "[red]-[reset]/[green]+[reset] destroy and then create replacement"
case plans.ForgetThenCreate:
return "[red].[reset]/[green]+[reset] forget the old instance and create replacement"
return "[red].[reset]/[green]+[reset] forget and then create replacement"
case plans.Read:
return " [cyan]<=[reset] read (data resources)"
case plans.Forget:

View File

@@ -190,8 +190,8 @@ func (n *NodePlanDeposedResourceInstanceObject) Execute(ctx context.Context, eva
} else {
diags = diags.Append(&hcl.Diagnostic{
Severity: hcl.DiagWarning,
Summary: "Resource going to be removed from the state",
Detail: fmt.Sprintf("After this plan gets applied, the resource %s will not be managed anymore by OpenTofu.\n\nIn case you want to manage the resource again, you will have to import it.", n.Addr),
Summary: "Resource will be removed from the state",
Detail: fmt.Sprintf("After this plan is applied, the resource %s will not be managed anymore by OpenTofu.\n\nIn case you want to manage the resource again, you will have to import it.", n.Addr),
})
log.Printf("[DEBUG] NodePlanDeposedResourceInstanceObject.Execute: %s (deposed %s) planning forget instead of destroy", n.Addr, n.DeposedKey)
change = n.planForget(ctx, evalCtx, state, n.DeposedKey)

View File

@@ -66,8 +66,8 @@ func TestNodePlanDeposedResourceInstanceObject_Execute(t *testing.T) {
wantAction: plans.Forget,
wantDiags: tfdiags.Diagnostics{}.Append(&hcl.Diagnostic{
Severity: hcl.DiagWarning,
Summary: "Resource going to be removed from the state",
Detail: fmt.Sprintf("After this plan gets applied, the resource %s will not be managed anymore by OpenTofu.\n\nIn case you want to manage the resource again, you will have to import it.", "test_instance.foo"),
Summary: "Resource will be removed from the state",
Detail: fmt.Sprintf("After this plan is applied, the resource %s will not be managed anymore by OpenTofu.\n\nIn case you want to manage the resource again, you will have to import it.", "test_instance.foo"),
}),
},
{
@@ -92,8 +92,8 @@ func TestNodePlanDeposedResourceInstanceObject_Execute(t *testing.T) {
wantAction: plans.Forget,
wantDiags: tfdiags.Diagnostics{}.Append(&hcl.Diagnostic{
Severity: hcl.DiagWarning,
Summary: "Resource going to be removed from the state",
Detail: fmt.Sprintf("After this plan gets applied, the resource %s will not be managed anymore by OpenTofu.\n\nIn case you want to manage the resource again, you will have to import it.", "test_instance.foo[1]"),
Summary: "Resource will be removed from the state",
Detail: fmt.Sprintf("After this plan is applied, the resource %s will not be managed anymore by OpenTofu.\n\nIn case you want to manage the resource again, you will have to import it.", "test_instance.foo[1]"),
}),
},
{
@@ -118,8 +118,8 @@ func TestNodePlanDeposedResourceInstanceObject_Execute(t *testing.T) {
wantAction: plans.Forget,
wantDiags: tfdiags.Diagnostics{}.Append(&hcl.Diagnostic{
Severity: hcl.DiagWarning,
Summary: "Resource going to be removed from the state",
Detail: fmt.Sprintf("After this plan gets applied, the resource %s will not be managed anymore by OpenTofu.\n\nIn case you want to manage the resource again, you will have to import it.", "module.boop.test_instance.foo"),
Summary: "Resource will be removed from the state",
Detail: fmt.Sprintf("After this plan is applied, the resource %s will not be managed anymore by OpenTofu.\n\nIn case you want to manage the resource again, you will have to import it.", "module.boop.test_instance.foo"),
}),
},
{
@@ -155,8 +155,8 @@ func TestNodePlanDeposedResourceInstanceObject_Execute(t *testing.T) {
wantAction: plans.Forget,
wantDiags: tfdiags.Diagnostics{}.Append(&hcl.Diagnostic{
Severity: hcl.DiagWarning,
Summary: "Resource going to be removed from the state",
Detail: fmt.Sprintf("After this plan gets applied, the resource %s will not be managed anymore by OpenTofu.\n\nIn case you want to manage the resource again, you will have to import it.", "module.boop[1].test_instance.foo[1]"),
Summary: "Resource will be removed from the state",
Detail: fmt.Sprintf("After this plan is applied, the resource %s will not be managed anymore by OpenTofu.\n\nIn case you want to manage the resource again, you will have to import it.", "module.boop[1].test_instance.foo[1]"),
}),
},
{
@@ -170,8 +170,8 @@ func TestNodePlanDeposedResourceInstanceObject_Execute(t *testing.T) {
wantAction: plans.Forget,
wantDiags: tfdiags.Diagnostics{}.Append(&hcl.Diagnostic{
Severity: hcl.DiagWarning,
Summary: "Resource going to be removed from the state",
Detail: fmt.Sprintf("After this plan gets applied, the resource %s will not be managed anymore by OpenTofu.\n\nIn case you want to manage the resource again, you will have to import it.", "module.boop.test_instance.foo"),
Summary: "Resource will be removed from the state",
Detail: fmt.Sprintf("After this plan is applied, the resource %s will not be managed anymore by OpenTofu.\n\nIn case you want to manage the resource again, you will have to import it.", "module.boop.test_instance.foo"),
}),
},
{
@@ -185,8 +185,8 @@ func TestNodePlanDeposedResourceInstanceObject_Execute(t *testing.T) {
wantAction: plans.Forget,
wantDiags: tfdiags.Diagnostics{}.Append(&hcl.Diagnostic{
Severity: hcl.DiagWarning,
Summary: "Resource going to be removed from the state",
Detail: fmt.Sprintf("After this plan gets applied, the resource %s will not be managed anymore by OpenTofu.\n\nIn case you want to manage the resource again, you will have to import it.", "module.boop[1].test_instance.foo"),
Summary: "Resource will be removed from the state",
Detail: fmt.Sprintf("After this plan is applied, the resource %s will not be managed anymore by OpenTofu.\n\nIn case you want to manage the resource again, you will have to import it.", "module.boop[1].test_instance.foo"),
}),
},
}

View File

@@ -216,8 +216,8 @@ func (n *NodePlannableResourceInstanceOrphan) managedResourceExecute(ctx context
} else {
diags = diags.Append(&hcl.Diagnostic{
Severity: hcl.DiagWarning,
Summary: "Resource going to be removed from the state",
Detail: fmt.Sprintf("After this plan gets applied, the resource %s will not be managed anymore by OpenTofu.\n\nIn case you want to manage the resource again, you will have to import it.", n.Addr),
Summary: "Resource will be removed from the state",
Detail: fmt.Sprintf("After this plan is applied, the resource %s will not be managed anymore by OpenTofu.\n\nIn case you want to manage the resource again, you will have to import it.", n.Addr),
})
log.Printf("[DEBUG] NodePlannableResourceInstanceOrphan.managedResourceExecute: %s (orphan) planning forget instead of destroy", addr)
change = n.planForget(ctx, evalCtx, oldState, "")

View File

@@ -60,8 +60,8 @@ func TestNodeResourcePlanOrphan_Execute(t *testing.T) {
wantAction: plans.Forget,
wantDiags: tfdiags.Diagnostics{}.Append(&hcl.Diagnostic{
Severity: hcl.DiagWarning,
Summary: "Resource going to be removed from the state",
Detail: fmt.Sprintf("After this plan gets applied, the resource %s will not be managed anymore by OpenTofu.\n\nIn case you want to manage the resource again, you will have to import it.", "test_instance.foo"),
Summary: "Resource will be removed from the state",
Detail: fmt.Sprintf("After this plan is applied, the resource %s will not be managed anymore by OpenTofu.\n\nIn case you want to manage the resource again, you will have to import it.", "test_instance.foo"),
}),
},
{
@@ -84,8 +84,8 @@ func TestNodeResourcePlanOrphan_Execute(t *testing.T) {
wantAction: plans.Forget,
wantDiags: tfdiags.Diagnostics{}.Append(&hcl.Diagnostic{
Severity: hcl.DiagWarning,
Summary: "Resource going to be removed from the state",
Detail: fmt.Sprintf("After this plan gets applied, the resource %s will not be managed anymore by OpenTofu.\n\nIn case you want to manage the resource again, you will have to import it.", "test_instance.foo[1]"),
Summary: "Resource will be removed from the state",
Detail: fmt.Sprintf("After this plan is applied, the resource %s will not be managed anymore by OpenTofu.\n\nIn case you want to manage the resource again, you will have to import it.", "test_instance.foo[1]"),
}),
},
{
@@ -108,8 +108,8 @@ func TestNodeResourcePlanOrphan_Execute(t *testing.T) {
wantAction: plans.Forget,
wantDiags: tfdiags.Diagnostics{}.Append(&hcl.Diagnostic{
Severity: hcl.DiagWarning,
Summary: "Resource going to be removed from the state",
Detail: fmt.Sprintf("After this plan gets applied, the resource %s will not be managed anymore by OpenTofu.\n\nIn case you want to manage the resource again, you will have to import it.", "module.boop.test_instance.foo"),
Summary: "Resource will be removed from the state",
Detail: fmt.Sprintf("After this plan is applied, the resource %s will not be managed anymore by OpenTofu.\n\nIn case you want to manage the resource again, you will have to import it.", "module.boop.test_instance.foo"),
}),
},
{
@@ -143,8 +143,8 @@ func TestNodeResourcePlanOrphan_Execute(t *testing.T) {
wantAction: plans.Forget,
wantDiags: tfdiags.Diagnostics{}.Append(&hcl.Diagnostic{
Severity: hcl.DiagWarning,
Summary: "Resource going to be removed from the state",
Detail: fmt.Sprintf("After this plan gets applied, the resource %s will not be managed anymore by OpenTofu.\n\nIn case you want to manage the resource again, you will have to import it.", "module.boop[1].test_instance.foo[1]"),
Summary: "Resource will be removed from the state",
Detail: fmt.Sprintf("After this plan is applied, the resource %s will not be managed anymore by OpenTofu.\n\nIn case you want to manage the resource again, you will have to import it.", "module.boop[1].test_instance.foo[1]"),
}),
},
{
@@ -156,8 +156,8 @@ func TestNodeResourcePlanOrphan_Execute(t *testing.T) {
wantAction: plans.Forget,
wantDiags: tfdiags.Diagnostics{}.Append(&hcl.Diagnostic{
Severity: hcl.DiagWarning,
Summary: "Resource going to be removed from the state",
Detail: fmt.Sprintf("After this plan gets applied, the resource %s will not be managed anymore by OpenTofu.\n\nIn case you want to manage the resource again, you will have to import it.", "module.boop.test_instance.foo"),
Summary: "Resource will be removed from the state",
Detail: fmt.Sprintf("After this plan is applied, the resource %s will not be managed anymore by OpenTofu.\n\nIn case you want to manage the resource again, you will have to import it.", "module.boop.test_instance.foo"),
}),
},
{
@@ -169,8 +169,8 @@ func TestNodeResourcePlanOrphan_Execute(t *testing.T) {
wantAction: plans.Forget,
wantDiags: tfdiags.Diagnostics{}.Append(&hcl.Diagnostic{
Severity: hcl.DiagWarning,
Summary: "Resource going to be removed from the state",
Detail: fmt.Sprintf("After this plan gets applied, the resource %s will not be managed anymore by OpenTofu.\n\nIn case you want to manage the resource again, you will have to import it.", "module.boop[1].test_instance.foo"),
Summary: "Resource will be removed from the state",
Detail: fmt.Sprintf("After this plan is applied, the resource %s will not be managed anymore by OpenTofu.\n\nIn case you want to manage the resource again, you will have to import it.", "module.boop[1].test_instance.foo"),
}),
},
}