mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-19 17:59:05 -05:00
Address ephemeralasnull comments/TODOs (#3169)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
This commit is contained in:
@@ -54,7 +54,7 @@ func TestEphemeralErrors_variables(t *testing.T) {
|
||||
t.Errorf("unexpected err: %s;\nstderr:\n%s\nstdout:\n%s", err, serr, sout)
|
||||
}
|
||||
sanitized := SanitizeStderr(serr)
|
||||
if !strings.Contains(sanitized, `The error expression used to explain this condition refers to ephemeral values. OpenTofu will not display the resulting message. You can correct this by removing references to ephemeral values.`) {
|
||||
if !strings.Contains(sanitized, `The error expression used to explain this condition refers to ephemeral values. OpenTofu will not display the resulting message. You can correct this by removing references to ephemeral values or by utilizing the builtin ephemeralasnull() function.`) {
|
||||
t.Errorf("unexpected stderr: %s;\nstderr:\n%s\nstdout:\n%s", err, serr, sout)
|
||||
t.Logf("sanitized serr: %s", sanitized)
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@ You can correct this by removing references to sensitive values, or by carefully
|
||||
Summary: "Error message refers to ephemeral values",
|
||||
Detail: `The error expression used to explain this condition refers to ephemeral values, so OpenTofu will not display the resulting message.
|
||||
|
||||
You can correct this by removing references to ephemeral values.`, // TODO ephemeral - update the message to include ephemeralasnull option too
|
||||
You can correct this by removing references to ephemeral values or by utilizing the builtin ephemeralasnull() function.`,
|
||||
Subject: expr.Range().Ptr(),
|
||||
Expression: expr,
|
||||
EvalContext: hclCtx,
|
||||
|
||||
@@ -479,7 +479,7 @@ You can correct this by removing references to sensitive values, or by carefully
|
||||
Summary: "Error message refers to ephemeral values",
|
||||
Detail: `The error expression used to explain this condition refers to ephemeral values. OpenTofu will not display the resulting message.
|
||||
|
||||
You can correct this by removing references to ephemeral values.`, // TODO ephemeral - update the message to include ephemeralasnull option too
|
||||
You can correct this by removing references to ephemeral values or by utilizing the builtin ephemeralasnull() function.`,
|
||||
|
||||
Subject: validation.ErrorMessage.Range().Ptr(),
|
||||
Expression: validation.ErrorMessage,
|
||||
|
||||
@@ -1656,9 +1656,7 @@ variable "bar" {
|
||||
|
||||
validation {
|
||||
condition = length(var.bar) == 4
|
||||
// error_message = "Bar must be 4 characters, not ${ephemeralasnull(length(var.bar))}."
|
||||
// TODO ephemeral - enable the error_message above after ephemeralasnull is introduced
|
||||
error_message = "Value for bar must be 4 characters"
|
||||
error_message = "Bar must be 4 characters, not ${coalesce(ephemeralasnull(length(var.bar)), "(hidden ephemeral)")} characters."
|
||||
}
|
||||
}
|
||||
`
|
||||
@@ -1716,9 +1714,7 @@ variable "bar" {
|
||||
given: cty.StringVal("bap"),
|
||||
wantErr: []string{
|
||||
"Invalid value for variable",
|
||||
// "Bar must be 4 characters, not null.",
|
||||
// TODO ephemeral - enable the line above after "ephemeralasnull" is introduced
|
||||
"Value for bar must be 4 characters",
|
||||
"Bar must be 4 characters, not (hidden ephemeral) characters.",
|
||||
},
|
||||
status: checks.StatusFail,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user