Skip to content

Commit

Permalink
Add user pool domain as an optional override to the templated user po…
Browse files Browse the repository at this point in the history
…ol name domain
  • Loading branch information
KenFigueiredo committed Nov 21, 2023
1 parent dcaa925 commit adf47c7
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [1.1.0] - TBD

### Added
- Added support for Cognito custom user pool domains.

### Changed
- Update Lambda@Edge NodeJS version to `nodejs20.x` (was `nodejs14.x`).
- Remove `aws-sdk` in favor of `@aws-sdk` v3 libraries.
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ No modules.
| <a name="input_cognito_log_level"></a> [cognito\_log\_level](#input\_cognito\_log\_level) | Logging level. Default: 'silent' | `string` | `"silent"` | no |
| <a name="input_cognito_user_pool_app_client_id"></a> [cognito\_user\_pool\_app\_client\_id](#input\_cognito\_user\_pool\_app\_client\_id) | Cognito User Pool App Client ID for the targeted user pool. | `string` | n/a | yes |
| <a name="input_cognito_user_pool_app_client_secret"></a> [cognito\_user\_pool\_app\_client\_secret](#input\_cognito\_user\_pool\_app\_client\_secret) | Cognito User Pool App Client Secret for the targeted user pool. NOTE: This is currently not compatible with AppSync applications. | `string` | `null` | no |
| <a name="input_cognito_user_pool_domain"></a> [cognito\_user\_pool\_domain](#input\_cognito\_user\_pool\_domain) | Optional: Full Domain of the Cognito User Pool to utilize. Mutually exclusive with 'cognito\_user\_pool\_name'. | `string` | `""` | no |
| <a name="input_cognito_user_pool_id"></a> [cognito\_user\_pool\_id](#input\_cognito\_user\_pool\_id) | Cognito User Pool ID for the targeted user pool. | `string` | n/a | yes |
| <a name="input_cognito_user_pool_name"></a> [cognito\_user\_pool\_name](#input\_cognito\_user\_pool\_name) | Name of the Cognito User Pool to utilize. | `string` | n/a | yes |
| <a name="input_cognito_user_pool_name"></a> [cognito\_user\_pool\_name](#input\_cognito\_user\_pool\_name) | Name of the Cognito User Pool to utilize. Required if 'cognito\_user\_pool\_domain' is not set. | `string` | `""` | no |
| <a name="input_cognito_user_pool_region"></a> [cognito\_user\_pool\_region](#input\_cognito\_user\_pool\_region) | AWS region where the cognito user pool was created. | `string` | `"us-west-2"` | no |
| <a name="input_name"></a> [name](#input\_name) | Name to prefix on all infrastructure created by this module. | `string` | n/a | yes |
| <a name="input_tags"></a> [tags](#input\_tags) | Map of tags to attach to all AWS resources created by this module. | `map(string)` | `{}` | no |
Expand Down
2 changes: 1 addition & 1 deletion lambda.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ locals {

resource "null_resource" "install_lambda_dependencies" {
provisioner "local-exec" {
command = "npm ci --production"
command = "npm ci --omit dev"
working_dir = abspath("${path.module}/files/deployable")
}

Expand Down
2 changes: 1 addition & 1 deletion ssm.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ locals {
userPoolId = var.cognito_user_pool_id
userPoolAppId = var.cognito_user_pool_app_client_id
userPoolAppSecret = var.cognito_user_pool_app_client_secret == null ? "" : var.cognito_user_pool_app_client_secret
userPoolDomain = "${var.cognito_user_pool_name}.auth.${var.cognito_user_pool_region}.amazoncognito.com"
userPoolDomain = coalesce(var.cognito_user_pool_domain, "${var.cognito_user_pool_name}.auth.${var.cognito_user_pool_region}.amazoncognito.com")
cookieExpirationDays = var.cognito_cookie_expiration_days
disableCookieDomain = var.cognito_disable_cookie_domain
logLevel = var.cognito_log_level
Expand Down
9 changes: 8 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@ variable "name" {
}

variable "cognito_user_pool_name" {
description = "Name of the Cognito User Pool to utilize."
description = "Name of the Cognito User Pool to utilize. Required if 'cognito_user_pool_domain' is not set."
type = string
default = ""
}

variable "cognito_user_pool_domain" {
description = "Optional: Full Domain of the Cognito User Pool to utilize. Mutually exclusive with 'cognito_user_pool_name'."
type = string
default = ""
}

variable "cognito_user_pool_region" {
Expand Down

0 comments on commit adf47c7

Please sign in to comment.