Skip to content

Commit

Permalink
support both lists and tuples in var-file arg (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludoo authored Dec 1, 2022
1 parent a28c310 commit e8b381b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 2 additions & 0 deletions test/test_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
({'upgrade': False}, []),
({'tf_var_file': None}, []),
({'tf_var_file': 'foo.tfvar'}, ['-var-file=foo.tfvar']),
({'tf_var_file': ['foo.tfvar', 'bar.tfvar']}, [
'-var-file=foo.tfvar', '-var-file=bar.tfvar']),
)


Expand Down
5 changes: 2 additions & 3 deletions tftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,8 @@ def parse_args(init_vars=None, tf_vars=None, targets=None, **kw):
cmd_args += [("-target={}".format(t)) for t in targets]
if kw.get('tf_var_file'):
tf_var_file = kw['tf_var_file']
if isinstance(tf_var_file, list):
for x in tf_var_file:
cmd_args.append('-var-file={}'.format(x))
if isinstance(tf_var_file, (list, tuple)):
cmd_args += ['-var-file={}'.format(v) for v in tf_var_file]
else:
cmd_args.append('-var-file={}'.format(tf_var_file))
return cmd_args
Expand Down

0 comments on commit e8b381b

Please sign in to comment.