Skip to content

Commit

Permalink
feat: add ability to configure domain
Browse files Browse the repository at this point in the history
  • Loading branch information
sgtoj committed Dec 29, 2023
1 parent 245b705 commit 6eab597
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ for more details on these variables.

| Name | Description | Type | Default | Required |
|----------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:------------:|:-----------------------:|:--------:|
| `domain` | Configuration domain to assign userpool. | object | `{}` | No |
| `email_config` | Configuration email from the userpool. | object | `{}` | No |
| `email_verification_message` | A string representing the email verification message | string | `""` | No |
| `email_verification_subject` | A string representing the email verification subject | string | `""` | No |
Expand Down
2 changes: 2 additions & 0 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ locals {
module "congito_userpool" {
source = "../../"

domain = { enabled = true }

context = module.example_label.context # not required
}

Expand Down
10 changes: 10 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,16 @@ resource "aws_cognito_user_pool" "this" {
tags = module.cognito_userpool_label.tags
}

# ------------------------------------------------------------------- domain ---

resource "aws_cognito_user_pool_domain" "domain" {
count = local.enabled && var.domain.enabled ? 1 : 0

domain = coalesce(var.domain.name, module.cognito_userpool_label.id)
certificate_arn = var.domain.certificate_arn
user_pool_id = aws_cognito_user_pool.this[0].id
}

# ---------------------------------------------------------------------- iam ---

module "cognito_userpool_sms_label" {
Expand Down
10 changes: 10 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# ================================================================= userpool ===

variable "domain" {
type = object({
enabled = optional(bool, false)
name = optional(string)
certificate_arn = optional(string)
})
description = "Configuration domain to assign userpool."
default = {}
}

variable "email_config" {
type = object({
configuration_set = optional(string)
Expand Down

0 comments on commit 6eab597

Please sign in to comment.