Skip to content

Commit 4e90919

Browse files
author
Jan Sebastian Siwy
authored
Merge pull request #33 from babbel/default-tags
Breaking change: Rename `var.tags` to `var.default_tags`
2 parents daedf5d + 6249c9b commit 4e90919

File tree

4 files changed

+14
-19
lines changed

4 files changed

+14
-19
lines changed

README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,5 @@ module "lambda" {
2323
}
2424
2525
source_dir = "lambda/src"
26-
27-
tags = {
28-
app = "example"
29-
env = "production"
30-
}
3126
}
3227
```

_test/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module "lambda" {
2020

2121
source_dir = "lambda/src"
2222

23-
tags = {
23+
default_tags = {
2424
app = "example"
2525
env = "production"
2626
}

main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ resource "aws_lambda_function" "this" {
3434
filename = try(var.archive_file.output_path, data.archive_file.this[0].output_path)
3535
source_code_hash = try(var.archive_file.output_base64sha256, data.archive_file.this[0].output_base64sha256)
3636

37-
tags = var.tags
37+
tags = var.default_tags
3838

3939
depends_on = [
4040
aws_cloudwatch_log_group.this,
@@ -57,7 +57,7 @@ resource "aws_iam_role" "this" {
5757

5858
assume_role_policy = data.aws_iam_policy_document.lambda-assume-role.json
5959

60-
tags = var.tags
60+
tags = var.default_tags
6161
}
6262

6363
data "aws_iam_policy_document" "lambda-assume-role" {
@@ -84,7 +84,7 @@ resource "aws_cloudwatch_log_group" "this" {
8484

8585
retention_in_days = var.cloudwatch_log_group_retention_in_days
8686

87-
tags = var.tags
87+
tags = var.default_tags
8888
}
8989

9090
data "aws_iam_policy_document" "cloudwatch-log-group" {
@@ -116,7 +116,7 @@ resource "aws_security_group" "this" {
116116

117117
tags = merge({
118118
Name = "Lambda: ${var.function_name}"
119-
}, var.tags)
119+
}, var.default_tags)
120120

121121
lifecycle {
122122
create_before_destroy = true

variables.tf

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ The number of days to retain the log of the Lambda function.
1919
EOS
2020
}
2121

22+
variable "default_tags" {
23+
type = map(string)
24+
default = {}
25+
26+
description = <<EOS
27+
Map of tags assigned to all AWS resources created by this module.
28+
EOS
29+
}
30+
2231
variable "description" {
2332
type = string
2433

@@ -107,15 +116,6 @@ Path of the directory which shall be packed as code of the Lambda function. Conf
107116
EOS
108117
}
109118

110-
variable "tags" {
111-
type = map(string)
112-
default = {}
113-
114-
description = <<EOS
115-
Map of tags assigned to all AWS resources created by this module.
116-
EOS
117-
}
118-
119119
variable "timeout" {
120120
type = number
121121

0 commit comments

Comments
 (0)