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

Allow setting the default value of nullable #17

Merged
merged 2 commits into from
Aug 27, 2024
Merged

Conversation

AislingHPE
Copy link
Contributor

.. to true. This is to make the schema more scrictly align with what Terraform actually permits when nullable is not set in a variable definition. See the updated README for details.

@AislingHPE AislingHPE force-pushed the nullable-all-option branch 2 times, most recently from 709e60b to 044ec8b Compare August 27, 2024 09:57
@AislingHPE AislingHPE marked this pull request as ready for review August 27, 2024 09:57
This is actually a slight behaviour change from the validator used by terraform. If `nullable` is unset, then terraform treats them as `nullable` by default. I chose not to implement that behaviour here and instead am making the Terraform module author specify `nullable = true`. This is because otherwise schema definitions for simple programs would have to become a lot more verbose just to handle this case.
This is actually a slight behaviour change from the validator used by terraform. If `nullable` is unset, then terraform treats them as `nullable` by default. I chose not to implement that default behaviour here and instead am making the Terraform module author specify `nullable = true`. This is because otherwise schema definitions for simple programs would have to become a lot more verbose just to handle this case.

For behaviour more consistent with Terraform, the flag `--nullable-all` can be used to reset the default value for nullable to be true. Note: this rule only applies to variables which have not explicitly set the value of nullable themselves. See [Terraform documentation on nullable](https://developer.hashicorp.com/terraform/language/values/variables#disallowing-null-input-values

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm having to think about what is going on here a bit more than I like.
Could we do something like show another example? eg what the output looks like with --nullable-all set?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

.. to true. This is to make the schema more scrictly align with what Terraform actually permits when `nullable` is not set in a variable definition. See the updated README for details.
@AislingHPE AislingHPE force-pushed the nullable-all-option branch from 4f83baa to fe67e86 Compare August 27, 2024 10:35
@AislingHPE AislingHPE merged commit a66fdfd into main Aug 27, 2024
2 checks passed
@AislingHPE AislingHPE deleted the nullable-all-option branch August 27, 2024 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants