1
1
2
- # # Provision the ECS Cluster used to run the task
2
+ # # Provision the ECS Cluster used to run the task
3
3
# tfsec:ignore:aws-ecs-enable-container-insight
4
4
resource "aws_ecs_cluster" "current" {
5
5
name = var. ecs_cluster_name
@@ -11,13 +11,13 @@ resource "aws_ecs_cluster" "current" {
11
11
}
12
12
}
13
13
14
- # # Provision the ECS execution IAM role; this is used by the task to execute within
14
+ # # Provision the ECS execution IAM role; this is used by the task to execute within
15
15
# # the ECS cluster
16
16
resource "aws_iam_role" "execution" {
17
17
for_each = var. tasks
18
18
19
19
description = format (" Used by the ECS task to execute within the ECS cluster by the nuke service: '%s'" , each. key )
20
- name = format (" %s%s" , var. iam_execution_role_prefix , each. key )
20
+ name_prefix = format (" %s%s" , var. iam_execution_role_prefix , each. key )
21
21
tags = var. tags
22
22
23
23
assume_role_policy = jsonencode ({
@@ -34,12 +34,12 @@ resource "aws_iam_role" "execution" {
34
34
})
35
35
}
36
36
37
- # # Provision a role for the task to use, this is used to perform actions and remove
37
+ # # Provision a role for the task to use, this is used to perform actions and remove
38
38
resource "aws_iam_role" "task" {
39
39
for_each = var. tasks
40
40
41
41
description = format (" Permissions for the ECS nuke task: '%s' to run under" , each. key )
42
- name = format (" %s%s" , var. iam_task_role_prefix , each. key )
42
+ name_prefix = format (" %s%s" , var. iam_task_role_prefix , each. key )
43
43
permissions_boundary = each. value . permission_boundary_arn
44
44
tags = var. tags
45
45
@@ -57,7 +57,7 @@ resource "aws_iam_role" "task" {
57
57
})
58
58
}
59
59
60
- # # Attach any managed polices to the task role - i.e the permissions which the task can
60
+ # # Attach any managed polices to the task role - i.e the permissions which the task can
61
61
# # perform within the AWS account/s
62
62
resource "aws_iam_role_policy_attachment" "task_permissions_arns" {
63
63
for_each = local. task_permissions_arns
@@ -66,7 +66,7 @@ resource "aws_iam_role_policy_attachment" "task_permissions_arns" {
66
66
policy_arn = each. value . permission_arn
67
67
}
68
68
69
- # # Allow any additional permissions to be attached to the task role - these are inline
69
+ # # Allow any additional permissions to be attached to the task role - these are inline
70
70
# # policies applied to the task
71
71
resource "aws_iam_role_policy" "task_additional_permissions" {
72
72
for_each = local. task_additional_permissions
@@ -84,7 +84,7 @@ resource "aws_iam_role_policy_attachment" "execution" {
84
84
role = aws_iam_role. execution [each . key ]. name
85
85
}
86
86
87
- # # Allow the ECS task access to the ECR repository to pull the image
87
+ # # Allow the ECS task access to the ECR repository to pull the image
88
88
resource "aws_iam_role_policy" "execution_ecr" {
89
89
for_each = var. tasks
90
90
@@ -104,7 +104,7 @@ resource "aws_iam_role_policy" "execution_ecr" {
104
104
})
105
105
}
106
106
107
- # # Allow the ECS task to retrieve the secret from the secrets manager
107
+ # # Allow the ECS task to retrieve the secret from the secrets manager
108
108
resource "aws_iam_role_policy" "execution_secrets" {
109
109
for_each = var. tasks
110
110
@@ -126,8 +126,8 @@ resource "aws_iam_role_policy" "execution_secrets" {
126
126
})
127
127
}
128
128
129
- # # Provision the task definition for the nuke (aws-nuke) to remove all the resources,
130
- # # Also, we mount the secret from secrets manager to the task
129
+ # # Provision the task definition for the nuke (aws-nuke) to remove all the resources,
130
+ # # Also, we mount the secret from secrets manager to the task
131
131
resource "aws_ecs_task_definition" "tasks" {
132
132
for_each = var. tasks
133
133
0 commit comments