fixup mangled comments

This commit is contained in:
James Bardin 2020-04-09 10:13:03 -04:00
parent b1bc7a792b
commit 73a20bfb17
2 changed files with 13 additions and 15 deletions

View File

@ -12,18 +12,13 @@ import (
) )
// evaluateCountExpression is our standard mechanism for interpreting an // evaluateCountExpression is our standard mechanism for interpreting an
// expression given for a "count" argument on a resource. This should be called // expression given for a "count" argument on a resource or a module. This
// from the DynamicExpand of a node representing a resource in order to // should be called during expansion in order to determine the final count
// determine the final count value. // value.
// //
// If the result is zero or positive and no error diagnostics are returned, then // evaluateCountExpression differs from evaluateCountExpressionValue by
// the result is the literal count value to use. // returning an error if the count value is not known, and converting the
// // cty.Value to an integer.
// If the result is -1, this indicates that the given expression is nil and so
// the "count" behavior should not be enabled for this resource at all.
//
// If error diagnostics are returned then the result is always the meaningless
// placeholder value -1.
func evaluateCountExpression(expr hcl.Expression, ctx EvalContext) (int, tfdiags.Diagnostics) { func evaluateCountExpression(expr hcl.Expression, ctx EvalContext) (int, tfdiags.Diagnostics) {
countVal, diags := evaluateCountExpressionValue(expr, ctx) countVal, diags := evaluateCountExpressionValue(expr, ctx)
if !countVal.IsKnown() { if !countVal.IsKnown() {

View File

@ -8,11 +8,14 @@ import (
"github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty"
) )
// evaluateForEachExpression interprets a "for_each" argument on a resource. // evaluateForEachExpression is our standard mechanism for interpreting an
// expression given for a "for_each" argument on a resource or a module. This
// should be called during expansion in order to determine the final keys and
// values.
// //
// Returns a cty.Value map, and diagnostics if necessary. It will return nil if // evaluateForEachExpression differs from evaluateForEachExpressionValue by
// the expression is nil, and is used to distinguish between an unset for_each and an // returning an error if the count value is not known, and converting the
// empty map // cty.Value to a map[string]cty.Value for compatibility with other calls.
func evaluateForEachExpression(expr hcl.Expression, ctx EvalContext) (forEach map[string]cty.Value, diags tfdiags.Diagnostics) { func evaluateForEachExpression(expr hcl.Expression, ctx EvalContext) (forEach map[string]cty.Value, diags tfdiags.Diagnostics) {
forEachVal, diags := evaluateForEachExpressionValue(expr, ctx) forEachVal, diags := evaluateForEachExpressionValue(expr, ctx)
if !forEachVal.IsKnown() { if !forEachVal.IsKnown() {