-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
60 lines (54 loc) · 1.69 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
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "5.34.0"
}
}
}
provider "aws" {
region = var.region
}
module "vpc" {
source = "./modules/vpc"
region = var.region
workload = var.workload
}
module "nat-instance" {
count = var.create_nat_instance == true ? 1 : 0
source = "./modules/ec2/nat-instance"
workload = var.workload
vpc_id = module.vpc.vpc_id
subnet = module.vpc.subnet_public1_id
instance_type = var.instance_type
ami = var.ami
userdata = var.userdata
}
module "cohesive_vns3" {
count = var.create_cohesive_nat == true ? 1 : 0
source = "./modules/vns3-nate"
workload = var.workload
vpc_id = module.vpc.vpc_id
subnet = module.vpc.subnet_public1_id
instance_type = var.cohesive_instance_type
ami = var.cohesive_ami
}
module "server" {
count = var.create_private_server == true ? 1 : 0
source = "./modules/ec2/server"
workload = var.workload
vpc_id = module.vpc.vpc_id
subnet = module.vpc.subnet_private1_id
region = var.region
route_table_id = module.vpc.private_route_table_id
nat_network_interface_id = module.nat-instance[0].network_interface_id
}
module "vpc_endpoints" {
count = var.create_vpc_endpoints == true ? 1 : 0
source = "./modules/endpoints"
workload = var.workload
vpc_id = module.vpc.vpc_id
subnet = module.vpc.subnet_private1_id
region = var.region
security_group_id = module.server[0].security_group_id
}