forked from cyberlabrs/terraform-aws-opensearch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cognito.tf
49 lines (41 loc) · 1.33 KB
/
cognito.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
# user pool
resource "aws_cognito_user_pool" "user_pool" {
count = var.cognito_enabled ? 1 : 0
name = "${var.name}_user_pool"
admin_create_user_config {
allow_admin_create_user_only = true
}
auto_verified_attributes = ["email"]
mfa_configuration = "OFF"
username_attributes = ["email"]
user_pool_add_ons {
advanced_security_mode = "OFF"
}
password_policy {
minimum_length = 8
require_lowercase = true
require_numbers = true
require_symbols = true
require_uppercase = true
temporary_password_validity_days = 7
}
account_recovery_setting {
recovery_mechanism {
name = "verified_email"
priority = 1
}
}
}
resource "aws_cognito_user_pool_domain" "user_pool_domain" {
count = var.cognito_enabled ? 1 : 0
domain = var.name
user_pool_id = aws_cognito_user_pool.user_pool[0].id
}
# identity pool
resource "aws_cognito_identity_pool" "identity_pool" {
count = var.cognito_enabled ? 1 : 0
identity_pool_name = "${var.name}_identity_pool"
allow_unauthenticated_identities = true
# AWS OpenSearch will maintain `cognito_identity_providers`, so ignore it
lifecycle { ignore_changes = [cognito_identity_providers] }
}