From a51e4d6c3cb1c57c17bec28a76612e9df598e698 Mon Sep 17 00:00:00 2001 From: diodonfrost Date: Fri, 4 Dec 2020 10:20:19 +0100 Subject: [PATCH] refactor(terraform): apply terraform fmt The terraform fmt command is used to rewrite Terraform configuration files to a canonical format and style. This command applies a subset of the Terraform language style conventions, along with other minor adjustments for readability. This commit apply terraform fmt command to fix deprecated interpolation syntax and code indentation. https://github.com/diodonfrost/terraform-aws-lambda-scheduler-stop-start/issues/12 --- main.tf | 42 +++++++++++++++++++++--------------------- variables.tf | 4 ++-- 2 files changed, 23 insertions(+), 23 deletions(-) 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 }