Skip to content

Commit

Permalink
Add tf string checking
Browse files Browse the repository at this point in the history
  • Loading branch information
lakkeger committed Oct 6, 2023
1 parent dc6cd80 commit 69c90b2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion bin/tflocal
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def filter_configs(configs: dict) -> dict:
def generate_additional_configs(configs, indent=1) -> str:
result = ""
for argument, value in configs.items():
if isinstance(value, str):
if isinstance(value, str) and not check_tf_string(value):
value = f'"{value}"'

if isinstance(value, list):
Expand Down Expand Up @@ -398,6 +398,15 @@ def run_tf_subprocess(cmd, env):
PROCESS.communicate()
sys.exit(PROCESS.returncode)

def check_tf_string (expr: str) -> bool:
tf_prefixes = ("var.", "data.", "local.", "module.", "output.")
if expr in ("true","false"):
return True
if expr.startswith(tf_prefixes):
return True
if "(" in expr:
return True
return False

# ---
# UTIL FUNCTIONS
Expand Down

0 comments on commit 69c90b2

Please sign in to comment.