Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configs: Include context when variable default has nested problem #35465

Merged
merged 1 commit into from
Jul 17, 2024

Conversation

apparentlymart
Copy link
Contributor

Previously this error message was including only the main error message and ignoring any context about what part of a potential nested data structure it arose from.

Now we'll use our usual path formatting utility to introduce additional context whenever a problem arises with a nested value.

This fixes #27773 by making its error message now include the problematic attribute path:

╷
│ Error: Invalid default value for variable
│ 
│   on variable-default-validation-context.tf line 6, in variable "foo":
│    6:   default = {
│    7:     "memap" = {
│    8:        abc = "i am a string"
│    9:        iamme = "one two three"
│   10:     }
│   11:   }
│ 
│ This default value is not compatible with the variable's type constraint:
│ ["memap"].abc: a bool is required.
╵

Previously this error message was including only the main error message
and ignoring any context about what part of a potential nested data
structure it arose from.

Now we'll use our usual path formatting utility to introduce additional
context whenever a problem arises with a nested value.
@apparentlymart apparentlymart merged commit 72de171 into main Jul 17, 2024
10 checks passed
Copy link

Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch.

Copy link

github-actions bot commented Sep 4, 2024

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 4, 2024
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Variable Type Validation object() does not report location
2 participants