Skip to content

Commit

Permalink
check resource config for unknowns during apply
Browse files Browse the repository at this point in the history
Now that the most common cause of unknowns (invalid resource indexes) is
caught earlier, we can validate that the final apply config is wholly
known before attempting to apply it. This ensures that we're applying
the configuration we intend, and not silently dropping values.
  • Loading branch information
jbardin committed Sep 19, 2019
1 parent 1a6ffaa commit 95da635
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions terraform/eval_apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ func (n *EvalApply) Eval(ctx EvalContext) (interface{}, error) {
}
}

if !configVal.IsWhollyKnown() {
return nil, fmt.Errorf(
"configuration for %s still contains unknown values during apply (this is a bug in Terraform; please report it!)",
absAddr,
)
}

log.Printf("[DEBUG] %s: applying the planned %s change", n.Addr.Absolute(ctx.Path()), change.Action)
resp := provider.ApplyResourceChange(providers.ApplyResourceChangeRequest{
TypeName: n.Addr.Resource.Type,
Expand Down

0 comments on commit 95da635

Please sign in to comment.