Difference between terrafrom code in '.tfvars' file vs '.hcl' file

Good day all.
I am a newbie in Terragrunt and pardon me for asking such a basic question.
I am wondering what is the difference of putting terragrunt code in ‘.tfvars’ file under 'terragrunt block and inside ‘.hcl’ file. Is it mandatory to use ‘.hcl’ file in latest version or something?!

Thank you!

  • Terragrunt 0.19.0 and above will only work with Terraform 0.12.0 and above.
  1. More strict rules around what can go in a .tfvars file.
    In particular, any variable defined in a .tfvars file that does not match a corresponding variable definition in your .tf files produces an error.

  2. A shift from HCL to HCL2 as the main syntax.
    This included support for first-class expressions (i.e., using variables and functions without having to wrap everything in ${…}).

  3. Before version 0.19.0, Terragrunt had you define its configuration in a terragrunt = { … } variable in a terraform.tfvars file,
    but due to item (1) this no longer works with Terraform 0.12 and newer.
    That means we had to move to a new file format.
    This requires a migration, which is unfortunate, but as a nice benefit, item (2) gives us a nicer syntax and new functionality!

    Detailed explanation can be found in the following link.


Hi Sanoop,

Glad you got it figured out!