thread create_before_destroy to the state file
This commit is contained in:
parent
172d6caf04
commit
23f5fc3e5a
|
@ -109,11 +109,12 @@ func (o *ResourceInstanceObject) Encode(ty cty.Type, schemaVersion uint64) (*Res
|
|||
}
|
||||
|
||||
return &ResourceInstanceObjectSrc{
|
||||
SchemaVersion: schemaVersion,
|
||||
AttrsJSON: src,
|
||||
Private: o.Private,
|
||||
Status: o.Status,
|
||||
Dependencies: o.Dependencies,
|
||||
SchemaVersion: schemaVersion,
|
||||
AttrsJSON: src,
|
||||
Private: o.Private,
|
||||
Status: o.Status,
|
||||
Dependencies: o.Dependencies,
|
||||
CreateBeforeDestroy: o.CreateBeforeDestroy,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -130,7 +130,8 @@ func prepareStateV4(sV4 *stateV4) (*File, tfdiags.Diagnostics) {
|
|||
instAddr := rAddr.Instance(key)
|
||||
|
||||
obj := &states.ResourceInstanceObjectSrc{
|
||||
SchemaVersion: isV4.SchemaVersion,
|
||||
SchemaVersion: isV4.SchemaVersion,
|
||||
CreateBeforeDestroy: isV4.CreateBeforeDestroy,
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -484,15 +485,16 @@ func appendInstanceObjectStateV4(rs *states.Resource, is *states.ResourceInstanc
|
|||
}
|
||||
|
||||
return append(isV4s, instanceObjectStateV4{
|
||||
IndexKey: rawKey,
|
||||
Deposed: string(deposed),
|
||||
Status: status,
|
||||
SchemaVersion: obj.SchemaVersion,
|
||||
AttributesFlat: obj.AttrsFlat,
|
||||
AttributesRaw: obj.AttrsJSON,
|
||||
PrivateRaw: privateRaw,
|
||||
Dependencies: deps,
|
||||
DependsOn: depOn,
|
||||
IndexKey: rawKey,
|
||||
Deposed: string(deposed),
|
||||
Status: status,
|
||||
SchemaVersion: obj.SchemaVersion,
|
||||
AttributesFlat: obj.AttrsFlat,
|
||||
AttributesRaw: obj.AttrsJSON,
|
||||
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
|
||||
|
|
|
@ -305,9 +305,10 @@ func (n *EvalApply) Eval(ctx EvalContext) (interface{}, error) {
|
|||
var newState *states.ResourceInstanceObject
|
||||
if !newVal.IsNull() { // null value indicates that the object is deleted, so we won't set a new state in that case
|
||||
newState = &states.ResourceInstanceObject{
|
||||
Status: newStatus,
|
||||
Value: newVal,
|
||||
Private: resp.Private,
|
||||
Status: newStatus,
|
||||
Value: newVal,
|
||||
Private: resp.Private,
|
||||
CreateBeforeDestroy: n.Config.Managed.CreateBeforeDestroy,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue