Apply does not need remarking
Apply, at this moment, appears that it does not require the remarking strategy, as the plan has already been printed
This commit is contained in:
parent
5b0b1a13a5
commit
3e8b125e53
|
@ -78,26 +78,6 @@ func (n *EvalApply) Eval(ctx EvalContext) (interface{}, error) {
|
|||
)
|
||||
}
|
||||
|
||||
// Copy paste from eval_diff
|
||||
var markedPath cty.Path
|
||||
// var marks cty.ValueMarks
|
||||
if configVal.ContainsMarked() {
|
||||
// store the marked values so we can re-mark them later after
|
||||
// we've sent things over the wire. Right now this stores
|
||||
// one path for proof of concept, but we should store multiple
|
||||
cty.Walk(configVal, func(p cty.Path, v cty.Value) (bool, error) {
|
||||
if v.IsMarked() {
|
||||
markedPath = p
|
||||
return false, nil
|
||||
// marks = v.Marks()
|
||||
}
|
||||
return true, nil
|
||||
})
|
||||
// Unmark the value for sending over the wire
|
||||
// to providers as marks cannot be serialized
|
||||
configVal, _ = configVal.UnmarkDeep()
|
||||
}
|
||||
|
||||
metaConfigVal := cty.NullVal(cty.DynamicPseudoType)
|
||||
if n.ProviderMetas != nil {
|
||||
log.Printf("[DEBUG] EvalApply: ProviderMeta config value set")
|
||||
|
@ -125,14 +105,23 @@ func (n *EvalApply) Eval(ctx EvalContext) (interface{}, error) {
|
|||
|
||||
log.Printf("[DEBUG] %s: applying the planned %s change", n.Addr.Absolute(ctx.Path()), change.Action)
|
||||
|
||||
// HACK The after val is also marked so let's fix that
|
||||
unmarked, _ := change.After.UnmarkDeep()
|
||||
// If our config or After value contain any marked values,
|
||||
// ensure those are stripped out before sending
|
||||
// this to the provider
|
||||
unmarkedConfigVal := configVal
|
||||
if configVal.ContainsMarked() {
|
||||
unmarkedConfigVal, _ = configVal.UnmarkDeep()
|
||||
}
|
||||
unmarkedAfter := change.After
|
||||
if change.After.ContainsMarked() {
|
||||
unmarkedAfter, _ = change.After.UnmarkDeep()
|
||||
}
|
||||
|
||||
resp := provider.ApplyResourceChange(providers.ApplyResourceChangeRequest{
|
||||
TypeName: n.Addr.Resource.Type,
|
||||
PriorState: change.Before,
|
||||
Config: configVal,
|
||||
PlannedState: unmarked,
|
||||
Config: unmarkedConfigVal,
|
||||
PlannedState: unmarkedAfter,
|
||||
PlannedPrivate: change.Private,
|
||||
ProviderMeta: metaConfigVal,
|
||||
})
|
||||
|
@ -149,16 +138,6 @@ func (n *EvalApply) Eval(ctx EvalContext) (interface{}, error) {
|
|||
// incomplete.
|
||||
newVal := resp.NewState
|
||||
|
||||
// Add the mark back to the planned new value
|
||||
if len(markedPath) != 0 {
|
||||
newVal, _ = cty.Transform(newVal, func(p cty.Path, v cty.Value) (cty.Value, error) {
|
||||
if p.Equals(markedPath) {
|
||||
return v.Mark("sensitive"), nil
|
||||
}
|
||||
return v, nil
|
||||
})
|
||||
}
|
||||
|
||||
if newVal == cty.NilVal {
|
||||
// Providers are supposed to return a partial new value even when errors
|
||||
// occur, but sometimes they don't and so in that case we'll patch that up
|
||||
|
|
Loading…
Reference in New Issue