-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.tf
146 lines (115 loc) · 3.5 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
terraform {
required_version = "~>0.14.5"
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.0"
}
}
}
provider "aws" {
region = var.region
}
terraform {
backend "s3" {
bucket = "codeforcalifornia"
key = "terraform-state/foodoasis/dev/terraform.tfstate"
region = "us-west-1"
dynamodb_table = "terraform-locks"
}
}
module "network" {
source = "./network"
// Input from Variables
region = var.region
project_name = var.project_name
environment = var.environment
vpc_cidr = var.vpc_cidr
tags = var.tags
}
module "rds" {
source = "./rds"
// Input from other modules
vpc_id = module.network.vpc_id
vpc_cidr = module.network.vpc_cidr
private_subnet_ids = module.network.private_subnet_ids
private_subnet_cidrs = module.network.private_subnet_cidrs
bastion_security_group_id = module.bastion.security_group_id
// Input from Variables
project_name = var.project_name
environment = var.environment
region = var.region
db_username = var.db_username
db_password = var.db_password
db_port = var.db_port
db_engine_version = var.db_engine_version
db_major_version = var.db_major_version
db_snapshot_migration = var.db_snapshot_migration
tags = var.tags
}
module "applicationlb" {
source = "./applicationlb"
// Input from other Modules
vpc_id = module.network.vpc_id
public_subnet_ids = module.network.public_subnet_ids
acm_certificate_arn = module.acm.acm_certificate_arn
// Input from Variables
account_id = var.account_id
region = var.region
environment = var.environment
project_name = var.project_name
default_alb_url = var.default_alb_url
tags = var.tags
}
module "ecs" {
source = "./ecs"
// Input from other Modules
vpc_id = module.network.vpc_id
vpc_cidr = module.network.vpc_cidr
public_subnet_ids = module.network.public_subnet_ids
alb_security_group_id = module.applicationlb.security_group_id
// Input from Variables
environment = var.environment
project_name = var.project_name
ecs_ec2_instance_count = var.ecs_ec2_instance_count
key_name = var.key_name
tags = var.tags
depends_on = [module.applicationlb]
}
module "r53" {
source = "./r53"
// count = var.domain_name == "" || length(var.host_names) == 1 && var.host_names[0] == "" ? 0 : 1
// Input from other Modules
alb_external_dns = module.applicationlb.lb_dns_name
// Input from Variables
domain_name = var.domain_name
host_names = var.host_names
}
module "bastion" {
source = "./bastion"
// Input from other Modules
vpc_id = module.network.vpc_id
public_subnet_ids = module.network.public_subnet_ids
// Input from Variables
account_id = var.account_id
project_name = var.project_name
environment = var.environment
key_name = var.key_name
domain_name = var.domain_name
bastion_hostname = var.bastion_hostname
bastion_instance_type = var.bastion_instance_type
bastion_github_file = var.bastion_github_file
tags = var.tags
}
module "acm" {
source = "./acm"
// Input from Variables
domain_name = var.domain_name
tags = var.tags
}
module "github_action" {
source = "./github_action"
account_id = var.account_id
execution_role_arn = module.ecs.task_execution_role_arn
tags = var.tags
}