Skip to content

Commit f8b338e

Browse files
authored
Merge pull request #34 from mineiros-io/mariux/integration
Addition of account_recovery_setting recovery_mechanisms
2 parents 83e0630 + 454a516 commit f8b338e

File tree

10 files changed

+89
-12
lines changed

10 files changed

+89
-12
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: CI/CD Pipeline
33
on: push
44

55
env:
6-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
7-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
6+
AWS_SECRET_ACCESS_KEY: ${{ secrets.MINEIROS_TESTING_AWS_SECRET_ACCESS_KEY }}
7+
AWS_ACCESS_KEY_ID: ${{ secrets.MINEIROS_TESTING_AWS_ACCESS_KEY_ID }}
88

99
jobs:
1010
pre-commit:

CHANGELOG.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [0.5.0]
10+
### Added
11+
- Add support for `account_recovery_mechanisms`
12+
13+
### Removed
14+
- BREAKING CHANGE: Drop support for Terraform AWS Provider version 2.x
15+
916
## [0.4.1] - 2021-02-08
1017
### Fixed
1118
- Fixed examples to use new variable `user_device_tracking` instead of `device_only_remembered_on_user_prompt`
@@ -73,9 +80,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7380
- Add unit tests for basic use cases.
7481

7582
<!-- markdown-link-check-disable -->
76-
[Unreleased]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/compare/v0.4.1...HEAD
77-
[0.4.1]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/compare/v0.4.0...v0.4.1
83+
[Unreleased]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/compare/v0.5.0...HEAD
84+
[0.5.0]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/compare/v0.4.1...v0.5.0
7885
<!-- markdown-link-check-enable -->
86+
[0.4.1]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/compare/v0.4.0...v0.4.1
7987
[0.4.0]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/compare/v0.3.0...v0.4.0
8088
[0.3.0]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/compare/v0.2.0...v0.3.0
8189
[0.2.0]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/compare/v0.1.4...v0.2.0

README.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ A [Terraform] module for deploying and managing
1313
on [Amazon Web Services (AWS)][AWS].
1414

1515
*This module supports Terraform v0.14, v0.13 as well as v0.12.20 and above
16-
and is compatible with the terraform AWS provider v3 as well as v2.54 and above.*
16+
and is compatible with the terraform AWS provider v3.19 and above.*
17+
18+
The last version supporting terraform AWS provider v2.x is v0.4.1.
1719

1820
**We, [Mineiros][mineiros-library], offer [professional support][mineiros-pricing] for this module.**
1921

@@ -65,7 +67,7 @@ Most basic usage just setting required arguments:
6567
```hcl
6668
module "terraform-aws-cognito-user-pool" {
6769
source = "mineiros-io/cognito-user-pool/aws"
68-
version = "~> 0.4.0"
70+
version = "~> 0.5.0"
6971
7072
name = "application-userpool"
7173
}
@@ -317,6 +319,25 @@ for details and use-cases.
317319
]
318320
```
319321

322+
- **`account_recovery_mechanisms`**: *(Optional `any`)*
323+
A list of recovery_mechanisms to be inserted inside `account_recovery_setting`. A `recovery_mechanism` is defined by a `name` and its `priority`. Valid values for `name` are verified_email, verified_phone_number, and admin_only.
324+
Default is `[]`.
325+
326+
**Example:**
327+
328+
```hcl
329+
account_recovery_mechanisms = [
330+
{
331+
name = "verified_email"
332+
priority = 1
333+
},
334+
{
335+
name = "verified_phone_number"
336+
priority = 2
337+
}
338+
]
339+
```
340+
320341
- **`sms_configuration`**: *(Optional `object({external_id = string, sns_caller_arn = string})`)*
321342

322343
The `sms_configuration` with the `external_id` parameter used in IAM role trust relationships and the `sns_caller_arn` parameter to set the ARN of the Amazon SNS caller. This is usually the IAM role that you have given AWS Cognito permission to assume.
@@ -573,7 +594,7 @@ Copyright &copy; 2020 [Mineiros GmbH][homepage]
573594

574595
[build-status]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/actions
575596

