Skip to content

Fix cdktf synth --hcl fails to render false(bool), 0(int), ""(empty string) #3907

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

XIAOLONGLII
Copy link

@XIAOLONGLII XIAOLONGLII commented Jun 22, 2025

Added test for variable bool and string default value.

Related issue

Fixes #3621

Description

In plain English, describe your approach to addressing the issue linked above. For example, if you made a particular design decision, let us know why you chose this path instead of another solution.

Checklist

  • I have updated the PR title to match CDKTF's style guide
  • I have run the linter on my code locally
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation if applicable
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works if applicable
  • New and existing unit tests pass locally with my changes

Added test for variable bool and string default value.
Copy link

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes

Have you signed the CLA already but the status is still pending? Recheck it.

1 similar comment
Copy link

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes

Have you signed the CLA already but the status is still pending? Recheck it.

@XIAOLONGLII XIAOLONGLII changed the title Update json-to-hcl.test.ts json-to-hcl.test.ts: Added test for variable bool and string default value. Jun 22, 2025
Added sensitive = false
@XIAOLONGLII XIAOLONGLII changed the title json-to-hcl.test.ts: Added test for variable bool and string default value. Added tests for bool and string variable contain default and sensitive false value. Jun 22, 2025
handle falsy primitives (false, 0, "") 
1. at the top-level (early check),
2. and inside the type === "simple" block with the fallback


This ensures values like false don’t silently get dropped.
Added unit tests for: 
false
0
""
null
@XIAOLONGLII XIAOLONGLII changed the title Added tests for bool and string variable contain default and sensitive false value. Fix cdktf synth --hcl fails to render false(bool), 0(int), ""(empty string) Jun 22, 2025
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.

cdktf: synth --hcl fails to render false(bool), 0(int), ""(empty string)
1 participant