Skip to content

Commit e5c71e0

Browse files
committed
Added more samples to examples/simple/main.tf
1 parent 9233798 commit e5c71e0

File tree

2 files changed

+173
-7
lines changed

2 files changed

+173
-7
lines changed

examples/fixtures/dirtree.sh

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
# vim:ts=4:noet
3+
4+
n=/dev/null
5+
d=${1:-dirtree}
6+
mf(){ if [[ "$1" =~ ^.+/$ ]]; then mkdir -p "$1"; else mkdir -p "$(dirname "$1")"; echo "$1" > "$1"; fi;}
7+
8+
mkdir "$d"
9+
pushd $_ >$n
10+
11+
mf abc/a1
12+
mf abc/a2
13+
mf abc/empty/
14+
mf abc/def/foo/bar1
15+
mf abc/def/foo/bar2
16+
mf abc/def/ghk/b1
17+
mf abc/def/ghk/b2
18+
mf abc/def/ghk/bbb8
19+
mf abc/def/ghk/bbb9
20+
mf abc/def/zum/bar0
21+
mf abc/def/zum/bar9
22+
23+
mf abc/def/ghk/mul/bar/fiv99
24+
mf abc/def/ghk/mul/bar/zi---11
25+
26+
popd >$n
27+
find "$d"
28+
tree "$d"

examples/simple/main.tf

