Skip to content

Instantly share code, notes, and snippets.

@PrashantBhatasana
Created March 26, 2021 06:55
Show Gist options
  • Save PrashantBhatasana/ca78f0b4082b666d87095cb20ef3e04f to your computer and use it in GitHub Desktop.
Save PrashantBhatasana/ca78f0b4082b666d87095cb20ef3e04f to your computer and use it in GitHub Desktop.
resource "aws_iam_role" "inspector_event_role" {
name = "inspector-event-role-${var.random_id_prefix}"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
"Service": "events.amazonaws.com"
},
"Effect": "Allow",
"Sid": ""
}
]
}
EOF
}
data "aws_iam_policy_document" "inspector_event_role_policy" {
statement {
sid = "StartAssessment"
actions = [
"inspector:StartAssessmentRun",
]
resources = [
"*"
]
}
}
resource "aws_iam_role_policy" "inspector_event" {
name = "inspector-event-policy-${var.random_id_prefix}"
role = aws_iam_role.inspector_event_role.id
policy = data.aws_iam_policy_document.inspector_event_role_policy.json
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment