2023-05-02 11:33:06 -04:00
|
|
|
// Copyright IBM Corp. 2014, 2026
|
2023-08-10 18:43:27 -04:00
|
|
|
// SPDX-License-Identifier: BUSL-1.1
|
2023-05-02 11:33:06 -04:00
|
|
|
|
2023-01-09 05:05:25 -05:00
|
|
|
package differ
|
|
|
|
|
|
2023-01-09 08:45:35 -05:00
|
|
|
import (
|
2023-01-11 03:35:36 -05:00
|
|
|
"github.com/zclconf/go-cty/cty"
|
2023-01-09 08:45:35 -05:00
|
|
|
|
2023-01-10 11:24:48 -05:00
|
|
|
"github.com/hashicorp/terraform/internal/command/jsonformat/computed"
|
|
|
|
|
"github.com/hashicorp/terraform/internal/command/jsonformat/computed/renderers"
|
2023-04-21 03:51:55 -04:00
|
|
|
"github.com/hashicorp/terraform/internal/command/jsonformat/structured"
|
2023-01-09 08:45:35 -05:00
|
|
|
)
|
|
|
|
|
|
2023-04-21 03:51:55 -04:00
|
|
|
func ComputeDiffForOutput(change structured.Change) computed.Diff {
|
|
|
|
|
if sensitive, ok := checkForSensitiveType(change, cty.DynamicPseudoType); ok {
|
2023-01-09 10:49:35 -05:00
|
|
|
return sensitive
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-21 03:51:55 -04:00
|
|
|
if unknown, ok := checkForUnknownType(change, cty.DynamicPseudoType); ok {
|
2023-01-10 11:24:48 -05:00
|
|
|
return unknown
|
2023-01-09 10:49:35 -05:00
|
|
|
}
|
|
|
|
|
|
2023-01-11 03:35:36 -05:00
|
|
|
jsonOpts := renderers.RendererJsonOpts()
|
2023-04-24 04:28:21 -04:00
|
|
|
return jsonOpts.Transform(change)
|
2023-01-09 05:05:25 -05:00
|
|
|
}
|