You can use terraform file() function to read the content of a file in terraform. file() reads the contents of a file at the given path and returns them as a string.
Syntax: file(file_path)
Example:
1 2 3 4 5 6 7 8 9 |
## create a file with some content echo 'locals { name = "debjeet" }' > main.tf ## Open terraform console terraform console ## Get the content of a file file("main.tf") ## returns "locals { name = "debjeet" }" |