Skip to content

Commit fa81eae

Browse files
committed
Replaced deprecated null_data_source objects with local.null
1 parent b643ed4 commit fa81eae

File tree

6 files changed

+16
-15
lines changed

6 files changed

+16
-15
lines changed

data.tf

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,12 @@
1-
data "null_data_source" "wait_for_lambda_build" {
2-
for_each = local.lambdas
3-
4-
inputs = {
5-
lambda_build_id = null_resource.lambda_build[each.key].id
6-
source = "${path.module}/lambdas/bin/${each.key}"
7-
}
8-
}
9-
101
data "archive_file" "this" {
11-
for_each = local.lambdas
2+
depends_on = [null_resource.lambda_build]
3+
for_each = local.lambdas
124

135
type = "zip"
14-
source_file = data.null_data_source.wait_for_lambda_build[each.key].outputs["source"]
6+
source_file = local.null.lambda_binary_locations[each.key]
157
output_path = "${path.module}/archive/${each.key}.zip"
168
}
179

18-
1910
data "aws_iam_policy_document" "this" {
2011
statement {
2112
actions = ["sts:AssumeRole"]

examples/outputs.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
output "saw_command" {
2+
value = "saw watch ${module.eventbridge_debug_logger.cloudwatch_log_group_name} --expand"
3+
}

locals.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,9 @@ locals {
77
timeout = 10
88
}
99
}
10+
11+
null = {
12+
lambda_binary_exists = { for key, _ in local.lambdas : key => fileexists("${path.module}/lambdas/bin/${key}") }
13+
lambda_binary_locations = { for key, _ in local.lambdas : key => "${path.module}/lambdas/bin/${key}" }
14+
}
1015
}

outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
output "cloudwatch_log_group_name" {
22
description = "Name of cloudwatch log group which holds service-specific log events."
3-
value = aws_cloudwatch_log_group.this.name
3+
value = aws_cloudwatch_log_group.this["events_debug_logger"].name
44
}

r_cloudwatch.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
resource "aws_cloudwatch_log_group" "this" {
2-
name = "/aws/lambda/${var.name}/${local.service_name}"
2+
for_each = local.lambdas
3+
4+
name = "/aws/lambda/${each.key}_${local.service_name}"
35
retention_in_days = var.lambda_logs_retention_in_days
46
tags = var.tags
57
}

r_lambda.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ resource "null_resource" "lambda_build" {
22
for_each = local.lambdas
33

44
triggers = {
5-
binary_exists = fileexists("${path.module}/lambdas/bin/${each.key}")
5+
binary_exists = local.null.lambda_binary_exists[each.key]
66

77
main = join("", [
88
for file in fileset("${path.module}/lambdas/cmd/${each.key}", "*.go") : filebase64("${path.module}/lambdas/cmd/${each.key}/${file}")

0 commit comments

Comments
 (0)