Skip to content

Commit ce5bac8

Browse files
committed
Enforce JSON parsing for Terraform aggregate types 'list' and 'map'.
1 parent 5d65779 commit ce5bac8

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

pre_commit_hooks/terraform_inputs_jenkins_pipeline_params.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,8 @@ def transform_terraform_input_var_to_tfvars_json(input):
6767

6868
result = 'tfvars.%s = ' % name
6969

70-
if input['Default'] is not None:
71-
if type(input['Default']) == dict:
72-
# Was a default value provided?
73-
if input['Default']['Value'] != '':
74-
# Is it a complex value?
75-
if type(input['Default']['Value']) in [dict, list]:
76-
result += 'readJSON text: '
70+
if input['Type'] in ['list', 'map']:
71+
result += 'readJSON text: '
7772

7873
result += 'params.' + name
7974
return result

0 commit comments

Comments
 (0)