fix: resource deserializer

main
sundowndev 2021-10-01 15:43:59 +02:00
parent c7b6eb7345
commit e9eb623d4c
1 changed files with 5 additions and 1 deletions

View File

@ -33,8 +33,12 @@ func (s *Deserializer) DeserializeOne(ty string, value cty.Value) (*Resource, er
return nil, nil
}
// Marked values cannot be deserialized to JSON.
// For example, this ensures we can deserialize sensitive values too.
unmarkedVal, _ := value.UnmarkDeep()
var attrs Attributes
bytes, _ := ctyjson.Marshal(value, value.Type())
bytes, _ := ctyjson.Marshal(unmarkedVal, unmarkedVal.Type())
err := json.Unmarshal(bytes, &attrs)
if err != nil {
return nil, err