From 4feceba04fe9f48fa3b162ec9a1c7a63e7c4c5a4 Mon Sep 17 00:00:00 2001 From: devsjc Date: Thu, 9 Nov 2023 16:52:33 +0000 Subject: [PATCH] Rename conflicting objects --- .../modules/services/nwp_consumer/cloudwatch.tf | 7 +------ terraform/modules/services/nwp_consumer/iam.tf | 14 ++------------ 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/terraform/modules/services/nwp_consumer/cloudwatch.tf b/terraform/modules/services/nwp_consumer/cloudwatch.tf index 4a649943..6d242e9b 100644 --- a/terraform/modules/services/nwp_consumer/cloudwatch.tf +++ b/terraform/modules/services/nwp_consumer/cloudwatch.tf @@ -3,7 +3,7 @@ # 2. IAM policy to allow read and write to cloudwatch logs locals { - log_group_name = "/aws/ecs/${var.ecs-task_type}/${var.ecs-task_name}/" + log_group_name = "/aws/ecs/${var.ecs-task_type}/${var.ecs-task_name}" } # 1. @@ -17,11 +17,6 @@ resource "aws_cloudwatch_log_group" "log_group" { } } -moved { - from = aws_cloudwatch_log_group.nwp - to = aws_cloudwatch_log_group.log_group -} - # Describe actions of IAM policy allowing cloudwatch read and write data "aws_iam_policy_document" "log_policy" { statement { diff --git a/terraform/modules/services/nwp_consumer/iam.tf b/terraform/modules/services/nwp_consumer/iam.tf index ba15f7b3..d21933b0 100644 --- a/terraform/modules/services/nwp_consumer/iam.tf +++ b/terraform/modules/services/nwp_consumer/iam.tf @@ -18,15 +18,10 @@ data "aws_iam_policy_document" "ecs_assume_role_policy" { // Create Task Role ------------------------------------------------------ resource "aws_iam_role" "create_task_role" { - name = "${var.ecs-task_name}-execution-role" + name = "${var.ecs-task_type}-${var.ecs-task_name}-execution-role" assume_role_policy = data.aws_iam_policy_document.ecs_assume_role_policy.json } -moved { - from = aws_iam_role.ecs_task_execution_role - to = aws_iam_role.create_task_role -} - resource "aws_iam_role_policy_attachment" "create_task_policy" { role = aws_iam_role.create_task_role.name policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy" @@ -45,16 +40,11 @@ resource "aws_iam_role_policy_attachment" "create_secret_policy" { // Run Task Role --------------------------------------------------------- resource "aws_iam_role" "run_task_role" { - name = "${var.ecs-task_type}-${var.ecs-task_name}-iam-role" + name = "${var.ecs-task_type}-${var.ecs-task_name}-instance-role" path = "/${var.ecs-task_type}/" assume_role_policy = data.aws_iam_policy_document.ecs_assume_role_policy.json } -moved { - from = aws_iam_role.consumer-nwp-iam-role - to = aws_iam_role.run_task_role -} - # For every bucket in the list of buckets, attach its access policy to the run task role resource "aws_iam_role_policy_attachment" "access_s3_policy" { for_each = {