-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.tf
104 lines (94 loc) · 3.99 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
provider "aws" {
region = "${var.region}"
}
module "vpc" {
source = "./module/vpc"
vpc_cidr_block = "${var.vpc_cidr_block}"
}
module "subnet" {
source = "./module/subnet"
vpc_id = "${module.vpc.vpc_id}"
availability_zone_a = "${var.availability_zone_a}"
availability_zone_b = "${var.availability_zone_b}"
public_subnet_CIDR_block_a = "${var.public_subnet_CIDR_block_a}"
public_subnet_CIDR_block_b = "${var.public_subnet_CIDR_block_b}"
private_subnet_CIDR_block_a = "${var.private_subnet_CIDR_block_a}"
private_subnet_CIDR_block_b = "${var.private_subnet_CIDR_block_b}"
}
module "gateway" {
source = "./module/gateway"
vpc_id = "${module.vpc.vpc_id}"
public_subnet_id_a = "${module.subnet.public_subnet_id_a}"
public_subnet_id_b = "${module.subnet.public_subnet_id_b}"
}
module "security" {
source = "./module/security"
vpc_id = "${module.vpc.vpc_id}"
}
module "routing" {
source = "./module/routing"
vpc_id = "${module.vpc.vpc_id}"
public_subnet_id_a = "${module.subnet.public_subnet_id_a}"
public_subnet_id_b = "${module.subnet.public_subnet_id_b}"
private_subnet_id_a = "${module.subnet.private_subnet_id_a}"
private_subnet_id_b = "${module.subnet.private_subnet_id_b}"
internet_gateway_id = "${module.gateway.internet_gateway_id}"
nat_gateway_id_a = "${module.gateway.nat_gateway_id_a}"
nat_gateway_id_b = "${module.gateway.nat_gateway_id_b}"
}
module "bastion" {
source = "./module/bastion"
vpc_id = "${module.vpc.vpc_id}"
public_subnet_id = "${module.subnet.public_subnet_id_a}"
security_group_id = "${module.security.ssh_security_group_id}"
availability_zone = "${var.availability_zone_a}"
internet_gateway_id = "${module.gateway.internet_gateway_id}"
ami = "${var.ami}"
key_name = "${var.key_name}"
}
module "rds" {
source = "./module/rds"
vpc_id = "${module.vpc.vpc_id}"
db_subnet_group_id = "${module.subnet.postgres_subnet_group_id}"
security_group_id = "${module.security.postgres_security_group_id}"
db_name = "${var.db_name}"
db_user = "${var.db_user}"
db_password = "${var.db_password}"
}
module "cache" {
source = "./module/cache"
vpc_id = "${module.vpc.vpc_id}"
security_group_id = "${module.security.cache_security_group_id}"
private_subnet_id_a = "${module.subnet.private_subnet_id_a}"
private_subnet_id_b = "${module.subnet.private_subnet_id_b}"
}
module "nfs" {
source = "./module/nfs"
vpc_id = "${module.vpc.vpc_id}"
ami = "${var.ami}"
security_group_ids = ["${module.security.vpc_security_group_id}", "${module.security.mount_security_group_id}"]
availability_zone = "${var.availability_zone_a}"
bastion_host = "${module.bastion.bastion_host}"
key_name = "${var.key_name}"
subnet_id = "${module.subnet.private_subnet_id_a}"
}
module "gitlab" {
source = "./module/gitlab"
security_group_ids = ["${module.security.vpc_security_group_id}", "${module.security.mount_security_group_id}"]
key_name = "${var.key_name}"
ami = "${var.ami}"
nfs_ip = "${module.nfs.nfs_ip}"
rds_endpoint = "${module.rds.rds_endpoint}"
redis_host = "${module.cache.redis_host}"
public_subnet_id_a = "${module.subnet.public_subnet_id_a}"
public_subnet_id_b = "${module.subnet.public_subnet_id_b}"
private_subnet_id_a = "${module.subnet.private_subnet_id_a}"
private_subnet_id_b = "${module.subnet.private_subnet_id_b}"
availability_zone_a = "${var.availability_zone_a}"
availability_zone_b = "${var.availability_zone_b}"
gitlab_url = "${var.gitlab_url}"
gitlab_docker_image = "${var.gitlab_docker_image}"
db_name = "${var.db_name}"
db_user = "${var.db_user}"
db_password = "${var.db_password}"
}