Skip to content

Instantly share code, notes, and snippets.

@et304383
Created September 8, 2023 17:49
Show Gist options
  • Save et304383/998a155363c66ae0de3ee62fac155e70 to your computer and use it in GitHub Desktop.
Save et304383/998a155363c66ae0de3ee62fac155e70 to your computer and use it in GitHub Desktop.
Patch TF 1.4.6 to remove refreshing, reading, read complete messages
diff --git a/internal/command/views/hook_ui.go b/internal/command/views/hook_ui.go
index 2c5c0f5704..d8dcc4627a 100644
--- a/internal/command/views/hook_ui.go
+++ b/internal/command/views/hook_ui.go
@@ -88,7 +88,7 @@ func (h *UiHook) PreApply(addr addrs.AbsResourceInstance, gen states.Generation,
operation = "Modifying..."
op = uiResourceModify
case plans.Read:
- operation = "Reading..."
+ operation = ""
op = uiResourceRead
case plans.NoOp:
op = uiResourceNoOp
@@ -207,7 +207,7 @@ func (h *UiHook) PostApply(addr addrs.AbsResourceInstance, gen states.Generation
case uiResourceCreate:
msg = "Creation complete"
case uiResourceRead:
- msg = "Read complete"
+ msg = ""
case uiResourceNoOp:
// We don't make any announcements about no-op changes
return terraform.HookActionContinue, nil
@@ -225,11 +225,12 @@ func (h *UiHook) PostApply(addr addrs.AbsResourceInstance, gen states.Generation
addrStr = fmt.Sprintf("%s (deposed object %s)", addrStr, depKey)
}
- colorized := fmt.Sprintf(
- h.view.colorize.Color("[reset][bold]%s: %s after %s%s"),
- addrStr, msg, time.Now().Round(time.Second).Sub(state.Start), stateIdSuffix)
-
- h.println(colorized)
+ if msg != "" {
+ colorized := fmt.Sprintf(
+ h.view.colorize.Color("[reset][bold]%s: %s after %s%s"),
+ addrStr, msg, time.Now().Round(time.Second).Sub(state.Start), stateIdSuffix)
+ h.println(colorized)
+ }
return terraform.HookActionContinue, nil
}
@@ -262,19 +263,11 @@ func (h *UiHook) ProvisionOutput(addr addrs.AbsResourceInstance, typeName string
}
func (h *UiHook) PreRefresh(addr addrs.AbsResourceInstance, gen states.Generation, priorState cty.Value) (terraform.HookAction, error) {
- var stateIdSuffix string
- if k, v := format.ObjectValueID(priorState); k != "" && v != "" {
- stateIdSuffix = fmt.Sprintf(" [%s=%s]", k, v)
- }
-
addrStr := addr.String()
if depKey, ok := gen.(states.DeposedKey); ok {
addrStr = fmt.Sprintf("%s (deposed object %s)", addrStr, depKey)
}
- h.println(fmt.Sprintf(
- h.view.colorize.Color("[reset][bold]%s: Refreshing state...%s"),
- addrStr, stateIdSuffix))
return terraform.HookActionContinue, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment