diff --git a/main.tf b/main.tf index 8a2e90ce..042e1ce9 100644 --- a/main.tf +++ b/main.tf @@ -182,37 +182,37 @@ EOF locals { lambda_logging_policy = { - "Version": "2012-10-17", - "Statement": [ + "Version" : "2012-10-17", + "Statement" : [ { - "Action": [ + "Action" : [ "logs:CreateLogStream", "logs:PutLogEvents" ], - "Resource": "${aws_cloudwatch_log_group.this.arn}", - "Effect": "Allow" + "Resource" : aws_cloudwatch_log_group.this.arn, + "Effect" : "Allow" } ] } lambda_logging_and_kms_policy = { - "Version": "2012-10-17", - "Statement": [ + "Version" : "2012-10-17", + "Statement" : [ { - "Action": [ + "Action" : [ "logs:CreateLogStream", "logs:PutLogEvents" ], - "Resource": "${aws_cloudwatch_log_group.this.arn}", - "Effect": "Allow" + "Resource" : aws_cloudwatch_log_group.this.arn, + "Effect" : "Allow" }, { - "Action": [ + "Action" : [ "kms:Encrypt", "kms:Decrypt", "kms:CreateGrant" ], - "Resource": "${var.kms_key_arn}", - "Effect": "Allow" + "Resource" : var.kms_key_arn, + "Effect" : "Allow" } ] } @@ -235,18 +235,18 @@ resource "aws_iam_role_policy" "lambda_logging" { data "archive_file" "this" { type = "zip" source_dir = "${path.module}/package/" - output_path = "${path.module}/aws-stop-start-resources-3.0.1.zip" # The version should match with the latest git tag + output_path = "${path.module}/aws-stop-start-resources-3.0.1.zip" # The version should match with the latest git tag } # Create Lambda function for stop or start aws resources resource "aws_lambda_function" "this" { - filename = data.archive_file.this.output_path - function_name = var.name - role = var.custom_iam_role_arn == null ? aws_iam_role.this[0].arn : var.custom_iam_role_arn - handler = "scheduler.main.lambda_handler" - runtime = "python3.7" - timeout = "600" - kms_key_arn = var.kms_key_arn == null ? "" : var.kms_key_arn + filename = data.archive_file.this.output_path + function_name = var.name + role = var.custom_iam_role_arn == null ? aws_iam_role.this[0].arn : var.custom_iam_role_arn + handler = "scheduler.main.lambda_handler" + runtime = "python3.7" + timeout = "600" + kms_key_arn = var.kms_key_arn == null ? "" : var.kms_key_arn environment { variables = { diff --git a/variables.tf b/variables.tf index 42944d62..db3e3495 100644 --- a/variables.tf +++ b/variables.tf @@ -74,6 +74,6 @@ variable "cloudwatch_alarm_schedule" { variable "tags" { description = "Custom tags on lambda" - type = map - default = null + type = map(any) + default = null }