Skip to content

Commit 5b5ce10

Browse files
committed
Removing duplicated resource. fix #2
1 parent 06ec5e7 commit 5b5ce10

File tree

4 files changed

+6
-27
lines changed

4 files changed

+6
-27
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Check the section "Other modules that you may need to use this module" for detai
3636
* event_rule_name: The rule's name.
3737
* event_target_ecs_target_subnets: The subnets associated with the task or service.
3838
* event_target_ecs_target_task_definition_arn: The ARN of the task definition to use if the event target is an Amazon ECS cluster.
39+
* ecs_execution_task_role_arn: (Required) The task definition execution role.
3940
* event_rule_schedule_expression: (Required, if event_pattern isn't specified) The scheduling expression. For example, cron(0 20 * * ? *) or rate(5 minutes).
4041
* event_rule_event_pattern: (Required, if schedule_expression isn't specified) Event pattern described a JSON object. See full documentation of CloudWatch Events and Event Patterns for details.
4142
* event_rule_description: (Optional) The description of the rule.

files/iam/ecs_task_execution_iam_role.json

Lines changed: 0 additions & 13 deletions
This file was deleted.

main.tf

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,6 @@ provider "aws" {
66
region = var.region
77
}
88

9-
# ---------------------------------------------------------------------------------------------------------------------
10-
# AWS ECS Task Execution Role
11-
# ---------------------------------------------------------------------------------------------------------------------
12-
resource "aws_iam_role" "ecs_task_execution_role" {
13-
name = "${var.name_preffix}-ecs-task-execution-role"
14-
assume_role_policy = file("${path.module}/files/iam/ecs_task_execution_iam_role.json")
15-
}
16-
17-
resource "aws_iam_role_policy_attachment" "ecs_task_execution_role_policy_attach" {
18-
role = aws_iam_role.ecs_task_execution_role.name
19-
policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy"
20-
}
21-
229
# ---------------------------------------------------------------------------------------------------------------------
2310
# CLOUDWATCH EVENT ROLE
2411
# ---------------------------------------------------------------------------------------------------------------------
@@ -30,7 +17,7 @@ resource "aws_iam_role" "scheduled_task_cw_event_role" {
3017
data "template_file" "scheduled_task_cw_event_role_cloudwatch_policy" {
3118
template = "${file("${path.module}/files/iam/scheduled_task_cw_event_role_cloudwatch_policy.json")}"
3219
vars = {
33-
TASK_EXECUTION_ROLE_ARN = aws_iam_role.ecs_task_execution_role.arn
20+
TASK_EXECUTION_ROLE_ARN = var.ecs_execution_task_role_arn
3421
}
3522
}
3623

variables.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ variable "event_target_ecs_target_task_definition_arn" {
6565
description = "(Required) The ARN of the task definition to use if the event target is an Amazon ECS cluster."
6666
}
6767

68+
variable "ecs_execution_task_role_arn" {
69+
description = "(Required) The task definition execution role"
70+
}
71+
6872
variable "event_target_target_id" {
6973
description = "(Optional) The unique target assignment ID. If missing, will generate a random, unique id."
7074
default = null

0 commit comments

Comments
 (0)