-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.tf
62 lines (54 loc) · 1.57 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
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "5.48.0"
}
}
}
provider "aws" {
region = var.aws_region
default_tags {
tags = var.tags
}
}
module "vpc" {
source = "./modules/vpc"
region = var.aws_region
workload = var.workload
}
# module "vpc_endpoints" {
# source = "./modules/endpoints"
# vpc_id = module.vpc.vpc_id
# aws_region = var.aws_region
# security_group_id =
# }
module "iam" {
source = "./modules/iam"
workload = var.workload
}
module "vns3" {
source = "./modules/vns3"
workload = var.workload
vpc_id = module.vpc.vpc_id
subnet = module.vpc.public_subnet_id
instance_type = var.vns3_instance_type
ami = var.vns3_ami
instance_profile_id = module.iam.ec2_instance_profile_id
allowed_webui_ip_addresses = var.vns3_allowed_webui_ip_addresses
}
resource "aws_route" "nat" {
route_table_id = module.vpc.private_route_table_id
destination_cidr_block = "0.0.0.0/0"
network_interface_id = module.vns3.primary_network_interface_id
}
module "server" {
count = var.create_private_server == true ? 1 : 0
source = "./modules/server"
workload = var.workload
vpc_id = module.vpc.vpc_id
subnet = module.vpc.private_subnet_id
instance_type = var.private_server_instance_type
ami = var.private_server_ami
instance_profile_id = module.iam.ec2_instance_profile_id
}