-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmain.tf
120 lines (99 loc) · 3.1 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// TODO any other subdomain should redirect to APEX
module "route53" {
count = var.b_route53_zone ? 1 : 0
source = "./modules/route53"
domain = var.domain
subdomain = var.subdomain
alb_hostname = module.ecs.ecs_alb_hostname
alb_zone_id = module.ecs.ecs_alb_zone_id
providers = {
aws.useast1 = aws.useast1
}
}
module "acm" {
source = "./modules/acm"
domain = var.domain
subdomain = var.subdomain
hosted_zone_id = var.b_route53_zone ? module.route53[0].hosted_zone_id : null
}
# module "cloudfront" {
# source = "./modules/cloudfront"
# hostname = local.hostname
# }
module "vpc" {
source = "./modules/vpc"
stack_name = local.stack_name
b_nat_gateway = false
}
module "iam" {
source = "./modules/iam"
stack_name = local.stack_name
}
module "aurora" {
source = "./modules/aurora"
stack_name = local.stack_name
subnet_ids = module.vpc.private_subnets.*.id
vpc_id = module.vpc.vpc.id
}
module "ecr" {
source = "./modules/ecr"
stack_name = replace(local.stack_name, "/[^a-zA-Z0-9]+/", "")
ci_pipeline_user_arn = module.iam.ci_pipeline_arn
ecs_role = module.iam.ecs_role
}
module "s3" {
source = "./modules/s3"
stack_name = local.stack_name
}
module "elasticache" {
source = "./modules/elasticache"
stack_name = local.stack_name
subnet_ids = module.vpc.private_subnets.*.id
vpc_id = module.vpc.vpc.id
}
module "elasticsearch" {
source = "./modules/elasticsearch"
stack_name = local.stack_name
vpc_id = module.vpc.vpc.id
subnet_ids = module.vpc.private_subnets.*.id
# aws_iam_role = module.ecs.aws_iam_role
}
module "sqs" {
source = "./modules/sqs"
stack_name = local.stack_name
vpc_id = module.vpc.vpc.id
subnet_ids = module.vpc.public_subnets.*.id
security_group_ids = [module.ecs.aws_security_group.id]
aws_iam_role = module.ecs.aws_iam_role
}
module "ssm" {
source = "./modules/ssm"
stack_name = local.stack_name
}
module "cloudwatch" {
source = "./modules/cloudwatch"
stack_name = local.stack_name
}
module "ecs" {
source = "./modules/ecs"
stack_name = local.stack_name
vpc_id = module.vpc.vpc.id
public_subnet_ids = module.vpc.public_subnets.*.id
private_subnet_ids = module.vpc.private_subnets.*.id
role = module.iam.ecs_role
certificate_arn = module.acm.certificate_arn
aws_rds_cluster = module.aurora.aws_rds_cluster
aws_s3_bucket = module.s3.aws_s3_bucket
ecr_laravel_repository_uri = module.ecr.laravel_repository_uri
ecr_nginx_repository_uri = module.ecr.nginx_repository_uri
aws_sqs_queue = module.sqs.aws_sqs_queue
aws_elasticache_cluster = module.elasticache.aws_elasticache_cluster
aws_ssm_parameter = module.ssm.aws_ssm_parameter
aws_elasticsearch_domain = module.elasticsearch.aws_elasticsearch_domain
}
module "ec2" {
source = "./modules/ec2"
stack_name = local.stack_name
vpc_id = module.vpc.vpc.id
subnet_id = module.vpc.private_subnets[0].id
}