Skip to content

Commit 2f8187c

Browse files
tbugfindermetmajer
authored andcommitted
Add support for Terraform 0.12 using terraform-docs12 Helper (#4)
* drop python2 support * Currently terraform-docs v0.6.0 does not support HCL2 (terraform 0.12) code. Wrappers were built pre-processing those HCL2 files so that terraform-docs can be used. A python3 script is available and needed as a prereq to this hook. https://raw.githubusercontent.com/marcuscaisey/.dotfiles/master/scripts/terraform-docs12 * include terraform-docs12 dependancy
1 parent 7f52cae commit 2f8187c

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ This project contains some useful hooks for https://pre-commit.com.
66

77
The `terraform_inputs_jenkins_pipeline_params` hook supports the definition of a [Declarative Jenkins Pipeline](https://jenkins.io/doc/book/pipeline/syntax/#declarative-pipeline)'s [parameters](https://jenkins.io/doc/book/pipeline/syntax/#parameters) from your [Terraform Input Variables](https://www.terraform.io/intro/getting-started/variables.html).
88

9-
*Note:* Requires [segmentio/terraform-docs](https://github.com/segmentio/terraform-docs) >= v0.4.0.
9+
*Note:*
10+
1. Requires [segmentio/terraform-docs](https://github.com/segmentio/terraform-docs) >= v0.4.0.
11+
2. Requires [terraform-docs12](https://raw.githubusercontent.com/marcuscaisey/.dotfiles/master/scripts/terraform-docs12)
1012

1113
### Sample Usage
1214

pre_commit_hooks/terraform_inputs_jenkins_pipeline_params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
def get_terraform_input_vars(terraform_files):
2121
try:
22-
raw_json = subprocess.check_output(['terraform-docs', '--no-sort', '--with-aggregate-type-defaults', 'json'] + terraform_files)
22+
raw_json = subprocess.check_output(['terraform-docs12', '--no-sort', '--with-aggregate-type-defaults', 'json'] + terraform_files)
2323
except subprocess.CalledProcessError:
2424
raw_json = '{ "Inputs": [] }'
2525

setup.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
classifiers=[
1515
'License :: OSI Approved :: MIT License',
16-
'Programming Language :: Python :: 2',
17-
'Programming Language :: Python :: 2.7',
1816
'Programming Language :: Python :: 3',
1917
'Programming Language :: Python :: 3.6',
2018
'Programming Language :: Python :: 3.7',

0 commit comments

Comments
 (0)