Skip to content

Commit 0d34e47

Browse files
committed
feat: update ecs module to use organization ECS creation module
1 parent 7923d27 commit 0d34e47

File tree

3 files changed

+5
-14
lines changed

3 files changed

+5
-14
lines changed

modules/ecs/main.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
resource "aws_ecs_cluster" "this" {
2-
name = var.cluster_name
1+
module "ecs_cluster" {
2+
source = "github.com/infraspecdev/terraform-aws-ecs?ref=main"
3+
cluster_name = "atlantis"
34
}
45

56
resource "random_pet" "name" {
@@ -30,7 +31,7 @@ resource "aws_launch_template" "this" {
3031

3132
user_data = base64encode(<<EOF
3233
#!/bin/bash
33-
echo ECS_CLUSTER=${aws_ecs_cluster.this.name} >> /etc/ecs/ecs.config
34+
echo ECS_CLUSTER=${module.ecs_cluster.cluster_arn} >> /etc/ecs/ecs.config
3435
EOF
3536
)
3637

@@ -72,7 +73,7 @@ resource "aws_autoscaling_group" "this" {
7273

7374
resource "aws_ecs_service" "this" {
7475
name = var.service_name
75-
cluster = aws_ecs_cluster.this.name
76+
cluster = module.ecs_cluster.cluster_arn
7677
launch_type = var.launch_type.type
7778
task_definition = aws_ecs_task_definition.this.arn
7879
desired_count = var.service_desired_count

modules/ecs/outputs.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
output "ecs_cluster_name" {
2-
description = "The name of the ECS cluster"
3-
value = aws_ecs_cluster.this.name
4-
}
5-
61
output "ecs_service_name" {
72
description = "The name of the ECS service"
83
value = aws_ecs_service.this.name

outputs.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ output "alb_dns_name" {
33
value = module.alb.alb_dns_name
44
}
55

6-
output "ecs_cluster_name" {
7-
description = "The name of the ECS cluster"
8-
value = module.ecs.ecs_cluster_name
9-
}
10-
116
output "ecs_service_name" {
127
description = "The name of the ECS service"
138
value = module.ecs.ecs_service_name

0 commit comments

Comments
 (0)