Created
May 20, 2016 11:02
-
-
Save knakayama/611063f9641fc194daa1b5218b820857 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variable "region" { | |
default = "us-east-1" | |
} | |
provider "aws" { | |
region = "${var.region}" | |
} | |
resource "aws_cloudwatch_event_rule" "console" { | |
name = "capture-aws-sign-in" | |
description = "Capture each AWS Console Sign In" | |
event_pattern = <<EOT | |
{ | |
"detail-type": [ | |
"AWS Console Sign In via CloudTrail" | |
] | |
} | |
EOT | |
} | |
resource "aws_sns_topic" "aws_logins" { | |
name = "aws-console-logins" | |
} | |
resource "aws_cloudwatch_event_target" "sns" { | |
rule = "${aws_cloudwatch_event_rule.console.name}" | |
target_id = "SendToSNS" | |
arn = "${aws_sns_topic.aws_logins.arn}" | |
} | |
output "aws_sns_topic_arn" { | |
value = "${aws_sns_topic.aws_logins.arn}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment