unmark decoded changes for jsonplan
Marks are not needed when transcoding changes from the internal msgpack format to json.
This commit is contained in:
parent
213f3391c3
commit
25cebfbd8b
|
@ -212,10 +212,15 @@ func (p *plan) marshalResourceChanges(changes *plans.Changes, schemas *terraform
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// We drop the marks from the change, as decoding is only an
|
||||
// intermediate step to re-encode the values as json
|
||||
changeV.Before, _ = changeV.Before.UnmarkDeep()
|
||||
changeV.After, _ = changeV.After.UnmarkDeep()
|
||||
|
||||
var before, after []byte
|
||||
var beforeSensitive, afterSensitive []byte
|
||||
var afterUnknown cty.Value
|
||||
|
||||
if changeV.Before != cty.NilVal {
|
||||
before, err = ctyjson.Marshal(changeV.Before, changeV.Before.Type())
|
||||
if err != nil {
|
||||
|
@ -338,6 +343,10 @@ func (p *plan) marshalOutputChanges(changes *plans.Changes) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// We drop the marks from the change, as decoding is only an
|
||||
// intermediate step to re-encode the values as json
|
||||
changeV.Before, _ = changeV.Before.UnmarkDeep()
|
||||
changeV.After, _ = changeV.After.UnmarkDeep()
|
||||
|
||||
var before, after []byte
|
||||
afterUnknown := cty.False
|
||||
|
|
|
@ -60,13 +60,15 @@ func marshalPlannedOutputs(changes *plans.Changes) (map[string]output, error) {
|
|||
if err != nil {
|
||||
return ret, err
|
||||
}
|
||||
// The values may be marked, but we must rely on the Sensitive flag
|
||||
// as the decoded value is only an intermediate step in transcoding
|
||||
// this to a json format.
|
||||
changeV.After, _ = changeV.After.UnmarkDeep()
|
||||
|
||||
if changeV.After != cty.NilVal {
|
||||
if changeV.After.IsWhollyKnown() {
|
||||
after, err = ctyjson.Marshal(changeV.After, changeV.After.Type())
|
||||
if err != nil {
|
||||
return ret, err
|
||||
}
|
||||
if changeV.After != cty.NilVal && changeV.After.IsWhollyKnown() {
|
||||
after, err = ctyjson.Marshal(changeV.After, changeV.After.Type())
|
||||
if err != nil {
|
||||
return ret, err
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -193,6 +195,11 @@ func marshalPlanResources(changes *plans.Changes, ris []addrs.AbsResourceInstanc
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// The values may be marked, but we must rely on the Sensitive flag
|
||||
// as the decoded value is only an intermediate step in transcoding
|
||||
// this to a json format.
|
||||
changeV.Before, _ = changeV.Before.UnmarkDeep()
|
||||
changeV.After, _ = changeV.After.UnmarkDeep()
|
||||
|
||||
if changeV.After != cty.NilVal {
|
||||
if changeV.After.IsWhollyKnown() {
|
||||
|
|
Loading…
Reference in New Issue