file_pathstring
The file to read. A relative path resolves from the unit’s directory, even in an included file. A path ending in json is read as JSON, any other as a .tfvars file.
read_tfvars_file(file_path: string) --> stringread_tfvars_file returns a JSON string, so decode it with jsondecode to use the variables:
locals { common = jsondecode(read_tfvars_file("common.tfvars"))}
inputs = merge(local.common, { instance_type = "t3.micro"})It fails when the file doesn’t exist. Terragrunt records the file as read, so --queue-include-units-reading and reading= filters find the unit.
The file to read. A relative path resolves from the unit’s directory, even in an included file. A path ending in json is read as JSON, any other as a .tfvars file.
locals { tfvars = read_tfvars_file("common.tfvars") # "{\"region\":\"us-east-1\"}"}