Skip to content

Commit

Permalink
Merge pull request #48 from draios/pasa/event-bridge/add-cloudwatch-s…
Browse files Browse the repository at this point in the history
…tate

fix(event-bridge): Add state in cloudwatch event rule resource (SSPROD-34617, SSPROD-34618)
  • Loading branch information
matteopasa authored Dec 18, 2023
2 parents 794cb58 + 74ed88c commit caf6f7b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions modules/services/event-bridge/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ resource "aws_cloudwatch_event_rule" "sysdig" {
name = var.name
description = "Capture all CloudTrail events"
tags = var.tags
state = var.rule_state

event_pattern = <<EOF
{
Expand Down
2 changes: 2 additions & 0 deletions modules/services/event-bridge/organizational.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Resources:
- 'AWS API Call via CloudTrail'
- 'AWS Console Sign In via CloudTrail'
- 'AWS Service Event via CloudTrail'
State: ${var.rule_state}
Targets:
- Id: ${var.name}
Arn: ${var.target_event_bus_arn}
Expand Down Expand Up @@ -72,6 +73,7 @@ Resources:
- 'AWS API Call via CloudTrail'
- 'AWS Console Sign In via CloudTrail'
- 'AWS Service Event via CloudTrail'
State: ${var.rule_state}
Targets:
- Id: ${var.name}
Arn: ${var.target_event_bus_arn}
Expand Down
6 changes: 6 additions & 0 deletions modules/services/event-bridge/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,9 @@ variable "external_id" {
type = string
description = "Random string generated unique to a customer"
}

variable "rule_state" {
type = string
description = "State of the rule. When state is ENABLED, the rule is enabled for all events except those delivered by CloudTrail. To also enable the rule for events delivered by CloudTrail, set state to ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS."
default = "ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS"
}
2 changes: 1 addition & 1 deletion modules/services/event-bridge/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.39.0"
version = ">= 5.27.0"
}
}
}

0 comments on commit caf6f7b

Please sign in to comment.