-
-
Notifications
You must be signed in to change notification settings - Fork 247
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
Set allowed and cache methods as non nullable #324
base: main
Are you sure you want to change the base?
Conversation
Setting nullable to false ensures that the variable value will never be null within the module. If nullable is false and the variable has a default value, then Terraform uses the default when a module input argument is null.
Huh this is interesting @travis-reed -- the first use-case of 'nullable' I've seen. Thanks for providing the explanation! What version of TF was this introduced? We may need to update our pinning of TF for this module to support this usage depending on when it was added to the language. |
/terratest |
Thanks for taking a look @Gowiem, This feature was introduced in terraform 1.1 It looks like this module is requiring >= terraform 1.3 so I would expect this to work without upgrading the required version on the module |
I see that the |
@CodeRabbit full review |
✅ Actions performedFull review triggered. |
📝 Walkthrough📝 WalkthroughWalkthroughThe changes involve updates to the Changes
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🔇 Additional comments (2)variables.tf (2)
The change ensures that the variable will never be null while maintaining backward compatibility through the default value.
The change is safe as it has a sensible default value. Note that Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
@travis-reed the bats error is:
|
@CodeRabbit full review |
@CodeRabbit full review ✅ Actions performedFull review triggered. |
/terratest |
what
Set allowed_methods and cached_methods as non nullable
Setting nullable to false ensures that the variable value will never be null within the module. If nullable is false and the variable has a default value, then Terraform uses the default when a module input argument is null.
why
I want to be able to sometimes call this module with explicit
allowed_methods
andcached_methods
and sometimes just use the module defaults.As it stands, I cannot do that without making my default value match your default value. It would be better for the module to use its defaults when I pass in
null
Right now I am hitting
Which I can work around by setting a default on my side, but it isn't ideal behavior
references
Additional Notes
I wouldn't consider this a breaking change. Today, the behavior if you pass in
null
as the argument to the module you will get a failure as shown above. This makes passing innull
possible without negatively impacting existing users.Summary by CodeRabbit
allowed_methods
andcached_methods
by ensuring they cannot be set to null, improving overall data integrity.