You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the json output of terraform as config for other systems, it might be a good idea to also give the option to include the null values inside the output json. This way you can be sure that certain keys will always exist.
Attempted Solutions
The current terraform output command with the json option does not output values that have a null value.
Proposal
It would be nice if either by default the output json always includes null values. It might also be an option for the terraform output command like this
terraform output --json --allow-null
References
No response
The text was updated successfully, but these errors were encountered:
Thanks for filing the issue. This unfortunately is a little more difficult than just displaying a null value. Throughout Terraform null is used to indicate the absence of a value, and for top-level objects, triggers their removal from state. If you inspect the state file, you will see that there is no output at all if the value was null, so there is nothing for Terraform to display in that case.
In most cases if you are decoding json, there is usually a way to handle missing keys in the same manner as keys with a null value, given of course that you know what keys to expect. Some other workarounds may be to handle the -json output from the CLI plan itself which has information about all actions being performed, or inspect the stored plan which does store null output values, as that is captured before they are applied to the state.
Terraform Version
Use Cases
When using the json output of terraform as config for other systems, it might be a good idea to also give the option to include the null values inside the output json. This way you can be sure that certain keys will always exist.
Attempted Solutions
The current terraform output command with the json option does not output values that have a null value.
Proposal
It would be nice if either by default the output json always includes null values. It might also be an option for the terraform output command like this
terraform output --json --allow-null
References
No response
The text was updated successfully, but these errors were encountered: