Skip to content

Commit 04d255d

Browse files
committed
(Chore) Shorten IAM role / policy names
* IAM roles have a maximum of 64 characters. * `${var.name}` and `${var.environment}` are injected into the resource names. Shortening the rest of the name allows longer var.name and var.environment
1 parent a5b4439 commit 04d255d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

main.tf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## ECS task exectution role
22

33
resource "aws_iam_role" "scheduled_task_ecs_execution" {
4-
name = "${var.name}-${var.environment}-scheduled-task-ecs-execution-role"
4+
name = "${var.name}-${var.environment}-st-ecs-execution-role"
55
assume_role_policy = "${file("${path.module}/policies/scheduled-task-ecs-execution-assume-role-policy.json")}"
66
}
77

@@ -10,22 +10,22 @@ data "template_file" "scheduled_task_ecs_execution_policy" {
1010
}
1111

1212
resource "aws_iam_role_policy" "scheduled_task_ecs_execution" {
13-
name = "${var.name}-${var.environment}-scheduled-task-ecs-execution-policy"
13+
name = "${var.name}-${var.environment}-st-ecs-execution-policy"
1414
role = "${aws_iam_role.scheduled_task_ecs_execution.id}"
1515
policy = "${data.template_file.scheduled_task_ecs_execution_policy.rendered}"
1616
}
1717

1818
## ECS task role
1919

2020
resource "aws_iam_role" "scheduled_task_ecs" {
21-
name = "${var.name}-${var.environment}-scheduled-task-ecs-role"
21+
name = "${var.name}-${var.environment}-st-ecs-role"
2222
assume_role_policy = "${file("${path.module}/policies/scheduled-task-ecs-assume-role-policy.json")}"
2323
}
2424

2525
## Cloudwatch event role
2626

2727
resource "aws_iam_role" "scheduled_task_cloudwatch" {
28-
name = "${var.name}-${var.environment}-scheduled-task-cloudwatch-role"
28+
name = "${var.name}-${var.environment}-st-cloudwatch-role"
2929
assume_role_policy = "${file("${path.module}/policies/scheduled-task-cloudwatch-assume-role-policy.json")}"
3030
}
3131

@@ -38,7 +38,7 @@ data "template_file" "scheduled_task_cloudwatch_policy" {
3838
}
3939

4040
resource "aws_iam_role_policy" "scheduled_task_cloudwatch_policy" {
41-
name = "${var.name}-${var.environment}-scheduled-task-cloudwatch-policy"
41+
name = "${var.name}-${var.environment}-st-cloudwatch-policy"
4242
role = "${aws_iam_role.scheduled_task_cloudwatch.id}"
4343
policy = "${data.template_file.scheduled_task_cloudwatch_policy.rendered}"
4444
}

0 commit comments

Comments
 (0)