-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
120 lines (105 loc) · 3.39 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
resource "aws_cognito_user_pool" "bmb_user_pool" {
name = var.user_pool_name
auto_verified_attributes = ["email"]
schema {
attribute_data_type = "String"
developer_only_attribute = false
mutable = false
name = "name"
required = true
}
schema {
attribute_data_type = "String"
developer_only_attribute = false
mutable = false
name = "email"
required = true
}
tags = {
Terraform = "true"
}
}
resource "aws_cognito_user_pool_client" "bmb_api_client" {
name = "bmb test client"
user_pool_id = aws_cognito_user_pool.bmb_user_pool.id
supported_identity_providers = compact([
"COGNITO",
])
callback_urls = ["https://postech.fiap.com.br/curso/software-architecture/"]
allowed_oauth_flows_user_pool_client = true
allowed_oauth_flows = ["code", "implicit"]
allowed_oauth_scopes = ["email", "openid"]
}
resource "aws_cognito_identity_pool" "bmb_identity_pool" {
identity_pool_name = "${var.user_pool_name}_identity"
allow_unauthenticated_identities = false
cognito_identity_providers {
client_id = aws_cognito_user_pool_client.bmb_api_client.id
provider_name = aws_cognito_user_pool.bmb_user_pool.endpoint
server_side_token_check = false
}
tags = {
Terraform = "true"
TCManaged = "true"
}
}
resource "aws_cognito_identity_pool_provider_principal_tag" "identity_provider_tags" {
identity_pool_id = aws_cognito_identity_pool.bmb_identity_pool.id
identity_provider_name = aws_cognito_user_pool.bmb_user_pool.endpoint
use_defaults = false
principal_tags = {
test = "value"
}
}
resource "aws_cognito_user_pool_domain" "main" {
domain = var.user_pool_name
user_pool_id = aws_cognito_user_pool.bmb_user_pool.id
}
resource "aws_cognito_user_group" "admin" {
name = "admin"
user_pool_id = aws_cognito_user_pool.bmb_user_pool.id
description = "Administrator"
}
resource "aws_cognito_user_group" "kitchen" {
name = "kitchen"
user_pool_id = aws_cognito_user_pool.bmb_user_pool.id
description = "Kitchen staff"
}
resource "aws_cognito_user_group" "customer" {
name = "customer"
user_pool_id = aws_cognito_user_pool.bmb_user_pool.id
description = "Customers"
}
resource "aws_cognito_user" "kitchen_user" {
username = "25297503000"
user_pool_id = aws_cognito_user_pool.bmb_user_pool.id
message_action = "SUPPRESS"
password = "TempPass123!"
attributes = {
name = "Cozinha"
email = "[email protected]"
email_verified = true
}
}
resource "aws_cognito_user" "admin_user" {
username = "32747126048"
user_pool_id = aws_cognito_user_pool.bmb_user_pool.id
message_action = "SUPPRESS"
password = "TempPass123!"
attributes = {
name = "Admin"
email = "[email protected]"
email_verified = true
}
}
resource "aws_cognito_user" "customer_user" {
username = "91121682030"
user_pool_id = aws_cognito_user_pool.bmb_user_pool.id
message_action = "SUPPRESS"
password = "TempPass123!"
attributes = {
name = "Customer"
email = "[email protected]"
email_verified = true
}
}