Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
13 changes: 6 additions & 7 deletions main.tf
Original file line number Diff line number Diff line change
@@ -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
}
}
program = ["python3", "${path.module}/scripts/build_lambda.py"]
query = {
src_dir = "${var.src_dir}"
output_path = "${var.output_path}"
}
}
10 changes: 5 additions & 5 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -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
}
description = "Base64 encoded SHA256 hash of the archive file."
value = "${data.external.lambda_archive.result.base64sha256}"
}
2 changes: 1 addition & 1 deletion scripts/build_lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)}))
print(json.dumps({'archive': archive, 'base64sha256':get_hash(archive)}))
16 changes: 8 additions & 8 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -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
}
description = "Whether to install pip dependecies"
type = bool
default = true
}