Skip to content

Instantly share code, notes, and snippets.

@chrisguitarguy
Last active February 17, 2021 19:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save chrisguitarguy/4bcfddaad9b7a745323ade341f132e2d to your computer and use it in GitHub Desktop.
Save chrisguitarguy/4bcfddaad9b7a745323ade341f132e2d to your computer and use it in GitHub Desktop.
Terraform configuration for an Evident.io IAM Role
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"
}
@eseaberg
Copy link

eseaberg commented Aug 2, 2018

typo for sts:ExternalId?

@slmingol
Copy link

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