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

Fixing conversion of null value #130

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

jtyr
Copy link
Contributor

@jtyr jtyr commented Apr 11, 2022

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

This PR is fixing handling of outputs that contain null. In the current implementation, if an output contains anywhere a value that is null, that output key is skipped completely. For example if the output is the result from the random_password resource:

resource "random_password" "password" {
  length           = 16
  special          = true
  override_special = "!#$%&*()-_=+[]{}<>:?"
}

output "password" {
  description = "Password output"
  value       = random_password.password
  sensitive   = true
}

the keepers key is completely missing in the outputs.

$ kubectl get secret -o yaml test-outputs | yq e '.data.password' - | base64 -d 
{"id":"none","length":16,"lower":true,"min_lower":0,"min_numeric":0,"min_special":0,"min_upper":0,"number":true,"override_special":"!#$%&*()-_=+[]{}<>:?","result":"Z3i?:ZbQ#RzmPwk<","special":true,"upper":true,}

As a consequence of skipping the keepers from outputs, there is also an extra , at the end of the encoded output.

With this PR applied, the outputs contain the keepers and even if it would be skipped, the extra , would not be added:

$ kubectl get secret -o yaml test-outputs | yq e '.data.password' - | base64 -d 
{"id":"none","keepers":null,"length":16,"lower":true,"min_lower":0,"min_numeric":0,"min_special":0,"min_upper":0,"number":true,"override_special":"!#$%&*()-_=+[]{}<>:?","result":"Z3i?:ZbQ#RzmPwk<","special":true,"upper":true}

Release note for CHANGELOG:

Fix for handling null values in outputs.

@jtyr jtyr changed the title Fixing convnersion of null value Fixing conversion of null value Jul 5, 2022
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.

1 participant