-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
135 lines (112 loc) · 3.08 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
provider "aws" {
alias = "north_america"
profile = var.profile
region = "us-east-1"
}
provider "aws" {
alias = "south_america"
profile = var.profile
region = "sa-east-1"
}
module "route53" {
source = "./modules/route53"
providers = {
aws = aws.north_america
}
domain = var.hosted_zone_domain
sub_domain = var.hosted_zone_sub_domain
}
module "acm_north_america" {
source = "./modules/acm"
providers = {
aws = aws.north_america
}
domain = var.hosted_zone_domain
sub_domain = var.hosted_zone_sub_domain
main_hosted_zone_id = module.route53.main_hosted_zone_id
sub_domain_hosted_zone_id = module.route53.sub_domain_hosted_zone_id
}
module "acm_south_america" {
source = "./modules/acm"
providers = {
aws = aws.south_america
}
domain = var.hosted_zone_domain
sub_domain = var.hosted_zone_sub_domain
main_hosted_zone_id = module.route53.main_hosted_zone_id
sub_domain_hosted_zone_id = module.route53.sub_domain_hosted_zone_id
}
module "s3_static_website" {
source = "./modules/s3-static-website"
providers = {
aws = aws.north_america
}
bucket_name = var.hosted_zone_domain
main_hosted_zone_id = module.route53.main_hosted_zone_id
}
module "vpc_north_america" {
source = "./modules/vpc"
providers = {
aws = aws.north_america
}
cidr_block = var.vpc_cidr_block
availability_zone = var.availability_zone
}
module "vpc_south_america" {
source = "./modules/vpc"
providers = {
aws = aws.south_america
}
cidr_block = var.vpc_cidr_block
availability_zone = var.availability_zone
}
module "ec2_north_america" {
source = "./modules/ec2"
providers = {
aws = aws.north_america
}
dns = {
hosted_zone_id = module.route53.sub_domain_hosted_zone_id
sub_domain = var.hosted_zone_sub_domain
geolocation_continent_code = "NA"
}
public_subnet_id = module.vpc_north_america.public_subnet_id
security_group_id = module.vpc_north_america.security_group_id
availability_zone = var.availability_zone
ami = var.ami
ssh_key_pair_name = var.ssh_key_pair_name
}
module "ec2_south_america" {
source = "./modules/ec2"
providers = {
aws = aws.south_america
}
dns = {
hosted_zone_id = module.route53.sub_domain_hosted_zone_id
sub_domain = var.hosted_zone_sub_domain
geolocation_continent_code = "SA"
}
public_subnet_id = module.vpc_south_america.public_subnet_id
security_group_id = module.vpc_south_america.security_group_id
availability_zone = var.availability_zone
ami = var.ami
ssh_key_pair_name = var.ssh_key_pair_name
}
module "api_gateway_north_america" {
source = "./modules/api_gateway"
providers = {
aws = aws.north_america
}
sub_domain = var.hosted_zone_sub_domain
certificate_arn = module.acm_north_america.certificate_arn
zone_id = module.route53.sub_domain_hosted_zone_id
}
module "api_gateway_south_america" {
source = "./modules/api_gateway"
providers = {
aws = aws.south_america
}
sub_domain = var.hosted_zone_sub_domain
certificate_arn = module.acm_south_america.certificate_arn
zone_id = module.route53.sub_domain_hosted_zone_id
}