diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..3ed53c5 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,30 @@ +# EditorConfig is awesome: http://EditorConfig.org +# Uses editorconfig to maintain consistent coding styles + +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = true +max_line_length = 80 +trim_trailing_whitespace = true + +[*.py] +indent_size = 4 +indent_style = space + +[*.{tf,tfvars}] +indent_size = 2 +indent_style = space + +[*.md] +max_line_length = 0 +trim_trailing_whitespace = false + +[COMMIT_EDITMSG] +max_line_length = 0 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..bf2f0c1 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,11 @@ +--- +repos: + - repo: git://github.com/antonbabenko/pre-commit-terraform + rev: v1.31.0 + hooks: + - id: terraform_fmt + - id: terraform_docs + - repo: git://github.com/pre-commit/pre-commit-hooks + rev: v3.1.0 + hooks: + - id: check-merge-conflict diff --git a/main.tf b/main.tf index 2a4756b..03bca5d 100644 --- a/main.tf +++ b/main.tf @@ -1,8 +1,7 @@ data "external" "lambda_archive" { - program = ["python3", "${path.module}/scripts/build_lambda.py"] - query = { - src_dir = var.src_dir - output_path = var.output_path - install_dependencies = var.install_dependencies - } -} \ No newline at end of file + program = ["python3", "${path.module}/scripts/build_lambda.py"] + query = { + src_dir = "${var.src_dir}" + output_path = "${var.output_path}" + } +} diff --git a/outputs.tf b/outputs.tf index a3c69c6..7717e5b 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1,9 +1,9 @@ output "archive_path" { - description = "Path of the archive file." - value = data.external.lambda_archive.result.archive + description = "Path of the archive file." + value = "${data.external.lambda_archive.result.archive}" } output "source_code_hash" { - description = "Base64 encoded SHA256 hash of the archive file." - value = data.external.lambda_archive.result.base64sha256 -} \ No newline at end of file + description = "Base64 encoded SHA256 hash of the archive file." + value = "${data.external.lambda_archive.result.base64sha256}" +} diff --git a/scripts/build_lambda.py b/scripts/build_lambda.py index 10b6911..27c4d4e 100644 --- a/scripts/build_lambda.py +++ b/scripts/build_lambda.py @@ -73,4 +73,4 @@ def get_hash(output_path): query = json.loads(sys.stdin.read()) logging.debug(query) archive = build(query['src_dir'], query['output_path'], query['install_dependencies']) - print(json.dumps({'archive': archive, 'base64sha256':get_hash(archive)})) \ No newline at end of file + print(json.dumps({'archive': archive, 'base64sha256':get_hash(archive)})) diff --git a/variables.tf b/variables.tf index 2561775..1142226 100644 --- a/variables.tf +++ b/variables.tf @@ -1,15 +1,15 @@ variable "src_dir" { - description = "Path to root of Python source to package." - type = string + description = "Path to root of Python source to package." + type = "string" } variable "output_path" { - description = "The output of the archive file." - type = string + description = "The output of the archive file." + type = "string" } variable "install_dependencies" { - description = "Whether to install pip dependecies" - type = bool - default = true -} \ No newline at end of file + description = "Whether to install pip dependecies" + type = bool + default = true +}