+145-7
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,144 @@ module "lambda_function" {
7373
// }
7474
// }
7575

76-
source_path = "${path.module}/../fixtures/python3.8-app1/"
76+
// source_path = "${path.module}/../fixtures/python3.8-app1/"
77+
78+
// source_path = [
79+
// "${path.module}/../fixtures/python3.8-app1/index.py",
80+
// {
81+
// pip_requirements = "${path.module}/../fixtures/python3.8-app1/requirements.txt"
82+
// prefix_in_zip = "vendor"
83+
// }
84+
// ]
85+
86+
// source_path = [
87+
// "${path.module}/../fixtures/python3.8-app1/index.py",
88+
// "${path.module}/../fixtures/python3.8-app1/dir1/dir2",
89+
// {
90+
// pip_requirements = "${path.module}/../fixtures/python3.8-app1/requirements.txt"
91+
// }
92+
// ]
93+
94+
// source_path = [
95+
// {
96+
// path = "${path.module}/../fixtures/python3.8-app1"
97+
// }
98+
// ]
99+
100+
// source_path = [
101+
// {
102+
// path = "${path.module}/../fixtures/python3.8-app1"
103+
// pip_requirements = false
104+
// }
105+
// ]
106+
107+
// source_path = [
108+
// {
109+
// path = "${path.module}/../fixtures/python3.8-app1"
110+
// pip_requirements = true
111+
// }
112+
// ]
113+
114+
// source_path = [
115+
// {
116+
// path = "${path.module}/../fixtures/python3.8-app1"
117+
// commands = [
118+
// ":zip",
119+
// "cd `mktemp -d`",
120+
// "pip install --target=. -r ${path.module}/../fixtures/python3.8-app1/requirements.txt",
121+
// ":zip . vendor/",
122+
// ]
123+
// patterns = [
124+
// "!vendor/colorful-0.5.4.dist-info/RECORD",
125+
// "!vendor/colorful-.+.dist-info/.*",
126+
// "!vendor/colorful/__pycache__/?.*",
127+
// ]
128+
// }
129+
// ]
130+
131+
source_path = [
132+
// {
133+
// pip_requirements = "${path.module}/../fixtures/python3.8-app1/requirements.txt"
134+
// pip_requirements = "${path.module}/../deploy/requirements.txt"
135+
// },
136+
"${path.module}/../fixtures/python3.8-app1/index.py",
137+
// {
138+
// path = "${path.module}/../fixtures/python3.8-app1/index.py"
139+
// patterns = <<END
140+
// # To use comments in heredoc patterns set the env var:
141+
// # export TF_LAMBDA_PACKAGE_PATTERN_COMMENTS=true
142+
// # The intent for comments just to use in examples and demo snippets.
143+
// # To write a comment start it with double spaces and the # sign
144+
// # if it follows a pattern.
145+
//
146+
// !index\.py # Exclude a file with 'index.py' name
147+
// index\..* # Re-include
148+
// END
149+
// },
150+
// {
151+
// path = "${path.module}/../fixtures/dirtree"
152+
// // prefix_in_zip = "vendor"
153+
// patterns = <<END
154+
// # To see step by step output how files and folders was skipped or added
155+
// # set an env var in your shell by a command similar to:
156+
// # export TF_LAMBDA_PACKAGE_LOG_LEVEL=DEBUG
157+
//
158+
// # To play with this demo pattern you can go to a ../fixtures folder
159+
// # and run there a dirtree.sh script to create a demo dirs tree
160+
// # matchable by following patterns.
161+
//
162+
// # !abc/.* # Filter out everything in an abc folder with the folder itself
163+
// # !abc/.+ # Filter out just all folder's content but keep the folder even if it's empty
164+
// abc/def/.* # Re-include everything in abc/def sub folder
165+
// # !abc/def/ghk/.* # Filter out again in abc/def/ghk sub folder
166+
// !.*/fiv.*
167+
// !.*/zi--.*
168+
//
169+
// ########################################################################
170+
// # Special cases
171+
//
172+
// # !.*/ # Removes all explicit directories from a zip file, mean while
173+
// # the zip file still valid and unpacks correctly but will not
174+
// # contain any empty directories.
175+
//
176+
// # !.*/bar/ # To remove just some directory use more qualified path to it.
177+
//
178+
// # !([^/]+/){3,} # Remove all directories more than 3 folders in depth.
179+
// END
180+
// }
181+
]
182+
183+
// source_path = [
184+
// {
185+
// // path = "${path.module}/../fixtures/python3.8-app1"
186+
//
187+
// // pip_requirements = true
188+
// pip_requirements = "${path.module}/../fixtures/python3.8-app1/requirements.txt"
189+
// prefix_in_zip = "vendor"
190+
// // commands = ["pip install -r requirements.txt"]
191+
//
192+
// // patterns = <<END
193+
// // !.*/.*\.txt # Filter all txt files recursively
194+
// // node_modules/.* # Include empty dir or with a content if it exists
195+
// // node_modules/.+ # Include full non empty node_modules dir with its content
196+
// // node_modules/ # Include node_modules itself without its content
197+
// // # It's also a way to include an empty dir if it exists
198+
// // node_modules # Include a file or an existing dir only
199+
// //
200+
// // !abc/.* # Filter out everything in an abc folder
201+
// // abc/def/.* # Re-include everything in abc/def sub folder
202+
// // !abc/def/ghk/.* # Filter out again in abc/def/ghk sub folder
203+
// // END
204+
//
205+
// patterns = [
206+
// "**/*.txt",
207+
// "",
208+
// "",
209+
// ]
210+
// },
211+
//
212+
// ]
213+
77214
// source_path = [
78215
// "${path.module}/../fixtures/python3.8-app1-extra",
79216
// {
@@ -127,7 +264,7 @@ module "lambda_function" {
127264
//
128265
// !abc/.* # Filter out everything in an abc folder
129266
// abc/def/.* # Re-include everything in abc/def sub folder
130-
// !abc/def/hgk/* # Filter out again in abc/def/hgk sub folder
267+
// !abc/def/ghk/* # Filter out again in abc/def/ghk sub folder
131268
// END
132269
// },
133270
// {
@@ -138,11 +275,12 @@ module "lambda_function" {
138275
// }
139276
// ]
140277

141-
// build_in_docker = true
142-
// docker_file = "${path.module}/../fixtures/python3.8-app1/docker/Dockerfile"
143-
// docker_build_root = "${path.module}/../../docker"
144-
// #docker_image = "lambci/lambda:build-python3.8"
145-
// #docker_with_ssh_agent = true
278+
// build_in_docker = true
279+
// docker_pip_cache = true
280+
// docker_with_ssh_agent = true
281+
// docker_file = "${path.module}/../fixtures/python3.8-app1/docker/Dockerfile"
282+
// docker_build_root = "${path.module}/../../docker"
283+
// docker_image = "lambci/lambda:build-python3.8"
146284
}
147285

148286
####

0 commit comments

Comments
 (0)