mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-25 01:00:16 -05:00
Update user-facing references to Terraform in internal/command/views (#88)
* Update `internal/command/views` Signed-off-by: Marcin Białoń <mbialon@spacelift.io> * fix tests Signed-off-by: Marcin Białoń <mbialon@spacelift.io> * Fix some tests. Signed-off-by: Jakub Martin <kubam@spacelift.io> * Fix some tests. Signed-off-by: Jakub Martin <kubam@spacelift.io> * update tests golden files Signed-off-by: Marcin Białoń <mbialon@spacelift.io> * Fix tests Signed-off-by: Marcin Białoń <mbialon@spacelift.io> * Fix tests Signed-off-by: Marcin Białoń <mbialon@spacelift.io> * Fix tests Signed-off-by: Marcin Białoń <mbialon@spacelift.io> --------- Signed-off-by: Marcin Białoń <mbialon@spacelift.io> Signed-off-by: Jakub Martin <kubam@spacelift.io> Co-authored-by: Jakub Martin <kubam@spacelift.io>
This commit is contained in:
@@ -158,7 +158,7 @@ func (t *TestHuman) Run(run *moduletest.Run, file *moduletest.File) {
|
||||
run.Diagnostics = run.Diagnostics.Append(tfdiags.Sourceless(
|
||||
tfdiags.Warning,
|
||||
"Failed to render test state",
|
||||
fmt.Sprintf("Terraform could not marshal the state for display: %v", err)))
|
||||
fmt.Sprintf("OpenTF could not marshal the state for display: %v", err)))
|
||||
} else {
|
||||
state := jsonformat.State{
|
||||
StateFormatVersion: jsonstate.FormatVersion,
|
||||
@@ -177,7 +177,7 @@ func (t *TestHuman) Run(run *moduletest.Run, file *moduletest.File) {
|
||||
run.Diagnostics = run.Diagnostics.Append(tfdiags.Sourceless(
|
||||
tfdiags.Warning,
|
||||
"Failed to render test plan",
|
||||
fmt.Sprintf("Terraform could not marshal the plan for display: %v", err)))
|
||||
fmt.Sprintf("OpenTF could not marshal the plan for display: %v", err)))
|
||||
} else {
|
||||
plan := jsonformat.Plan{
|
||||
PlanFormatVersion: jsonplan.FormatVersion,
|
||||
@@ -213,12 +213,12 @@ func (t *TestHuman) DestroySummary(diags tfdiags.Diagnostics, run *moduletest.Ru
|
||||
}
|
||||
|
||||
if diags.HasErrors() {
|
||||
t.view.streams.Eprint(format.WordWrap(fmt.Sprintf("Terraform encountered an error destroying resources created while executing %s.\n", identifier), t.view.errorColumns()))
|
||||
t.view.streams.Eprint(format.WordWrap(fmt.Sprintf("OpenTF encountered an error destroying resources created while executing %s.\n", identifier), t.view.errorColumns()))
|
||||
}
|
||||
t.Diagnostics(run, file, diags)
|
||||
|
||||
if state.HasManagedResourceInstanceObjects() {
|
||||
t.view.streams.Eprint(format.WordWrap(fmt.Sprintf("\nTerraform left the following resources in state after executing %s, and they need to be cleaned up manually:\n", identifier), t.view.errorColumns()))
|
||||
t.view.streams.Eprint(format.WordWrap(fmt.Sprintf("\nOpenTF left the following resources in state after executing %s, and they need to be cleaned up manually:\n", identifier), t.view.errorColumns()))
|
||||
for _, resource := range state.AllResourceInstanceObjectAddrs() {
|
||||
if resource.DeposedKey != states.NotDeposed {
|
||||
t.view.streams.Eprintf(" - %s (%s)\n", resource.Instance, resource.DeposedKey)
|
||||
@@ -242,12 +242,12 @@ func (t *TestHuman) FatalInterrupt() {
|
||||
}
|
||||
|
||||
func (t *TestHuman) FatalInterruptSummary(run *moduletest.Run, file *moduletest.File, existingStates map[*moduletest.Run]*states.State, created []*plans.ResourceInstanceChangeSrc) {
|
||||
t.view.streams.Eprint(format.WordWrap(fmt.Sprintf("\nTerraform was interrupted while executing %s, and may not have performed the expected cleanup operations.\n", file.Name), t.view.errorColumns()))
|
||||
t.view.streams.Eprint(format.WordWrap(fmt.Sprintf("\nOpenTF was interrupted while executing %s, and may not have performed the expected cleanup operations.\n", file.Name), t.view.errorColumns()))
|
||||
|
||||
// Print out the main state first, this is the state that isn't associated
|
||||
// with a run block.
|
||||
if state, exists := existingStates[nil]; exists && !state.Empty() {
|
||||
t.view.streams.Eprint(format.WordWrap("\nTerraform has already created the following resources from the module under test:\n", t.view.errorColumns()))
|
||||
t.view.streams.Eprint(format.WordWrap("\nOpenTF has already created the following resources from the module under test:\n", t.view.errorColumns()))
|
||||
for _, resource := range state.AllResourceInstanceObjectAddrs() {
|
||||
if resource.DeposedKey != states.NotDeposed {
|
||||
t.view.streams.Eprintf(" - %s (%s)\n", resource.Instance, resource.DeposedKey)
|
||||
@@ -264,7 +264,7 @@ func (t *TestHuman) FatalInterruptSummary(run *moduletest.Run, file *moduletest.
|
||||
continue
|
||||
}
|
||||
|
||||
t.view.streams.Eprint(format.WordWrap(fmt.Sprintf("\nTerraform has already created the following resources for %q from %q:\n", run.Name, run.Config.Module.Source), t.view.errorColumns()))
|
||||
t.view.streams.Eprint(format.WordWrap(fmt.Sprintf("\nOpenTF has already created the following resources for %q from %q:\n", run.Name, run.Config.Module.Source), t.view.errorColumns()))
|
||||
for _, resource := range state.AllResourceInstanceObjectAddrs() {
|
||||
if resource.DeposedKey != states.NotDeposed {
|
||||
t.view.streams.Eprintf(" - %s (%s)\n", resource.Instance, resource.DeposedKey)
|
||||
@@ -290,7 +290,7 @@ func (t *TestHuman) FatalInterruptSummary(run *moduletest.Run, file *moduletest.
|
||||
module = fmt.Sprintf("%q", run.Config.Module.Source.String())
|
||||
}
|
||||
|
||||
t.view.streams.Eprint(format.WordWrap(fmt.Sprintf("\nTerraform was in the process of creating the following resources for %q from %s, and they may not have been destroyed:\n", run.Name, module), t.view.errorColumns()))
|
||||
t.view.streams.Eprint(format.WordWrap(fmt.Sprintf("\nOpenTF was in the process of creating the following resources for %q from %s, and they may not have been destroyed:\n", run.Name, module), t.view.errorColumns()))
|
||||
for _, resource := range resources {
|
||||
t.view.streams.Eprintf(" - %s\n", resource)
|
||||
}
|
||||
@@ -413,7 +413,7 @@ func (t *TestJSON) Run(run *moduletest.Run, file *moduletest.File) {
|
||||
run.Diagnostics = run.Diagnostics.Append(tfdiags.Sourceless(
|
||||
tfdiags.Warning,
|
||||
"Failed to render test state",
|
||||
fmt.Sprintf("Terraform could not marshal the state for display: %v", err)))
|
||||
fmt.Sprintf("OpenTF could not marshal the state for display: %v", err)))
|
||||
} else {
|
||||
t.view.log.Info(
|
||||
"-verbose flag enabled, printing state",
|
||||
@@ -428,7 +428,7 @@ func (t *TestJSON) Run(run *moduletest.Run, file *moduletest.File) {
|
||||
run.Diagnostics = run.Diagnostics.Append(tfdiags.Sourceless(
|
||||
tfdiags.Warning,
|
||||
"Failed to render test plan",
|
||||
fmt.Sprintf("Terraform could not marshal the plan for display: %v", err)))
|
||||
fmt.Sprintf("OpenTF could not marshal the plan for display: %v", err)))
|
||||
} else {
|
||||
t.view.log.Info(
|
||||
"-verbose flag enabled, printing plan",
|
||||
@@ -455,14 +455,14 @@ func (t *TestJSON) DestroySummary(diags tfdiags.Diagnostics, run *moduletest.Run
|
||||
|
||||
if run != nil {
|
||||
t.view.log.Error(
|
||||
fmt.Sprintf("Terraform left some resources in state after executing %s/%s, they need to be cleaned up manually.", file.Name, run.Name),
|
||||
fmt.Sprintf("OpenTF left some resources in state after executing %s/%s, they need to be cleaned up manually.", file.Name, run.Name),
|
||||
"type", json.MessageTestCleanup,
|
||||
json.MessageTestCleanup, cleanup,
|
||||
"@testfile", file.Name,
|
||||
"@testrun", run.Name)
|
||||
} else {
|
||||
t.view.log.Error(
|
||||
fmt.Sprintf("Terraform left some resources in state after executing %s, they need to be cleaned up manually.", file.Name),
|
||||
fmt.Sprintf("OpenTF left some resources in state after executing %s, they need to be cleaned up manually.", file.Name),
|
||||
"type", json.MessageTestCleanup,
|
||||
json.MessageTestCleanup, cleanup,
|
||||
"@testfile", file.Name)
|
||||
@@ -530,7 +530,7 @@ func (t *TestJSON) FatalInterruptSummary(run *moduletest.Run, file *moduletest.F
|
||||
}
|
||||
|
||||
t.view.log.Error(
|
||||
"Terraform was interrupted during test execution, and may not have performed the expected cleanup operations.",
|
||||
"OpenTF was interrupted during test execution, and may not have performed the expected cleanup operations.",
|
||||
"type", json.MessageTestInterrupt,
|
||||
json.MessageTestInterrupt, message,
|
||||
"@testfile", file.Name)
|
||||
|
||||
Reference in New Issue
Block a user