File tree Expand file tree Collapse file tree
eventbridge-schedule-to-cloudwatch-terraform Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,8 +18,6 @@ provider "aws" {
1818
1919data "aws_caller_identity" "current" {}
2020
21-
22-
2321# This section creates cron schedules using Amazon EventBridge Scheduler, as well as the required IAM roles to interact with CloudWatch
2422
2523resource "aws_scheduler_schedule" "cloudwatch-schedule" {
@@ -55,7 +53,6 @@ resource "aws_scheduler_schedule" "cloudwatch-schedule" {
5553 }
5654}
5755
58-
5956resource "aws_iam_policy" "scheduler_cloudwatch_policy" {
6057 name = " scheduler_cloudwatch_policy"
6158
@@ -77,7 +74,6 @@ resource "aws_iam_policy" "scheduler_cloudwatch_policy" {
7774
7875resource "aws_iam_role" "scheduler-cloudwatch-role" {
7976 name = " scheduler-cloudwatch-role"
80- managed_policy_arns = [aws_iam_policy . scheduler_cloudwatch_policy . arn ]
8177
8278 assume_role_policy = jsonencode ({
8379 Version = " 2012-10-17"
@@ -92,4 +88,9 @@ resource "aws_iam_role" "scheduler-cloudwatch-role" {
9288 },
9389 ]
9490 })
95- }
91+ }
92+
93+ resource "aws_iam_role_policy_attachment" "scheduler_cloudwatch_attachment" {
94+ role = aws_iam_role. scheduler-cloudwatch-role . name
95+ policy_arn = aws_iam_policy. scheduler_cloudwatch_policy . arn
96+ }
You can’t perform that action at this time.
0 commit comments