Skip to content

Commit fb4f667

Browse files
committed
fix: use correct null check for token_validity_units block
1 parent adef6b6 commit fb4f667

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
support for the `enable_token_revocation` in the `aws_cognito_user_pool_client`
1414
resource.
1515

16+
### Fixed
17+
18+
- Fixed implementation of `token_validity_units` block.
19+
1620
## [0.8.0]
1721

1822
### BREAKING

main.tf

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,16 +233,18 @@ resource "aws_cognito_user_pool_client" "client" {
233233
id_token_validity = each.value.id_token_validity
234234

235235
dynamic "token_validity_units" {
236-
for_each = length(each.value.token_validity_units) > 0 ? [true] : []
236+
for_each = each.value.token_validity_units != null ? [each.value.token_validity_units] : []
237237

238238
content {
239-
refresh_token = each.value.token_validity_units.refresh_token
240-
access_token = each.value.token_validity_units.access_token
241-
id_token = each.value.token_validity_units.id_token
239+
refresh_token = try(token_validity_units.value.refresh_token, null)
240+
access_token = try(token_validity_units.value.access_token, null)
241+
id_token = try(token_validity_units.value.id_token, null)
242242
}
243243
}
244+
244245
enable_token_revocation = each.value.enable_token_revocation
245246
}
247+
246248
resource "aws_cognito_user_pool_domain" "domain" {
247249
count = var.module_enabled && var.domain != null ? 1 : 0
248250

0 commit comments

Comments
 (0)