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

cdktf: hcl render failing resource(""); locals, variable in false(bool), 0(int), ""(str) value #3673

Open
1 task
tenminus11 opened this issue Jul 18, 2024 · 0 comments
Labels
bug Something isn't working new Un-triaged issue

Comments

@tenminus11
Copy link

tenminus11 commented Jul 18, 2024

resource with "" empty string does not render in hcl
variable default value 0,false,"" does not render in hcl
local with value 0,false,"" does not render in hcl

Expected Behavior

locals {
  local_bool: false,
  local_num: 0,
  local_str: ""
}

variable "var_str" {
  type = string
  default: "",
}

variable "var_bool" {
  type = bool
  default: false,
}

variable "var_num" {
  type = number
  default: 0,
}
resource "google_compute_network" "nw_vpc" {
  auto_create_subnetworks = false
  description             = ""
  mtu                     = 0
  name                    = "vpc-network"
}

Actual Behavior

locals {

}

variable "var_str" {
  type = string
}

variable "var_bool" {
  type = bool
}

variable "var_num" {
  type = number
}
resource "google_compute_network" "nw_vpc" {
  auto_create_subnetworks = false
  description             =
  mtu                     = 0
  name                    = "vpc-network"
}

Steps to Reproduce


        TerraformVariable(
            self,
            "var_str",
            default="",
            type="string",
        )
        TerraformVariable(
            self,
            "var_bool",
            default=False,
            type="bool",
        )
        TerraformVariable(
            self,
            "var_num",
            default=0,
            type="number",
        )
        TerraformLocal(
            self,
            "local_str",
            ""
        )
        TerraformLocal(
            self,
            "local_num",
            0
        )
        TerraformLocal(
            self,
            "local_bool",
            False
        )
        ComputeNetwork(
            self,
            "nw_vpc",
            name="vpc-network",
            description="",
            auto_create_subnetworks=False,
            mtu=0
        )

Versions

cdktf debug
language: python
cdktf-cli: 0.20.8
node: v20.12.2
cdktf: 0.20.8
constructs: 10.3.0
jsii: 1.101.0
terraform: 1.9.2
arch: x64
os: linux 6.6.15-2rodete2-amd64
python: Python 3.11.8
pip: pip 24.0 from /xxx/.local/share/virtualenvs/cdktf-bug-xGaVuY_f/lib/python3.11/site-packages/pip (python 3.11)
pipenv: pipenv, version 2023.12.1
providers
cdktf-cdktf-provider-google (PREBUILT)
terraform provider version: 5.38.0
prebuilt provider version: 13.27.0
cdktf version: ^0.20.0

Providers

┌───────────────┬──────────────────┬─────────┬────────────┬─────────────────────────────┬─────────────────┐
│ Provider Name │ Provider Version │ CDKTF │ Constraint │ Package Name │ Package Version │
├───────────────┼──────────────────┼─────────┼────────────┼─────────────────────────────┼─────────────────┤
│ google │ 5.38.0 │ ^0.20.0 │ │ cdktf-cdktf-provider-google │ 13.27.0 │
└───────────────┴──────────────────┴─────────┴────────────┴─────────────────────────────┴─────────────────┘

Gist

No response

Possible Solutions

removing might solve resource empty string

Workarounds

No response

Anything Else?

No response

References

#3626
#3621

#3655 partly solved the issue, just for modules

Help Wanted

  • I'm interested in contributing a fix myself

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue 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 issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working new Un-triaged issue
Projects
None yet
Development

No branches or pull requests

1 participant