terragrunt: Can not set variable to null in Terragrunt inputs

This needs investigation, but we were seeing some behavior where if you try to use null as one of the variable values in inputs, terragrunt translates it as the string "null" by the time it gets to terraform.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 23
  • Comments: 26 (5 by maintainers)

Most upvoted comments

Same problem , trying to pass null to input for certain environments

You can use this approach to sort out the null approach avoiding to pass null values to the inputs (if you are using default values inputs in your modules, else it would fail)

inputs = {
  for key, val in {
    # ... your inputs ...
  } :
  key => val if val != null
}

Thanks @yorinasub17 for this tip!

Hello @denis256, thank you for the update. Just fetched the latest version of Terragrunt for our project and saw that terragrunt init now always generates an empty .terragrunt-null-vars.auto.tfvars.json file in the repository even though we are only using hcl configs for our projects without empty inputs. Is there an option to deactivate the generation of the file with the help of a cli-flag or configuration similar to the skip_region_validation when generating the provider block?

I ran into this today.

This is implicit type coercion, and it would help to produce at least a warning message until passing nulls to inputs is supported.

We’re running into this problem as well.

Edit: Creating a terraform.tfvars file and setting the value to null there worked for me.