-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathmain.tf
66 lines (52 loc) · 1.14 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
terraform {
required_version = ">= 0.12.0"
}
variable "empty_dirs" {
type = bool
default = false
}
variable "enabled" {
type = bool
default = true
}
variable "output_path" {
type = string
}
variable "search" {
type = list(string)
default = []
}
variable "source_dir" {
type = string
}
data "external" "archive" {
count = var.enabled ? 1 : 0
program = ["python", "${path.module}/zip.py"]
query = {
empty_dirs = jsonencode(var.empty_dirs)
source_dir = var.source_dir
output_path = var.output_path
search = jsonencode(var.search)
}
}
output "output_md5" {
value = var.enabled ? data.external.archive[0].result.output_md5 : ""
}
output "output_path" {
value = var.output_path
}
output "output_sha" {
value = var.enabled ? data.external.archive[0].result.output_sha : ""
}
output "output_base64sha256" {
value = var.enabled ? data.external.archive[0].result.output_base64sha256 : ""
}
output "search" {
value = var.search
}
output "search_results" {
value = jsondecode(var.enabled ? data.external.archive[0].result.search_results : "[]")
}
output "source_dir" {
value = var.source_dir
}