diff --git a/tofu/environments/stage/services/backend-service/terragrunt.hcl b/tofu/environments/stage/services/backend-service/terragrunt.hcl index 8387eec5e..4b26e0fb6 100644 --- a/tofu/environments/stage/services/backend-service/terragrunt.hcl +++ b/tofu/environments/stage/services/backend-service/terragrunt.hcl @@ -18,6 +18,7 @@ dependency "vpc" { mock_outputs_allowed_terraform_commands = ["init", "validate", "plan"] mock_outputs = { private_subnets = ["subnet-mocksubnet1234567"] + ecs_execution_role = "mockrolearn" } } @@ -50,5 +51,6 @@ inputs = { target_group_arn = dependency.backend-infra.outputs.target_group_arn security_group = dependency.backend-infra.outputs.security_group_id ecs_cluster = dependency.backend-infra.outputs.cluster_id + task_execution_role = dependency.vpc.outputs.ecs_execution_role tags = local.tags } \ No newline at end of file diff --git a/tofu/modules/network/vpc/outputs.tf b/tofu/modules/network/vpc/outputs.tf index 65dc4dcbf..a85f6ba46 100644 --- a/tofu/modules/network/vpc/outputs.tf +++ b/tofu/modules/network/vpc/outputs.tf @@ -32,4 +32,8 @@ output "secrets_endpoint_security_group" { output "logs_endpoint_security_group" { value = aws_security_group.logs_endpoint.id +} + +output "ecs_execution_role" { + value = module.ecs_task_execution_role.iam_role_arn } \ No newline at end of file diff --git a/tofu/modules/services/backend-service/main.tf b/tofu/modules/services/backend-service/main.tf index ec92a4ba3..49ae436a7 100644 --- a/tofu/modules/services/backend-service/main.tf +++ b/tofu/modules/services/backend-service/main.tf @@ -22,7 +22,7 @@ resource "aws_ecs_service" "backend_service" { resource "aws_ecs_task_definition" "backend" { family = "appointment-definition" - execution_role_arn = "arn:aws:iam::768512802988:role/apointments-ci-role" + execution_role_arn = var.task_execution_role network_mode = "awsvpc" requires_compatibilities = ["FARGATE"] cpu = "512" diff --git a/tofu/modules/services/backend-service/variables.tf b/tofu/modules/services/backend-service/variables.tf index 5a501953e..cf42aec36 100644 --- a/tofu/modules/services/backend-service/variables.tf +++ b/tofu/modules/services/backend-service/variables.tf @@ -41,4 +41,9 @@ variable "security_group" { variable "image" { description = "Backend Docker image" type = string +} + +variable "task_execution_role" { + description = "ECS task execution role" + type = string } \ No newline at end of file