-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
71 lines (62 loc) · 1.71 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
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "5.22.0"
}
}
}
provider "aws" {
region = var.aws_region
}
locals {
workload = "fastplanes"
vpn_client_cidr_block = "10.80.0.0/22"
}
module "vpc" {
source = "./modules/vpc"
aws_region = var.aws_region
workload = local.workload
}
module "ec2-instance" {
source = "./modules/ec2-instance"
workload = local.workload
vpc_id = module.vpc.vpc_id
az = module.vpc.azs[0]
subnet = module.vpc.public_subnets[0]
}
module "rds_mysql" {
source = "./modules/mysql"
workload = local.workload
vpc_id = module.vpc.vpc_id
subnets = module.vpc.private_subnets
multi_az = var.rds_multi_az
instance_class = var.rds_instance_class
username = var.rds_username
password = var.rds_password
vpn_client_cidr_block = local.vpn_client_cidr_block
}
module "acm" {
source = "./modules/acm"
}
module "cloudwatch" {
source = "./modules/cloudwatch"
workload = local.workload
}
module "vpn_endpoint" {
count = var.vpn_endpoint_enabled == true ? 1 : 0
source = "./modules/vpn"
workload = local.workload
lient_cidr_block = local.vpn_client_cidr_block
vpc_id = module.vpc.vpc_id
subnets = module.vpc.private_subnets
acm_cert_arn = module.acm.server_cer_arn
log_group_name = module.cloudwatch.log_group_name
}
module "openvpn" {
source = "./modules/openvpn"
workload = local.workload
vpc_id = module.vpc.vpc_id
subnet = module.vpc.public_subnets[0]
instance_type = var.openvpn_instance_type
}