forked from squidfunk/terraform-aws-cognito-auth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
118 lines (87 loc) · 3.74 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
# Copyright (c) 2018-2019 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
# -----------------------------------------------------------------------------
# Modules
# -----------------------------------------------------------------------------
# data.aws_caller_identity._
data "aws_caller_identity" "_" {}
# -----------------------------------------------------------------------------
# Modules
# -----------------------------------------------------------------------------
# module.api
module "api" {
source = "./modules/api"
namespace = "${var.namespace}"
region = "${var.region}"
api_stage = "${var.api_stage}"
cognito_user_pool_id = "${module.identity.cognito_user_pool_id}"
cognito_user_pool_arn = "${module.identity.cognito_user_pool_arn}"
cognito_user_pool_client_id = "${module.identity.cognito_user_pool_client_id}"
cognito_identity_pool_provider = "${var.cognito_identity_pool_provider}"
}
# module.identity
module "identity" {
source = "./modules/identity"
namespace = "${var.namespace}"
region = "${var.region}"
cognito_identity_pool_name = "${var.cognito_identity_pool_name}"
cognito_identity_pool_provider = "${var.cognito_identity_pool_provider}"
}
# module.message
module "message" {
source = "./modules/message"
namespace = "${var.namespace}"
region = "${var.region}"
cognito_user_pool_id = "${module.identity.cognito_user_pool_id}"
cognito_user_pool_arn = "${module.identity.cognito_user_pool_arn}"
cognito_identity_pool_name = "${var.cognito_identity_pool_name}"
cognito_identity_pool_provider = "${var.cognito_identity_pool_provider}"
sns_topic_arn = "${module.api.sns_topic_arn}"
ses_sender_address = "${var.ses_sender_address}"
}
# module.route
module "route" {
source = "./modules/route"
namespace = "${var.namespace}"
region = "${var.region}"
app_hosted_zone_id = "${var.app_hosted_zone_id}"
app_domain = "${var.app_domain}"
cloudfront_distribution_domain_name = "${
module.web.cloudfront_distribution_domain_name
}"
cloudfront_distribution_hosted_zone_id = "${
module.web.cloudfront_distribution_hosted_zone_id
}"
}
# module.web
module "web" {
source = "./modules/web"
namespace = "${var.namespace}"
region = "${var.region}"
api_id = "${module.api.api_id}"
api_stage = "${module.api.api_stage}"
api_base_path = "${module.api.api_base_path}"
app_hosted_zone_id = "${var.app_hosted_zone_id}"
app_certificate_arn = "${var.app_certificate_arn}"
app_domain = "${var.app_domain}"
app_origin = "${var.app_origin}"
cognito_identity_pool_name = "${var.cognito_identity_pool_name}"
bucket = "${length(var.bucket) == 0
? var.namespace
: var.bucket
}"
}