Skip to content

Commit

Permalink
infra: cognito user pool domains
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiio committed Dec 4, 2023
1 parent 46bfa63 commit 9fe5f10
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions terraform/cognito.tf
Original file line number Diff line number Diff line change
Expand Up @@ -120,33 +120,38 @@ resource "aws_cognito_user_pool_ui_customization" "ui" {
}

resource "aws_cognito_user_pool_domain" "main" {
domain = local.auth_domain
user_pool_id = aws_cognito_user_pool.pool.id
}

resource "aws_cognito_user_pool_domain" "custom" {
domain = local.auth_domain
certificate_arn = aws_acm_certificate.main.arn
user_pool_id = aws_cognito_user_pool.pool.id
}

resource "aws_route53_record" "auth-cognito-A" {
name = aws_cognito_user_pool_domain.main.domain
name = aws_cognito_user_pool_domain.custom.domain
type = "A"
zone_id = data.aws_route53_zone.main.zone_id

alias {
evaluate_target_health = false

name = aws_cognito_user_pool_domain.main.cloudfront_distribution
zone_id = aws_cognito_user_pool_domain.main.cloudfront_distribution_zone_id
name = aws_cognito_user_pool_domain.custom.cloudfront_distribution
zone_id = aws_cognito_user_pool_domain.custom.cloudfront_distribution_zone_id
}
}

resource "aws_route53_record" "auth-cognito-AAAA" {
name = aws_cognito_user_pool_domain.main.domain
name = aws_cognito_user_pool_domain.custom.domain
type = "AAAA"
zone_id = data.aws_route53_zone.main.zone_id

alias {
evaluate_target_health = false

name = aws_cognito_user_pool_domain.main.cloudfront_distribution
zone_id = aws_cognito_user_pool_domain.main.cloudfront_distribution_zone_id
name = aws_cognito_user_pool_domain.custom.cloudfront_distribution
zone_id = aws_cognito_user_pool_domain.custom.cloudfront_distribution_zone_id
}
}

0 comments on commit 9fe5f10

Please sign in to comment.