From 6a1b57a1e4fce50c319ca90b45d546f20b64e97b Mon Sep 17 00:00:00 2001 From: James Bardin Date: Thu, 21 Jun 2018 15:01:47 -0400 Subject: [PATCH] split PriorStateRaw into JSON and Flatmap This way the provider doesn't need to be concerned with determining the state encoding. --- providers/provider.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/providers/provider.go b/providers/provider.go index 61917d7c7..09e28956c 100644 --- a/providers/provider.go +++ b/providers/provider.go @@ -130,11 +130,14 @@ type UpgradeResourceStateRequest struct { // Version is version of the schema that created the current state. Version int - // PriorStateRaw is the state that needs to be upgraded to match the current - // schema version. Because the schema is unknown, this contains only the - // raw bytes as stored in the state. It is up to the provider to interpret - // the payload and return a state encoded with the current schema. - PriorStateRaw []byte + // RawStateJSON and RawStateFlatmap contiain the state that needs to be + // upgraded to match the current schema version. Because the schema is + // unknown, this contains only the raw data as stored in the state. + // RawStateJSON is the current json state encoding. + // RawStateFlatmap is the legacy flatmap encoding. + // Only on of these fields may be set for the upgrade request. + RawStateJSON []byte + RawStateFlatmap map[string]string } type UpgradeResourceStateResponse struct {