Skip to content

Commit 80f916f

Browse files
working modules
1 parent b38abba commit 80f916f

29 files changed

+464
-846
lines changed

modules/health-check/json/container_definition.json.tftpl renamed to example/complete/container/container_definition.json.tftpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
"logConfiguration": {
1818
"logDriver": "awslogs",
1919
"options": {
20-
"awslogs-group": "/aws/ecs/${cluster_name_full}/${service_name_full}",
20+
"awslogs-group": "${log_group_name}",
2121
"awslogs-region": "${aws_region}",
22-
"awslogs-stream-prefix": "proxy"
22+
"awslogs-stream-prefix" : "ecs"
2323
}
2424
}
2525
}

example/complete/main.tf

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@ terraform {
1212
}
1313
}
1414

15+
provider "aws" {
16+
region = "us-east-1"
17+
}
18+
1519
################################################################################
1620
## ecs cluster
1721
################################################################################
1822

19-
module "ecs" {
20-
source = "../modules/ecs"
21-
22-
create = true
23+
module "ecs-cluster" {
24+
source = "../../modules/ecs-cluster"
2325

2426
ecs_cluster = {
2527
name = "arc-ecs-module-poc"
@@ -37,14 +39,11 @@ module "ecs" {
3739
}
3840

3941
capacity_provider = {
40-
autoscaling_capacity_providers = {}
42+
autoscaling_capacity_providers = {}
4143
default_capacity_provider_use_fargate = true
4244
fargate_capacity_providers = {
4345
fargate_cp = {
4446
name = "FARGATE"
45-
tags = {
46-
Environment = "develop"
47-
}
4847
}
4948
}
5049
}
@@ -62,7 +61,7 @@ module "ecs" {
6261
module "alb" {
6362
source = "../../modules/alb"
6463

65-
vpc_id = "vpc-12345"
64+
vpc_id = "vpc-123445"
6665

6766
alb = {
6867
name = "arc-poc-alb"
@@ -71,10 +70,11 @@ module "alb" {
7170
}
7271

7372
alb_target_group = [{
74-
name = "arc-poc-alb-tg"
75-
port = 80
76-
protocol = "HTTP"
77-
vpc_id = "vpc-12345"
73+
name = "arc-poc-alb-tg"
74+
port = 80
75+
protocol = "HTTP"
76+
vpc_id = "vpc-123445"
77+
target_type = "ip"
7878
health_check = {
7979
enabled = true
8080
path = "/"
@@ -86,30 +86,35 @@ module "alb" {
8686

8787

8888
################################################################################
89-
## health check service
89+
## ecs service
9090
################################################################################
9191

92-
module "health-check" {
93-
source = "../../modules/health-check"
92+
module "ecs-service" {
93+
source = "../../modules/ecs-service"
9494

95-
vpc_id = "vpc-12345"
95+
vpc_id = "vpc-123445"
9696
environment = "develop"
9797

9898
ecs = {
99-
cluster_name = module.ecs.ecs_cluster.name
100-
service_name = "arc-ecs-module-service-poc"
101-
repository_name = "12345.dkr.ecr.us-east-1.amazonaws.com/arc/arc-poc-ecs"
102-
enable_load_balancer = false
99+
cluster_name = module.ecs-cluster.ecs_cluster.name
100+
service_name = "arc-ecs-module-service-poc"
101+
repository_name = "23112.dkr.ecr.us-east-1.amazonaws.com/arc/arc-poc-ecs"
102+
enable_load_balancer = false
103+
aws_lb_target_group_name = "arc-poc-alb-tg"
103104
}
104105

105106
task = {
106-
container_port = 8100
107+
tasks_desired = 1
108+
container_port = 8100
109+
container_memory = 1024
110+
container_vcpu = 256
111+
container_definition = "container/container_definition.json.tftpl"
107112
}
108113

109114
alb = {
110-
name = module.alb.name
115+
name = module.alb.alb.name
111116
listener_port = 8100
112-
security_group_id = ""
117+
security_group_id = module.alb.alb_security_group_id
113118
}
114-
depends_on = [ module.alb ]
119+
depends_on = [module.alb]
115120
}

example/ecs-cluster/main.tf

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,11 @@ terraform {
1212
}
1313
}
1414

15-
module "tags" {
16-
source = "sourcefuse/arc-tags/aws"
17-
version = "1.2.3"
18-
environment = var.environment
19-
project = "Example"
20-
21-
extra_tags = {
22-
RepoName = "terraform-aws-refarch-ecs"
23-
Example = "true"
24-
}
25-
}
26-
27-
provider "aws" {
28-
region = var.region
29-
}
30-
3115
################################################################################
3216
## ecs
3317
################################################################################
34-
module "ecs" {
35-
source = "../modules/ecs"
18+
module "ecs-cluster" {
19+
source = "../modules/ecs-cluster"
3620

3721
create = true
3822

example/ecs-cluster/variables.tf

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

example/ecs-service/.terraform.lock.hcl

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/health-check-service/main.tf renamed to example/ecs-service/main.tf

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,16 @@ terraform {
1212
}
1313
}
1414

15-
module "health-check" {
16-
source = "../../modules/health-check"
15+
module "ecs-service" {
16+
source = "../../modules/ecs-service"
1717

18-
vpc_id = "vpc-0e6c09980580ecbf6"
18+
vpc_id = "vpc-12345"
1919
environment = "develop"
20-
aws_region = "us-east-1"
2120

2221
ecs = {
2322
cluster_name = "arc-ecs-module-poc"
2423
service_name = "arc-ecs-module-service-poc"
25-
repository_name = "884360309640.dkr.ecr.us-east-1.amazonaws.com/arc/arc-poc-ecs"
24+
repository_name = "12345.dkr.ecr.us-east-1.amazonaws.com/arc/arc-poc-ecs"
2625
enable_load_balancer = false
2726
}
2827

iam.tf

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

locals.tf

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

0 commit comments

Comments
 (0)