-
Notifications
You must be signed in to change notification settings - Fork 10.1k
actions: return an error if config is omitted but the schema has required attrs #37626
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
Conversation
…d attributes There are various methods in terraform that will let you know if you are missing required attributes - none of which work with hcl.EmptyBody or nil inputs. This adds some helper methods so terraform can check if an action schema has required arguments and returns an error if the config is null but arguments are required. I did not bother with an exhaustive list of missing args, but I'm open to making that change. I'd like to get eyes on this section before I move on to modifying what we send to the provider.
24abd1e to
2084154
Compare
| "Missing required argument: The argument \"host\" is required, but was not set.", | ||
| false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a more succinct solution, and I was pondering if to borrow the same idea. However, is it clear enough given that this error simply indicates that the argument "host", with no mention to "config" at all?
There is also no source diagnostic, so the user has to figure out that the host belongs within a config block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got it as close as I'm going to right now - I absolutely agree with you, and this still doesn't have the nice error I'd like it to, but I added some context and hopefully we can call this good enough for now and I will add it to my list of things to improve
be49fbd to
8a889aa
Compare
|
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. |
This PR fixes terraform's handling of nil action configurations. It will now properly return errors about missing required (not computed) attributes. This is done by substituting an hcl.EmptyBody in place of a nil config.
This would have gone a lot faster if I hadn't been slightly wrong about the hcl.EmptyBody from the start; I'd thought it was one of my error cases 😂😭
Fixes #
Target Release
1.14.x
Rollback Plan
Changes to Security Controls
Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.
CHANGELOG entry