github.com/terramate-io/tf@v0.0.0-20230830114523-fce866b4dfcd/command/jsonformat/differ/output.go (about)

     1  // Copyright (c) HashiCorp, Inc.
     2  // SPDX-License-Identifier: MPL-2.0
     3  
     4  package differ
     5  
     6  import (
     7  	"github.com/zclconf/go-cty/cty"
     8  
     9  	"github.com/terramate-io/tf/command/jsonformat/computed"
    10  	"github.com/terramate-io/tf/command/jsonformat/computed/renderers"
    11  	"github.com/terramate-io/tf/command/jsonformat/structured"
    12  )
    13  
    14  func ComputeDiffForOutput(change structured.Change) computed.Diff {
    15  	if sensitive, ok := checkForSensitiveType(change, cty.DynamicPseudoType); ok {
    16  		return sensitive
    17  	}
    18  
    19  	if unknown, ok := checkForUnknownType(change, cty.DynamicPseudoType); ok {
    20  		return unknown
    21  	}
    22  
    23  	jsonOpts := renderers.RendererJsonOpts()
    24  	return jsonOpts.Transform(change)
    25  }