From df985efea751bde6cf0c1617c9baaa55a39ea9f5 Mon Sep 17 00:00:00 2001 From: Sean Turner Date: Sat, 22 May 2021 17:34:52 +1200 Subject: [PATCH] Replaced local.path with path.module --- README.md | 2 +- data.tf | 4 ++-- locals.tf | 2 +- r_lambda.tf | 14 +++++++------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 0b37fab..a9ae516 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ This solution utilises the following services: ```hcl module "moot" { - source = "github.com/seanturner026/moot.git?ref=v1.0.0" + source = "github.com/seanturner026/moot.git" name = "moot" admin_user_email = var.admin_user_email diff --git a/data.tf b/data.tf index a4d6de4..5ca63fb 100644 --- a/data.tf +++ b/data.tf @@ -24,8 +24,8 @@ data "archive_file" "this" { depends_on = [null_resource.lambda_build] type = "zip" - source_file = "${local.path}/bin/${each.key}" - output_path = "${local.path}/archive/${each.key}.zip" + source_file = "${path.module}/bin/${each.key}" + output_path = "${path.module}/archive/${each.key}.zip" } data "aws_iam_policy_document" "role" { diff --git a/locals.tf b/locals.tf index 0b0997e..7478c67 100644 --- a/locals.tf +++ b/locals.tf @@ -21,7 +21,7 @@ locals { } null = { - lambda_binary_exists = { for key, _ in local.lambdas : key => fileexists("${local.path}/bin/${key}") } + lambda_binary_exists = { for key, _ in local.lambdas : key => fileexists("${path.module}/bin/${key}") } } frontend_module_comprehension = [for module in jsondecode(file("${path.root}/.terraform/modules/modules.json"))["Modules"] : module if length(regexall("vuejs_frontend", module.Key)) > 0][0] diff --git a/r_lambda.tf b/r_lambda.tf index bc1057b..f2a2641 100644 --- a/r_lambda.tf +++ b/r_lambda.tf @@ -5,11 +5,11 @@ resource "null_resource" "lambda_build" { binary_exists = local.null.lambda_binary_exists[each.key] main = join("", [ - for file in fileset("${local.path}/cmd/${each.key}", "*.go") : filebase64("${local.path}/cmd/${each.key}/${file}") + for file in fileset("${path.module}/cmd/${each.key}", "*.go") : filebase64("${path.module}/cmd/${each.key}/${file}") ]) util = join("", [ - for file in fileset("${local.path}/internal/util", "*.go") : filebase64("${local.path}/internal/util/${file}") + for file in fileset("${path.module}/internal/util", "*.go") : filebase64("${path.module}/internal/util/${file}") ]) } @@ -18,7 +18,7 @@ resource "null_resource" "lambda_build" { } provisioner "local-exec" { - command = "GOOS=linux go build -ldflags '-s -w' -o ${local.path}/bin/${each.key} ${local.path}/cmd/${each.key}/." + command = "GOOS=linux go build -ldflags '-s -w' -o ${path.module}/bin/${each.key} ${path.module}/cmd/${each.key}/." } } @@ -27,16 +27,16 @@ resource "null_resource" "lambda_test" { triggers = { main = join("", [ - for file in fileset("${local.path}/cmd/${each.key}", "*.go") : filebase64("${local.path}/cmd/${each.key}/${file}") + for file in fileset("${path.module}/cmd/${each.key}", "*.go") : filebase64("${path.module}/cmd/${each.key}/${file}") ]) util = join("", [ - for file in fileset("${local.path}/internal/util", "*.go") : filebase64("${local.path}/internal/util/${file}") + for file in fileset("${path.module}/internal/util", "*.go") : filebase64("${path.module}/internal/util/${file}") ]) } provisioner "local-exec" { - command = "go test ${local.path}/cmd/${each.key}" + command = "go test ${path.module}/cmd/${each.key}" } } @@ -44,7 +44,7 @@ resource "aws_lambda_function" "this" { depends_on = [null_resource.lambda_build, null_resource.lambda_test] for_each = local.lambdas - filename = "${local.path}/archive/${each.key}.zip" + filename = "${path.module}/archive/${each.key}.zip" function_name = "${var.name}_${each.key}" description = each.value.description role = aws_iam_role.this[each.key].arn