Skip to content

Commit

Permalink
Use a relative path to prevent spurious terraform changes.
Browse files Browse the repository at this point in the history
The terraform filename parameter encodes an absolute path to the module,
which can be different when run on different machines. This changes it
to key on a relative path, per the recommendation here:

hashicorp/terraform#7613 (comment)
  • Loading branch information
umbrant committed Apr 29, 2019
1 parent 6760d52 commit 959bad6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion terraform/lambda.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@ locals {
sg_ids = ["${element(concat(aws_security_group.lambda.*.id, list("")), 0)}"]
}

data "null_data_source" "lambda_file" {
inputs {
filename = "${substr("${path.module}/es-cleanup.zip", length(path.cwd) + 1, -1)}"

}
}

resource "aws_lambda_function" "es_cleanup" {
filename = "${path.module}/es-cleanup.zip"
filename = "${data.null_data_source.lambda_file.outputs.filename}"
function_name = "${var.prefix}es-cleanup${var.suffix}"
description = "${var.prefix}es-cleanup${var.suffix}"
timeout = 300
Expand Down

0 comments on commit 959bad6

Please sign in to comment.