github.com/opentofu/opentofu@v1.7.1/internal/command/jsonformat/differ/output.go (about)

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