576-
[badge-tf-aws]: https://img.shields.io/badge/AWS-3%20and%202.54+-F8991D.svg?logo=terraform
597+
[badge-tf-aws]: https://img.shields.io/badge/AWS-3.19+-F8991D.svg?logo=terraform
577598
[releases-aws-provider]: https://github.com/terraform-providers/terraform-provider-aws/releases
578599

579600
[releases-github]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/releases

examples/complete/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ shows how to deploy a Cognito User Pool with custom settings.
1212
```hcl
1313
module "cognito_user_pool" {
1414
source = "mineiros-io/cognito-user-pool/aws"
15-
version = "~> 0.4.0"
15+
version = "~> 0.5.0"
1616
1717
name = "complete-example-userpool"
1818

examples/complete/main.tf

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ provider "aws" {
1717

1818
module "cognito_user_pool" {
1919
source = "mineiros-io/cognito-user-pool/aws"
20-
version = "~> 0.4.0"
20+
version = "~> 0.5.0"
2121

2222
name = "complete-example-userpool"
2323

@@ -37,6 +37,17 @@ module "cognito_user_pool" {
3737
"email"
3838
]
3939

40+
account_recovery_mechanisms = [
41+
{
42+
name = "verified_email"
43+
priority = 1
44+
},
45+
{
46+
name = "verified_phone_number"
47+
priority = 2
48+
}
49+
]
50+
4051
# If invited by an admin
4152
invite_email_subject = "You've been invited to Mineiros.io"
4253
invite_email_message = "Hi {username}, your temporary password is '{####}'."

examples/user-pool-with-default-settings/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ defined in the [variables.tf] file of this module.
1313
```hcl
1414
module "cognito_user_pool" {
1515
source = "mineiros-io/cognito-user-pool/aws"
16-
version = "~> 0.4.0"
16+
version = "~> 0.5.0"
1717
1818
name = "example-userpool"
1919
}

examples/user-pool-with-default-settings/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ provider "aws" {
1818

1919
module "cognito_user_pool" {
2020
source = "mineiros-io/cognito-user-pool/aws"
21-
version = "~> 0.4.0"
21+
version = "~> 0.5.0"
2222

2323
name = "example-userpool"
2424
}

main.tf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,22 @@ resource "aws_cognito_user_pool" "user_pool" {
3636
temporary_password_validity_days = var.temporary_password_validity_days
3737
}
3838

39+
dynamic "account_recovery_setting" {
40+
for_each = length(var.account_recovery_mechanisms) > 0 ? [true] : []
41+
42+
content {
43+
dynamic "recovery_mechanism" {
44+
for_each = var.account_recovery_mechanisms
45+
iterator = recovery
46+
47+
content {
48+
name = recovery.value.name
49+
priority = recovery.value.priority
50+
}
51+
}
52+
}
53+
}
54+
3955
dynamic "device_configuration" {
4056
for_each = contains(["ALWAYS", "USER_OPT_IN"], upper(var.user_device_tracking)) ? [true] : []
4157

variables.tf

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,27 @@ variable "auto_verified_attributes" {
186186
]
187187
}
188188

189+
variable "account_recovery_mechanisms" {
190+
type = any
191+
description = "(Optional) A list of recovery_mechanisms which are defined by a `name` and its `priority`. Valid values for `name` are veri fied_email, verified_phone_number, and admin_only."
192+
193+
# Example:
194+
#
195+
# account_recovery_setting_recovery_mechanisms = [
196+
# {
197+
# name = "verified_email"
198+
# priority = 1
199+
# },
200+
# {
201+
# name = "verified_phone_number"
202+
# priority = 2
203+
# }
204+
# ]
205+
206+
default = []
207+
}
208+
209+
189210
variable "challenge_required_on_new_device" {
190211
type = bool
191212
description = "(Optional) Indicates whether a challenge is required on a new device. Only applicable to a new device."

versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ terraform {
22
required_version = ">= 0.12.20, < 0.15"
33

44
required_providers {
5-
aws = ">= 2.54, < 4.0"
5+
aws = ">= 3.19, < 4.0"
66
}
77
}

0 commit comments

Comments
 (0)