-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.tf
97 lines (78 loc) · 1.91 KB
/
main.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Main
module "vpc" {
source = "registry.terraform.io/terraform-aws-modules/vpc/aws"
version = "~> 5.0"
name = "${var.env}-vpc"
cidr = "10.0.0.0/16"
azs = [
"${var.aws_region}a"
]
public_subnets = [
"10.0.10.0/23"
]
private_subnets = [
"10.0.20.0/23"
]
manage_default_network_acl = true
default_network_acl_name = "${var.env}-${var.namespace}"
}
resource "aws_security_group" "default_permissive" {
name = "${var.env}-default-permissive"
vpc_id = module.vpc.vpc_id
ingress {
protocol = -1
from_port = 0
to_port = 0
cidr_blocks = [
"0.0.0.0/0"
]
}
egress {
protocol = -1
from_port = 0
to_port = 0
cidr_blocks = [
"0.0.0.0/0"
]
}
}
module "ecs" {
source = "registry.terraform.io/terraform-aws-modules/ecs/aws"
version = "~> 4.0"
cluster_name = "${var.env}-${var.namespace}-worker"
}
module "worker_complete" {
source = "../.."
name = "worker"
app_type = "worker"
env = var.env
public = false
ecs_launch_type = "FARGATE"
max_size = 1
desired_capacity = 0
# Containers
ecs_cluster_arn = module.ecs.cluster_arn
ecs_cluster_name = module.ecs.cluster_name
docker_registry = var.docker_registry
docker_image_tag = var.docker_image_tag
docker_container_command = ["echo", "command-output"]
deployment_minimum_healthy_percent = 0
# EFS settings (external)
efs_enabled = true
efs_file_system_id = module.efs_data.id
efs_mount_point = "/mnt/efs"
efs_root_directory = "/"
efs_authorization_config = {
access_point_id = module.efs_data.access_points.posix_example.id
iam = "ENABLED"
}
# Network
vpc_id = module.vpc.vpc_id
private_subnets = module.vpc.private_subnets
security_groups = [aws_security_group.default_permissive.id]
# Environment variables
app_secrets = [
]
environment = {
}
}