File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed
Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ # Ignore Tera template files - they have specific syntax that Prettier doesn't understand
2+ * .tera
Original file line number Diff line number Diff line change @@ -61,3 +61,34 @@ instance_name = "{{ instance_name }}"
61612 . No spaces between braces and variable name: ` {{variable}} ` not ` { { variable } } `
62623 . Variable names are case-sensitive
63634 . Works in any file format (YAML, HCL, etc.)
64+
65+ ## 🔧 Troubleshooting
66+
67+ ### VS Code Prettier Extension Adding Spaces in Variables
68+
69+ ** Problem** : When using VS Code with the Prettier extension, saving ` .tera ` files automatically adds unwanted spaces inside Tera variables:
70+
71+ - ** Before saving** : ` {{ username }} ` ✅
72+ - ** After saving** : ` { { username } } ` ❌
73+
74+ ** Cause** : Prettier doesn't understand Tera template syntax and tries to format ` .tera ` files incorrectly.
75+
76+ ** Solution** : Create a ` .prettierignore ` file in your project root to exclude Tera template files:
77+
78+ ``` gitignore
79+ # Ignore Tera template files - they have specific syntax that Prettier doesn't understand
80+ *.tera
81+ ```
82+
83+ ** Alternative Solution** : Disable formatting for ` .tera ` files in your VS Code settings:
84+
85+ ``` json
86+ {
87+ "[tera]" : {
88+ "editor.formatOnSave" : false ,
89+ "editor.defaultFormatter" : null
90+ }
91+ }
92+ ```
93+
94+ After applying the fix, manually correct any existing formatting issues in your ` .tera ` files by removing the spaces inside the curly braces.
You can’t perform that action at this time.
0 commit comments