-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
75 lines (65 loc) · 1.7 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
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "5.21.0"
}
}
}
provider "aws" {
region = var.aws_region
}
locals {
workload = "bookstore"
}
module "vpc" {
source = "./modules/vpc"
aws_region = var.aws_region
workload = local.workload
}
module "rds" {
source = "./modules/rds"
vpc_id = module.vpc.vpc_id
subnets = module.vpc.data_subnets
azs = module.vpc.azs
}
module "elb" {
source = "./modules/elb"
workload = local.workload
subnets = module.vpc.elb_subnets
vpc_id = module.vpc.vpc_id
}
module "iam" {
source = "./modules/iam"
workload = local.workload
}
module "ecr" {
source = "./modules/ecr"
workload = local.workload
}
module "ecs" {
source = "./modules/ecs"
workload = local.workload
subnets = module.vpc.application_subnets
vpc_id = module.vpc.vpc_id
aws_region = var.aws_region
ecr_repository_url = module.ecr.repository_url
ecs_task_execution_role_arn = module.iam.ecs_task_execution_role_arn
ecs_task_role_arn = module.iam.ecs_task_role_arn
target_group_arn = module.elb.target_group_arn
task_cpu = var.ecs_task_cpu
task_memory = var.ecs_task_memory
}
module "ssm" {
source = "./modules/ssm"
workload = local.workload
aurora_username = module.rds.master_username
aurora_password = module.rds.master_password
aurora_endpoint = module.rds.endpoint
}
module "ec2" {
source = "./modules/ec2"
workload = local.workload
subnet = module.vpc.application_subnets[0]
vpc_id = module.vpc.vpc_id
}