github.com/graywolf-at-work-2/terraform-vendor@v1.4.5/internal/command/jsonformat/computed/renderers/unknown.go (about)

     1  package renderers
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/hashicorp/terraform/internal/command/jsonformat/computed"
     7  
     8  	"github.com/hashicorp/terraform/internal/plans"
     9  )
    10  
    11  var _ computed.DiffRenderer = (*unknownRenderer)(nil)
    12  
    13  func Unknown(before computed.Diff) computed.DiffRenderer {
    14  	return &unknownRenderer{
    15  		before: before,
    16  	}
    17  }
    18  
    19  type unknownRenderer struct {
    20  	NoWarningsRenderer
    21  
    22  	before computed.Diff
    23  }
    24  
    25  func (renderer unknownRenderer) RenderHuman(diff computed.Diff, indent int, opts computed.RenderHumanOpts) string {
    26  	if diff.Action == plans.Create {
    27  		return "(known after apply)"
    28  	}
    29  
    30  	// Never render null suffix for children of unknown changes.
    31  	opts.OverrideNullSuffix = true
    32  	return fmt.Sprintf("%s -> (known after apply)", renderer.before.RenderHuman(indent, opts))
    33  }