This repository has been archived on 2025-12-11. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
tasker/tasker-server/terraform/cognito.tf
Andrew Trieu 11e61829f1 Wip backend (#4)
* feat: Add new API handlers for user, project, and task management; update package dependencies

* feat: Update .gitignore, add Lambda layer configuration, and refactor DynamoDB handlers to use AWS SDK v3

* feat: Update serverless configuration and refactor API handlers to improve error handling and response structure

* feat: Add Cognito user pool name parameter and update API handlers to include CORS headers

* feat: Update task and project ID formats, add populateSeedData function, and enhance user ID handling

* feat: Update image source paths to use S3 public URL for profile and task attachments
2024-11-23 18:17:00 +02:00

106 lines
2.8 KiB
HCL

resource "aws_cognito_user_pool" "tasker_cognito_user_pool" {
name = "tasker-cognito-user-pool"
# Sign-in options
alias_attributes = ["preferred_username", "email"]
# User name requirements
username_configuration {
case_sensitive = true
}
# Password policy
password_policy {
minimum_length = 8
require_uppercase = false
require_lowercase = false
require_numbers = false
require_symbols = false
}
# MFA settings
mfa_configuration = "OFF"
# Account recovery
account_recovery_setting {
recovery_mechanism {
name = "verified_email"
priority = 1
}
}
# Auto-verified attributes
auto_verified_attributes = ["email"]
# Self-registration and message delivery
admin_create_user_config {
allow_admin_create_user_only = false # Enable self-registration
}
verification_message_template {
default_email_option = "CONFIRM_WITH_CODE"
email_subject = "Tasker - Verify your email address"
email_message = "Your verification code is {####}."
}
user_attribute_update_settings {
attributes_require_verification_before_update = ["email"]
}
tags = {
Environment = "Dev"
}
}
resource "aws_cognito_user_pool_client" "tasker_cognito_client" {
name = "tasker-cognito-client"
user_pool_id = aws_cognito_user_pool.tasker_cognito_user_pool.id
generate_secret = false
allowed_oauth_flows = []
allowed_oauth_scopes = []
supported_identity_providers = ["COGNITO"]
prevent_user_existence_errors = "ENABLED"
}
resource "aws_cognito_user_pool_domain" "tasker_cognito_domain" {
domain = "tasker"
user_pool_id = aws_cognito_user_pool.tasker_cognito_user_pool.id
}
resource "aws_ssm_parameter" "user_pool_id" {
name = "/tasker/cognito/user-pool-id"
description = "Tasker Cognito User Pool ID"
type = "String"
value = aws_cognito_user_pool.tasker_cognito_user_pool.id
}
resource "aws_ssm_parameter" "user_pool_arn" {
name = "/tasker/cognito/user-pool-arn"
description = "Tasker Cognito User Pool ARN"
type = "String"
value = aws_cognito_user_pool.tasker_cognito_user_pool.arn
}
resource "aws_ssm_parameter" "user_pool_name" {
name = "/tasker/cognito/user-pool-name"
description = "Tasker Cognito User Pool Name"
type = "String"
value = aws_cognito_user_pool.tasker_cognito_user_pool.name
}
resource "aws_ssm_parameter" "client_id" {
name = "/tasker/cognito/client-id"
description = "Tasker Cognito Client ID"
type = "String"
value = aws_cognito_user_pool_client.tasker_cognito_client.id
}
resource "aws_ssm_parameter" "cognito_domain" {
name = "/tasker/cognito/domain"
description = "Tasker Cognito Domain"
type = "String"
value = aws_cognito_user_pool_domain.tasker_cognito_domain.domain
}