1- resource "template_file" "this" {
2- template = " ${ file (" ${ path . module } /src/params.json" )} "
3-
4- vars {
5- BUCKET_NAME = " ${ var . bucketName } "
6- BUCKET_KEY = " ${ var . bucketKey } "
7- COOKIE_DOMAIN = " ${ var . cookieDomain } "
8- }
9- }
1+ // resource "template_file" "this" {
2+ // template = file("${path.module}/src/params.json")
3+ //
4+ // vars = {
5+ // BUCKET_NAME = var.bucketName
6+ // BUCKET_KEY = var.bucketKey
7+ // COOKIE_DOMAIN = var.cookieDomain
8+ // }
9+ // }
1010
1111resource "local_file" "params" {
12- content = " ${ template_file . this . rendered } "
12+ // content = template_file.this.rendered
13+ content = templatefile (" ${ path . module } /src/params.json" , {
14+ BUCKET_NAME = var.bucketName
15+ BUCKET_KEY = var.bucketKey
16+ COOKIE_DOMAIN = var.cookieDomain
17+ })
18+
1319 filename = " ${ path . module } /.archive/params.json"
1420}
1521
@@ -18,33 +24,34 @@ data "local_file" "mainjs" {
1824}
1925
2026resource "local_file" "mainjs" {
21- content = " ${ data . local_file . mainjs . content } "
27+ content = data. local_file . mainjs . content
2228 filename = " ${ path . module } /.archive/main.js"
2329}
2430
2531data "archive_file" "this" {
2632 depends_on = [
27- " local_file.params" ,
28- " local_file.mainjs"
33+ local_file . params ,
34+ local_file . mainjs ,
2935 ]
3036
31- type = " zip"
37+ type = " zip"
3238 output_path = " ${ path . module } /.archive.zip"
33- source_dir = " ${ path . module } /.archive"
39+ source_dir = " ${ path . module } /.archive"
3440}
3541
3642resource "aws_lambda_function" "this" {
3743 description = " Basic HTTP authentication module/function"
38- role = " ${ aws_iam_role . this . arn } "
39- runtime = " nodejs8.10"
44+ role = aws_iam_role. this . arn
45+ runtime = " nodejs8.10"
4046
41- filename = " ${ data . archive_file . this . output_path } "
42- source_code_hash = " ${ data . archive_file . this . output_base64sha256 } "
47+ filename = data. archive_file . this . output_path
48+ source_code_hash = data. archive_file . this . output_base64sha256
4349
44- function_name = " ${ var . name } "
45- handler = " main.handler"
50+ function_name = var. name
51+ handler = " main.handler"
4652
47- timeout = " ${ var . fn_timeout } "
48- memory_size = " ${ var . fn_memory_size } "
49- publish = true
53+ timeout = var. fn_timeout
54+ memory_size = var. fn_memory_size
55+ publish = true
5056}
57+
0 commit comments