<commit_before># Upgrading to Terragrunt 0.19.x

## Background

Terraform 0.12 was released in May, 2019, and it included a few major changes:

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.
1. 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 `${...}`).
   
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!




## Migration guide

The following sections outline the steps you may need to take in order to migrate from Terragrunt <= v0.18.x
to Terragrunt 0.19.x and newer:

1. [Move from terraform.tfvars to terragrunt.hcl](#move-from-terraformtfvars-to-terragrunthcl)
1. [Move input variables into inputs](#move-input-variables-into-inputs)
1. [Use first-class expressions](#use-first-class-expressions)
1. [Check attributes vs blocks usage](#check-attributes-vs-blocks-usage)
1. [Rename a few built-in functions ](#rename-a-few-built-in-functions)

   
### Move from terraform.tfvars to terragrunt.hcl

Since Terraform 0.12 has more strict rules about what can go into `terraform.tfvars` files, you now need to move your
Terragrunt configuration from `terraform.tfvars` to a `terragrunt.hcl` file, removing the `terragrunt = { ... }`<commit_msg>Add example PR with code changes to migration guide<commit_after># Upgrading to Terragrunt 0.19.x

## Background

Terraform 0.12 was released in May, 2019, and it included a few major changes:

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.
1. 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 `${...}`).
   
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!




## Migration guide

The following sections outline the steps you may need to take in order to migrate from Terragrunt <= v0.18.x
to Terragrunt 0.19.x and newer:

1. [Move from terraform.tfvars to terragrunt.hcl](#move-from-terraformtfvars-to-terragrunthcl)
1. [Move input variables into inputs](#move-input-variables-into-inputs)
1. [Use first-class expressions](#use-first-class-expressions)
1. [Check attributes vs blocks usage](#check-attributes-vs-blocks-usage)
1. [Rename a few built-in functions ](#rename-a-few-built-in-functions)

Check out [this PR in the terragrunt-infrastructure-live-example 
repo](https://github.com/gruntwork-io/terragrunt-infrastructure-live-example/pull/17) for an example of what the code 
changes look like. 

   
### Move from terraform.tfvars to terragrunt.hcl

Since Terraform 0.12 has more strict rules about what can go into `terraform.tfvars` files, you now need to move your
Terragrunt configuration from `terraform.tfvars` to a `terragrunt.hcl` file, removing the `terragrunt = { ... }`
{'fraction_non_alphanumeric': 0.08856088560885608, 'fraction_numerical': 0.019504480759093307, 'mean_word_length': 4.128378378378378, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '133536', 'n_tokens_mistral': 1175, 'n_tokens_neox': 1143, 'n_words': 502}