hashicorp / terraform-cdk

Define infrastructure resources using programming constructs and provision them using HashiCorp Terraform
https://www.terraform.io/cdktf
Mozilla Public License 2.0
4.88k stars 455 forks source link

terraform-cdk-go: able to override and remove a key completely from generated cdk.tf.json #3751

Open arjunkarnwal opened 1 month ago

arjunkarnwal commented 1 month ago

Description

In its current form, there is no way for the developers to remove a particular field from the generated cdk.tf.json. e.g.

"terraform": {
    "backend" : "XX"
    "required_providers": {
      "datadog": {
        "source": "DataDog/datadog",
        "version": "3.37.0"
      }
    }
  }

There is no way where I can completely remove backend from the generated json file.

The functionality provided right now to override

cdkStack.AddOverride("terraform.backend", "")

will set the backend with a "" value but not completely remove. Moreover nil can not be passed as argument.

Passing nil is supported in the terraform-cdk-typescript which completely removes the given key but is not supported in terraform-cdk-go.

References

No response

Help Wanted

Community Note