-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.tf
187 lines (140 loc) · 5.77 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
terraform {
backend "remote" {
organization = "TaylorDigitalServices"
workspaces {
name = "DatalayerStorageService"
}
}
}
provider "aws" {
access_key = var.aws_access_key
secret_key = var.aws_secret_key
region = local.config.AWS_REGION
}
module "service-datalayer-upload-plugin" {
source = "./modules/service.datalayer-upload-plugin"
providers = { aws = aws }
# AWS Profile
aws_profile = local.config.AWS_PROFILE
# Storage
dev_bucket_id = aws_s3_bucket.storage_devops_bucket.id
# Policies And Roles
default_lambda_role_arn = aws_iam_role.default-lambda-role.arn
domain_zone_id = aws_route53_zone.service-zone.zone_id
service_domain = local.config.SERVICE_DOMAIN
# System Utils
create_schema_utility = module.service-system-utils.create_schema_utility
# Database
db_name = local.config.DB_NAME
# Certificates
wildcard_certificate_arn = aws_acm_certificate.wildcard-domain.arn
# lambda
lambda_layer_arn = aws_lambda_layer_version.common-layer.arn
}
module "service-system-utils" {
source = "./modules/service.system-utils"
providers = { aws = aws }
# AWS Profile
aws_region = local.config.AWS_REGION
aws_profile = local.config.AWS_PROFILE
# Storage
dev_bucket_id = aws_s3_bucket.storage_devops_bucket.id
service_bucket_id = aws_s3_bucket.storage-bucket.id
service_bucket_arn = aws_s3_bucket.storage-bucket.arn
# Policies And Roles
default_lambda_role_arn = aws_iam_role.default-lambda-role.arn
# lambda
lambda_layer_arn = aws_lambda_layer_version.common-layer.arn
# API Root
api_gateway_id = aws_api_gateway_rest_api.main.id
root_resource_id = aws_api_gateway_rest_api.main.root_resource_id
api_gateway_arn = aws_api_gateway_rest_api.main.execution_arn
# domain
service_domain = local.config.SERVICE_DOMAIN
domain_zone = aws_route53_zone.service-zone
}
module "service-user" {
source = "./modules/service.user"
providers = { aws = aws }
# AWS Profile
aws_region = local.config.AWS_REGION
aws_profile = local.config.AWS_PROFILE
# Storage
storage_bucket_id = aws_s3_bucket.storage-bucket.id
dev_bucket_id = aws_s3_bucket.storage_devops_bucket.id
# Database
db_name = local.config.DB_NAME
# System Utils
create_schema_utility = module.service-system-utils.create_schema_utility
# Network
public_subnet_id = aws_subnet.public-2.id
# Policies And Roles
default_lambda_role_arn = aws_iam_role.default-lambda-role.arn
# API Root
api_gateway_id = aws_api_gateway_rest_api.main.id
root_resource_id = aws_api_gateway_rest_api.main.root_resource_id
api_gateway_arn = aws_api_gateway_rest_api.main.execution_arn
# APP Root
app_gateway_id = aws_api_gateway_rest_api.www.id
app_root_resource_id = aws_api_gateway_rest_api.www.root_resource_id
app_gateway_arn = aws_api_gateway_rest_api.www.execution_arn
# lambda
lambda_layer_arn = aws_lambda_layer_version.common-layer.arn
depends_on = [
aws_db_instance.default,
aws_lambda_invocation.init-db
]
}
module "service-subscriptions" {
source = "./modules/service.subscriptions"
providers = { aws = aws }
# AWS Profile
aws_region = local.config.AWS_REGION
aws_profile = local.config.AWS_PROFILE
# Storage
storage_bucket_id = aws_s3_bucket.storage-bucket.id
dev_bucket_id = aws_s3_bucket.storage_devops_bucket.id
# Database
db_name = local.config.DB_NAME
# System Utils
create_schema_utility = module.service-system-utils.create_schema_utility
# Network
public_subnet_id = aws_subnet.public-2.id
# Policies And Roles
default_lambda_role_arn = aws_iam_role.default-lambda-role.arn
# API Root
api_gateway_id = aws_api_gateway_rest_api.main.id
root_resource_id = aws_api_gateway_rest_api.main.root_resource_id
api_gateway_arn = aws_api_gateway_rest_api.main.execution_arn
# APP Root
app_gateway_id = aws_api_gateway_rest_api.www.id
app_root_resource_id = aws_api_gateway_rest_api.www.root_resource_id
app_gateway_arn = aws_api_gateway_rest_api.www.execution_arn
# lambda
lambda_layer_arn = aws_lambda_layer_version.common-layer.arn
depends_on = [
module.service-user,
aws_db_instance.default,
aws_lambda_invocation.init-db
]
}
module "service-worker-gateway" {
source = "./modules/service.worker-gateway"
providers = { aws = aws }
# AWS Profile
aws_region = local.config.AWS_REGION
aws_profile = local.config.AWS_PROFILE
# Storage
storage_bucket_id = aws_s3_bucket.storage-bucket.id
dev_bucket_id = aws_s3_bucket.storage_devops_bucket.id
# Network
public_subnet_id = aws_subnet.public-2.id
# Policies And Roles
default_lambda_role_arn = aws_iam_role.default-lambda-role.arn
# API Root
api_gateway_id = aws_api_gateway_rest_api.main.id
root_resource_id = aws_api_gateway_rest_api.main.root_resource_id
api_gateway_arn = aws_api_gateway_rest_api.main.execution_arn
# lambda
lambda_layer_arn = aws_lambda_layer_version.common-layer.arn
}