File tree Expand file tree Collapse file tree 4 files changed +14
-19
lines changed Expand file tree Collapse file tree 4 files changed +14
-19
lines changed Original file line number Diff line number Diff 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```
Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff 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
6363data "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
9090data "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
Original file line number Diff line number Diff line change @@ -19,6 +19,15 @@ The number of days to retain the log of the Lambda function.
1919EOS
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+
2231variable "description" {
2332 type = string
2433
@@ -107,15 +116,6 @@ Path of the directory which shall be packed as code of the Lambda function. Conf
107116EOS
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-
119119variable "timeout" {
120120 type = number
121121
You can’t perform that action at this time.
0 commit comments