Skip to content

Commit

Permalink
refactor(terraform): apply terraform fmt
Browse files Browse the repository at this point in the history
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.

#12
  • Loading branch information
diodonfrost committed Dec 4, 2020
1 parent 68a2827 commit a51e4d6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
42 changes: 21 additions & 21 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
}
Expand All @@ -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 = {
Expand Down
4 changes: 2 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ variable "cloudwatch_alarm_schedule" {

variable "tags" {
description = "Custom tags on lambda"
type = map
default = null
type = map(any)
default = null
}

0 comments on commit a51e4d6

Please sign in to comment.