Skip to content

Commit b80c922

Browse files
committed
feat: Add var.task_execution_session_duration for task execution role
1 parent bc9c79b commit b80c922

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ allow_github_webhooks = true
376376
| <a name="input_start_timeout"></a> [start\_timeout](#input\_start\_timeout) | Time duration (in seconds) to wait before giving up on resolving dependencies for a container | `number` | `30` | no |
377377
| <a name="input_stop_timeout"></a> [stop\_timeout](#input\_stop\_timeout) | Time duration (in seconds) to wait before the container is forcefully killed if it doesn't exit normally on its own | `number` | `30` | no |
378378
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to use on all resources | `map(string)` | `{}` | no |
379+
| <a name="input_task_execution_session_duration"></a> [tags](#input\_task\_execution\_session\_duration) | Maximum session duration for ecs task execution role in hours | `number` | `1` | no |
379380
| <a name="input_trusted_entities"></a> [trusted\_entities](#input\_trusted\_entities) | A list of users or roles, that can assume the task role | `list(string)` | `[]` | no |
380381
| <a name="input_trusted_principals"></a> [trusted\_principals](#input\_trusted\_principals) | A list of principals, in addition to ecs-tasks.amazonaws.com, that can assume the task role | `list(string)` | `[]` | no |
381382
| <a name="input_ulimits"></a> [ulimits](#input\_ulimits) | Container ulimit settings. This is a list of maps, where each map should contain "name", "hardLimit" and "softLimit" | <pre>list(object({<br> name = string<br> hardLimit = number<br> softLimit = number<br> }))</pre> | `null` | no |

main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@ data "aws_iam_policy_document" "ecs_tasks" {
436436
resource "aws_iam_role" "ecs_task_execution" {
437437
name = "${var.name}-ecs_task_execution"
438438
assume_role_policy = data.aws_iam_policy_document.ecs_tasks.json
439+
max_session_duration = var.task_execution_session_duration
439440
permissions_boundary = var.permissions_boundary
440441

441442
tags = local.tags

variables.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,3 +672,14 @@ variable "ephemeral_storage_size" {
672672
error_message = "The minimum supported value is 21 GiB and the maximum supported value is 200 GiB."
673673
}
674674
}
675+
676+
variable "task_execution_session_duration" {
677+
description = "Maximum session duration for ecs task execution role in hours."
678+
type = number
679+
default = 1
680+
681+
validation {
682+
condition = var.task_execution_session_duration >= 1 && var.task_execution_session_duration <= 12
683+
error_message = "Valid session durations for an IAM role are between 1 and 12 hours."
684+
}
685+
}

0 commit comments

Comments
 (0)