Skip to content

Commit

Permalink
Increase the assume-role token expiry time to 8 hours (28800 seconds)
Browse files Browse the repository at this point in the history
- AWS recently increased the assume-role session token expiry time to a
  maximum of 12 hours. This makes our sessions last for eight hours, the
  length of the working day, to avoid having to re-assume role multiple
  times a day. This is done via the `max_session_duration` parameter on
  `aws_iam_role` as implemented in the AWS terraform provider v0.14.0.
- This will revert the changes I made in
  #498, and I'll have to
  change the docs again, but it makes it simpler in the long run - you
  only have to remember an `assume-role` command, not also
  `get-session-token`.
  • Loading branch information
Isabell (Issy) Long committed Apr 11, 2018
1 parent ce12a1c commit 6afe8f4
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions terraform/modules/aws/iam/role_user/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,6 @@ data "aws_iam_policy_document" "assume_policy_document" {
"true",
]
}

condition {
test = "NumericLessThan"
variable = "aws:MultiFactorAuthAge"

values = [
"43200",
]
}
}
}

Expand All @@ -79,11 +70,12 @@ locals {
}

resource "aws_iam_role" "user_role" {
count = "${local.create_role}"
name = "${var.role_name}"
path = "/"
description = "Role to Delegate Permissions to an IAM User: ${var.role_name}"
assume_role_policy = "${data.aws_iam_policy_document.assume_policy_document.json}"
count = "${local.create_role}"
name = "${var.role_name}"
path = "/"
description = "Role to Delegate Permissions to an IAM User: ${var.role_name}"
assume_role_policy = "${data.aws_iam_policy_document.assume_policy_document.json}"
max_session_duration = 28800
}

resource "aws_iam_role_policy_attachment" "user_policy_attachment" {
Expand Down

0 comments on commit 6afe8f4

Please sign in to comment.