Documentation ¶
Overview ¶
Copyright (c) The OpenTofu Authors SPDX-License-Identifier: MPL-2.0 Copyright (c) 2023 HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0
Copyright (c) The OpenTofu Authors SPDX-License-Identifier: MPL-2.0 Copyright (c) 2023 HashiCorp, Inc. SPDX-License-Identifier: MPL-2.0
Index ¶
- func EvaluateCountExpression(expr hcl.Expression, ctx EvaluateFunc, excludableAddr addrs.Targetable) (int, tfdiags.Diagnostics)
- func EvaluateCountExpressionValue(expr hcl.Expression, ctx EvaluateFunc) (cty.Value, tfdiags.Diagnostics)
- func EvaluateForEachExpression(expr hcl.Expression, ctx ContextFunc, excludableAddr addrs.Targetable) (map[string]cty.Value, tfdiags.Diagnostics)
- func EvaluateForEachExpressionValue(expr hcl.Expression, ctx ContextFunc, allowUnknown bool, allowTuple bool, ...) (cty.Value, tfdiags.Diagnostics)
- type ContextFunc
- type DiagnosticCausedBySensitive
- type DiagnosticCausedByUnknown
- type EvaluateFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EvaluateCountExpression ¶
func EvaluateCountExpression(expr hcl.Expression, ctx EvaluateFunc, excludableAddr addrs.Targetable) (int, tfdiags.Diagnostics)
EvaluateCountExpression is our standard mechanism for interpreting an expression given for a "count" argument on a resource or a module. This should be called during expansion in order to determine the final count value.
EvaluateCountExpression differs from EvaluateCountExpressionValue by returning an error if the count value is not known, and converting the cty.Value to an integer.
If excludableAddr is non-nil then the unknown value error will include an additional idea to exclude that address using the -exclude planning option to converge over multiple plan/apply rounds.
func EvaluateCountExpressionValue ¶
func EvaluateCountExpressionValue(expr hcl.Expression, ctx EvaluateFunc) (cty.Value, tfdiags.Diagnostics)
EvaluateCountExpressionValue is like EvaluateCountExpression except that it returns a cty.Value which must be a cty.Number and can be unknown.
func EvaluateForEachExpression ¶
func EvaluateForEachExpression(expr hcl.Expression, ctx ContextFunc, excludableAddr addrs.Targetable) (map[string]cty.Value, tfdiags.Diagnostics)
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.
EvaluateForEachExpression differs from EvaluateForEachExpressionValue by returning an error if the count value is not known, and converting the cty.Value to a map[string]cty.Value for compatibility with other calls.
If excludableAddr is non-nil then the unknown value error will include an additional idea to exclude that address using the -exclude planning option to converge over multiple plan/apply rounds.
func EvaluateForEachExpressionValue ¶
func EvaluateForEachExpressionValue(expr hcl.Expression, ctx ContextFunc, allowUnknown bool, allowTuple bool, excludableAddr addrs.Targetable) (cty.Value, tfdiags.Diagnostics)
EvaluateForEachExpressionValue is like EvaluateForEachExpression except that it returns a cty.Value map or set which can be unknown. The 'allowTuple' argument is used to support evaluating for_each from tuple values, and is currently supported when using for_each in import blocks.
If excludableAddr is non-nil then any unknown-value-related error will include an additional idea to exclude that address using the -exclude planning option to converge over multiple plan/apply rounds.
Types ¶
type ContextFunc ¶
type ContextFunc func(refs []*addrs.Reference) (*hcl.EvalContext, tfdiags.Diagnostics)
type DiagnosticCausedBySensitive ¶
type DiagnosticCausedBySensitive bool
diagnosticCausedBySensitive is an implementation of tfdiags.DiagnosticExtraBecauseSensitive which we can use in the "Extra" field of a diagnostic to indicate that the problem was caused by sensitive values being involved in an expression evaluation.
When using this, set the Extra to diagnosticCausedBySensitive(true) and also populate the EvalContext and Expression fields of the diagnostic so that the diagnostic renderer can use all of that information together to assist the user in understanding what was sensitive.
func (DiagnosticCausedBySensitive) DiagnosticCausedBySensitive ¶
func (e DiagnosticCausedBySensitive) DiagnosticCausedBySensitive() bool
type DiagnosticCausedByUnknown ¶
type DiagnosticCausedByUnknown bool
diagnosticCausedByUnknown is an implementation of tfdiags.DiagnosticExtraBecauseUnknown which we can use in the "Extra" field of a diagnostic to indicate that the problem was caused by unknown values being involved in an expression evaluation.
When using this, set the Extra to diagnosticCausedByUnknown(true) and also populate the EvalContext and Expression fields of the diagnostic so that the diagnostic renderer can use all of that information together to assist the user in understanding what was unknown.
func (DiagnosticCausedByUnknown) DiagnosticCausedByUnknown ¶
func (e DiagnosticCausedByUnknown) DiagnosticCausedByUnknown() bool
type EvaluateFunc ¶
type EvaluateFunc func(expr hcl.Expression) (cty.Value, tfdiags.Diagnostics)