Skip to content

Commit 4a1bd1e

Browse files
authored
Feat: port changes from PR #73 and #87 (#90)
- Add support for the '-parallelism' terraform argument (#73) - Exclude 'TF_LOG' from the environment variables passed to the terraform subprocess (#87)
1 parent 4bbedb4 commit 4a1bd1e

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

test/test_args.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,7 @@ def test_var_args():
156156
def test_targets():
157157
assert tftest.parse_args(targets=['one', 'two']) == sorted(
158158
['-target=one', '-target=two'])
159+
160+
161+
def test_parallelism_arg():
162+
assert tftest.parse_args(parallelism=10) == ['-parallelism', 10]

tftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ def parse_args(init_vars=None, tf_vars=None, targets=None, **kw):
9090
cmd_args.append(flag)
9191

9292
kv_flags = {
93+
'parallelism': '-parallelism',
9394
'plugin_dir': '-plugin-dir',
9495
'state': '-state',
9596
}
@@ -286,7 +287,7 @@ def __init__(self, tfdir, basedir=None, binary='terraform', env=None,
286287
self.binary = binary
287288
self.tfdir = self._abspath(tfdir)
288289
self._env = env or {}
289-
self.env = os.environ.copy()
290+
self.env = {k: v for k, v in os.environ.items() if k != 'TF_LOG'}
290291
self._plan_formatter = lambda out: TerraformPlanOutput(json.loads(out))
291292
self._output_formatter = lambda out: TerraformValueDict(json.loads(out))
292293
self.enable_cache = enable_cache

0 commit comments

Comments
 (0)