Last active
February 17, 2021 19:45
-
-
Save chrisguitarguy/4bcfddaad9b7a745323ade341f132e2d to your computer and use it in GitHub Desktop.
Terraform configuration for an Evident.io IAM Role
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 "evident_account" { | |
type = "string" | |
} | |
variable "evident_id" { | |
type = "string" | |
} | |
data "aws_iam_policy_document" "evident" { | |
statement { | |
sid = "AllowEvidentExternalAccess" | |
effect = "Allow" | |
actions = ["sts:AssumeRole"] | |
principals { | |
type = "AWS" | |
identifiers = ["arn:aws:iam::${var.evident_account}:root"] | |
} | |
condition { | |
test = "StringEquals" | |
variable = "sts:ExternalId" | |
values = ["${var.evident_id}"] | |
} | |
} | |
} | |
resource "aws_iam_role" "evident" { | |
name = "Evident-Service-Role" | |
assume_role_policy = "${data.aws_iam_policy_document.evident.json}" | |
} | |
resource "aws_iam_role_policy_attachment" "evident_security" { | |
role = "${aws_iam_role.evident.name}" | |
policy_arn = "arn:aws:iam::aws:policy/SecurityAudit" | |
} |
Confirming that the above works w/ the typo fixed. I've forked this gist as well which includes the fix.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
typo for
sts:ExternalId
?