-
Notifications
You must be signed in to change notification settings - Fork 16
/
ecs.tf
46 lines (32 loc) · 984 Bytes
/
ecs.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
resource "aws_cloudwatch_log_group" "log_group" {
name = var.environment
tags = {
Name = var.service_name
Environment = var.environment
}
}
resource "aws_key_pair" "key" {
key_name = var.key_name
public_key = file(var.ssh_key_file_ecs)
}
data "template_file" "ecs-instance-user-data" {
template = file("${path.module}/user-data-ecs-cluster-instance.tpl")
vars = {
ecs_cluster_name = module.ecs_cluster.name
}
}
module "ecs_cluster" {
source = "git::https://github.com/philips-software/terraform-aws-ecs.git?ref=2.0.0"
user_data = data.template_file.ecs-instance-user-data.rendered
aws_region = var.aws_region
environment = var.environment
key_name = var.key_name
vpc_id = module.vpc.vpc_id
vpc_cidr = module.vpc.vpc_cidr
min_instance_count = 1
max_instance_count = 2
desired_instance_count = 2
instance_type = "t2.micro"
subnet_ids = join(",", module.vpc.private_subnets)
project = var.project
}