code: func evaluateResourceCountExpressionKnown(expr hcl.Expression, ctx EvalContext) (count int, known bool, diags tfdiags.Diagnostics) {
  	if expr == nil {
  		return -1, true, nil
  	}
  
  	countVal, countDiags := ctx.EvaluateExpr(expr, cty.Number, nil)
  	diags = diags.Append(countDiags)
  	if diags.HasErrors() {
  		return -1, true, diags
  	}
  
  	switch {
  	case countVal.IsNull():
  		diags = diags.Append(&hcl.Diagnostic{
  			Severity: hcl.DiagError,
  			Summary:  "Invalid count argument",
  			Detail:   `The given "count" argument value is null. An integer is required.`,
  			Subject:  expr.Range().Ptr(),
  		})
  		return -1, true, diags
  	case !countVal.IsKnown():
  		return 0, false, diags
  	}
  
  	err := gocty.FromCtyValue(countVal, &count)
  	if err != nil {
  		diags = diags.Append(&hcl.Diagnostic{
  			Severity: hcl.DiagError,
  			Summary:  "Invalid count argument",
  			Detail:   fmt.Sprintf(`The given "count" argument value is unsuitable: %s.`, err),
  			Subject:  expr.Range().Ptr(),
  		})
  		return -1, true, diags
  	}
  	if count < 0 {
  		diags = diags.Append(&hcl.Diagnostic{
  			Severity: hcl.DiagError,
  			Summary:  "Invalid count argument",
  			Detail:   `The given "count" argument value is unsuitable: negative numbers are not supported.`,
  			Subject:  expr.Range().Ptr(),
  		})
  		return -1, true, diags
  	}
  
  	return count, true, diags
  }
docs: // evaluateResourceCountExpressionKnown is like evaluateResourceCountExpression
  // except that it handles an unknown result by returning count = 0 and
  // a known = false, rather than by reporting the unknown value as an error
  // diagnostic.