thread create_before_destroy to the state file

This commit is contained in:
James Bardin 2020-05-13 20:10:36 -04:00
parent 172d6caf04
commit 23f5fc3e5a
4 changed files with 25 additions and 18 deletions

View File

@ -114,6 +114,7 @@ func (o *ResourceInstanceObject) Encode(ty cty.Type, schemaVersion uint64) (*Res
Private: o.Private,
Status: o.Status,
Dependencies: o.Dependencies,
CreateBeforeDestroy: o.CreateBeforeDestroy,
}, nil
}

View File

@ -131,6 +131,7 @@ func prepareStateV4(sV4 *stateV4) (*File, tfdiags.Diagnostics) {
obj := &states.ResourceInstanceObjectSrc{
SchemaVersion: isV4.SchemaVersion,
CreateBeforeDestroy: isV4.CreateBeforeDestroy,
}
{
@ -493,6 +494,7 @@ func appendInstanceObjectStateV4(rs *states.Resource, is *states.ResourceInstanc
PrivateRaw: privateRaw,
Dependencies: deps,
DependsOn: depOn,
CreateBeforeDestroy: obj.CreateBeforeDestroy,
}), diags
}
@ -544,6 +546,8 @@ type instanceObjectStateV4 struct {
Dependencies []string `json:"dependencies,omitempty"`
DependsOn []string `json:"depends_on,omitempty"`
CreateBeforeDestroy bool `json:"create_before_destroy"`
}
// stateVersionV4 is a weird special type we use to produce our hard-coded

View File

@ -308,6 +308,7 @@ func (n *EvalApply) Eval(ctx EvalContext) (interface{}, error) {
Status: newStatus,
Value: newVal,
Private: resp.Private,
CreateBeforeDestroy: n.Config.Managed.CreateBeforeDestroy,
}
}

View File

@ -228,6 +228,7 @@ func (n *EvalWriteState) Eval(ctx EvalContext) (interface{}, error) {
log.Printf("[TRACE] EvalWriteState: removing state object for %s", absAddr)
return nil, nil
}
fmt.Printf("OBJ: %#v\n", obj)
// store the new deps in the state
if n.Dependencies != nil {