Commit 4e8654d1 authored by Chris Merrett's avatar Chris Merrett

Potential fix for broken scheduling, linted

parent aed242ed
Pipeline #4934 passed with stage
in 17 seconds
...@@ -36,34 +36,40 @@ variable "cloudwatch_schedule" { ...@@ -36,34 +36,40 @@ variable "cloudwatch_schedule" {
############################################################################################################# #############################################################################################################
data "aws_iam_policy_document" "policy" { data "aws_iam_policy_document" "policy" {
statement { statement {
effect = "Allow" effect = "Allow"
actions = [
actions = [
"logs:*", "logs:*",
] ]
resources = [ resources = [
"arn:aws:logs:*:*:*", "arn:aws:logs:*:*:*",
] ]
} }
statement { statement {
effect = "Allow" effect = "Allow"
actions = [
actions = [
"ec2:Describe*", "ec2:Describe*",
] ]
resources = [ resources = [
"*", "*",
] ]
} }
statement { statement {
effect = "Allow" effect = "Allow"
actions = [
actions = [
"ec2:CreateSnapshot", "ec2:CreateSnapshot",
"ec2:DeleteSnapshot", "ec2:DeleteSnapshot",
"ec2:CreateTags", "ec2:CreateTags",
"ec2:ModifySnapshotAttribute", "ec2:ModifySnapshotAttribute",
"ec2:ResetSnapshotAttribute", "ec2:ResetSnapshotAttribute",
] ]
resources = [ resources = [
"*", "*",
] ]
...@@ -72,11 +78,13 @@ data "aws_iam_policy_document" "policy" { ...@@ -72,11 +78,13 @@ data "aws_iam_policy_document" "policy" {
data "aws_iam_policy_document" "trust" { data "aws_iam_policy_document" "trust" {
statement { statement {
effect = "Allow" effect = "Allow"
principals { principals {
type = "Service" type = "Service"
identifiers = ["lambda.amazonaws.com"] identifiers = ["lambda.amazonaws.com"]
} }
actions = [ actions = [
"sts:AssumeRole", "sts:AssumeRole",
] ]
...@@ -122,6 +130,7 @@ resource "aws_lambda_permission" "main" { ...@@ -122,6 +130,7 @@ resource "aws_lambda_permission" "main" {
action = "lambda:InvokeFunction" action = "lambda:InvokeFunction"
function_name = "${aws_lambda_function.main.arn}" function_name = "${aws_lambda_function.main.arn}"
principal = "events.amazonaws.com" principal = "events.amazonaws.com"
source_arn = "${aws_cloudwatch_event_rule.main.arn}"
} }
############################################################################################################# #############################################################################################################
...@@ -134,6 +143,7 @@ resource "aws_cloudwatch_event_rule" "main" { ...@@ -134,6 +143,7 @@ resource "aws_cloudwatch_event_rule" "main" {
} }
resource "aws_cloudwatch_event_target" "main" { resource "aws_cloudwatch_event_target" "main" {
rule = "${aws_cloudwatch_event_rule.main.name}" rule = "${aws_cloudwatch_event_rule.main.name}"
arn = "${aws_lambda_function.main.arn}" arn = "${aws_lambda_function.main.arn}"
target_id = "${aws_lambda_function.main.function_name}"
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment