Skip to content

Commit 9fa3c46

Browse files
committed
rename create_user_pool var to enabled
1 parent 3b1b0c5 commit 9fa3c46

8 files changed

+21
-21
lines changed

Diff for: README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module "aws_cognito_user_pool_simple" {
2929

3030
### Example (conditional creation)
3131

32-
Sometimes you need to have a way to create Cognito User Pool resources conditionally but Terraform does not allow to use `count` inside `module` block, so the solution is to specify argument `create_user_pool`.
32+
Sometimes you need to have a way to create Cognito User Pool resources conditionally but Terraform does not allow to use `count` inside `module` block, so the solution is to specify argument `enabled`.
3333

3434
```
3535
# This Cognito User Pool will not be created
@@ -38,7 +38,7 @@ module "aws_cognito_user_pool_conditional_creation" {
3838
source = "lgallard/cognito-user-pool/aws"
3939
4040
user_pool_name = "conditional_user_pool"
41-
create_user_pool = false
41+
enabled = false
4242
4343
}
4444
```
@@ -163,7 +163,6 @@ module "aws_cognito_user_pool_complete" {
163163
| client\_supported\_identity\_providers | List of provider names for the identity providers that are supported on this client | `list` | `[]` | no |
164164
| client\_write\_attributes | List of user pool attributes the application client can write to | `list` | `[]` | no |
165165
| clients | A container with the clients definitions | `list` | `[]` | no |
166-
| create_user_pool | Controls if Cognito User Pool should be created | `bool` | `false` | no |
167166
| device\_configuration | The configuration for the user pool's device tracking | `map` | `{}` | no |
168167
| device\_configuration\_challenge\_required\_on\_new\_device | Indicates whether a challenge is required on a new device. Only applicable to a new device | `bool` | `false` | no |
169168
| device\_configuration\_device\_only\_remembered\_on\_user\_prompt | If true, a device is only remembered on user prompt | `bool` | `false` | no |
@@ -176,6 +175,7 @@ module "aws_cognito_user_pool_complete" {
176175
| email\_configuration\_source\_arn | The ARN of the email source | `string` | `""` | no |
177176
| email\_verification\_message | A string representing the email verification message | `string` | `null` | no |
178177
| email\_verification\_subject | A string representing the email verification subject | `string` | `null` | no |
178+
| enabled | Controls if Cognito User Pool should be created | `bool` | `false` | no |
179179
| lambda\_config | A container for the AWS Lambda triggers associated with the user pool | `map` | `null` | no |
180180
| lambda\_config\_create\_auth\_challenge | The ARN of the lambda creating an authentication challenge. | `string` | `""` | no |
181181
| lambda\_config\_custom\_message | A custom Message AWS Lambda trigger. | `string` | `""` | no |

Diff for: client.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
resource "aws_cognito_user_pool_client" "client" {
2-
count = var.create_user_pool ? length(local.clients) : 0
2+
count = var.enabled ? length(local.clients) : 0
33
allowed_oauth_flows = lookup(element(local.clients, count.index), "allowed_oauth_flows", null)
44
allowed_oauth_flows_user_pool_client = lookup(element(local.clients, count.index), "allowed_oauth_flows_user_pool_client", null)
55
allowed_oauth_scopes = lookup(element(local.clients, count.index), "allowed_oauth_scopes", null)

Diff for: domain.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
resource "aws_cognito_user_pool_domain" "domain" {
2-
count = ! var.create_user_pool || var.domain == null || var.domain == "" ? 0 : 1
2+
count = ! var.enabled || var.domain == null || var.domain == "" ? 0 : 1
33
domain = var.domain
44
certificate_arn = var.domain_certificate_arn
55
user_pool_id = aws_cognito_user_pool.pool[0].id

Diff for: main.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
resource "aws_cognito_user_pool" "pool" {
2-
count = var.create_user_pool ? 1 : 0
2+
count = var.enabled ? 1 : 0
33

44
alias_attributes = var.alias_attributes
55
auto_verified_attributes = var.auto_verified_attributes

Diff for: outputs.tf

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,68 @@
11
output "id" {
22
description = "The id of the user pool"
3-
value = var.create_user_pool ? aws_cognito_user_pool.pool[0].id : null
3+
value = var.enabled ? aws_cognito_user_pool.pool[0].id : null
44
}
55

66
output "arn" {
77
description = "The ARN of the user pool"
8-
value = var.create_user_pool ? aws_cognito_user_pool.pool[0].arn : null
8+
value = var.enabled ? aws_cognito_user_pool.pool[0].arn : null
99
}
1010

1111
output "endpoint" {
1212
description = "The endpoint name of the user pool. Example format: cognito-idp.REGION.amazonaws.com/xxxx_yyyyy"
13-
value = var.create_user_pool ? aws_cognito_user_pool.pool[0].endpoint : null
13+
value = var.enabled ? aws_cognito_user_pool.pool[0].endpoint : null
1414
}
1515

1616
output "creation_date" {
1717
description = "The date the user pool was created"
18-
value = var.create_user_pool ? aws_cognito_user_pool.pool[0].creation_date : null
18+
value = var.enabled ? aws_cognito_user_pool.pool[0].creation_date : null
1919
}
2020

2121
output "last_modified_date" {
2222
description = "The date the user pool was last modified"
23-
value = var.create_user_pool ? aws_cognito_user_pool.pool[0].last_modified_date : null
23+
value = var.enabled ? aws_cognito_user_pool.pool[0].last_modified_date : null
2424
}
2525

2626
#
2727
# aws_cognito_user_pool_domain
2828
#
2929
output "domain_aws_account_id" {
3030
description = "The AWS account ID for the user pool owner"
31-
value = var.create_user_pool ? join("", aws_cognito_user_pool_domain.domain.*.aws_account_id) : null
31+
value = var.enabled ? join("", aws_cognito_user_pool_domain.domain.*.aws_account_id) : null
3232
}
3333

3434
output "domain_cloudfront_distribution_arn" {
3535
description = "The ARN of the CloudFront distribution"
36-
value = var.create_user_pool ? join("", aws_cognito_user_pool_domain.domain.*.cloudfront_distribution_arn) : null
36+
value = var.enabled ? join("", aws_cognito_user_pool_domain.domain.*.cloudfront_distribution_arn) : null
3737
}
3838

3939
output "domain_s3_bucket" {
4040
description = "The S3 bucket where the static files for this domain are stored"
41-
value = var.create_user_pool ? join("", aws_cognito_user_pool_domain.domain.*.s3_bucket) : null
41+
value = var.enabled ? join("", aws_cognito_user_pool_domain.domain.*.s3_bucket) : null
4242
}
4343

4444
output "domain_app_version" {
4545
description = "The app version"
46-
value = var.create_user_pool ? join("", aws_cognito_user_pool_domain.domain.*.version) : null
46+
value = var.enabled ? join("", aws_cognito_user_pool_domain.domain.*.version) : null
4747
}
4848

4949
#
5050
# aws_cognito_user_pool_client
5151
#
5252
output "client_ids" {
5353
description = "The ids of the user pool clients"
54-
value = var.create_user_pool ? aws_cognito_user_pool_client.client.*.id : null
54+
value = var.enabled ? aws_cognito_user_pool_client.client.*.id : null
5555
}
5656

5757
output "client_secrets" {
5858
description = " The client secrets of the user pool clients"
59-
value = var.create_user_pool ? aws_cognito_user_pool_client.client.*.client_secret : null
59+
value = var.enabled ? aws_cognito_user_pool_client.client.*.client_secret : null
6060
}
6161

6262
#
6363
# aws_cognito_resource_servers
6464
#
6565
output "resource_servers_scope_identifiers" {
6666
description = " A list of all scopes configured in the format identifier/scope_name"
67-
value = var.create_user_pool ? aws_cognito_resource_server.resource.*.scope_identifiers : null
67+
value = var.enabled ? aws_cognito_resource_server.resource.*.scope_identifiers : null
6868
}

Diff for: resource-server.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
resource "aws_cognito_resource_server" "resource" {
2-
count = var.create_user_pool ? length(local.resource_servers) : 0
2+
count = var.enabled ? length(local.resource_servers) : 0
33
name = lookup(element(local.resource_servers, count.index), "name")
44
identifier = lookup(element(local.resource_servers, count.index), "identifier")
55

Diff for: user-group.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
resource "aws_cognito_user_group" "main" {
2-
count = var.create_user_pool ? length(local.groups) : 0
2+
count = var.enabled ? length(local.groups) : 0
33
name = lookup(element(local.groups, count.index), "name")
44
description = lookup(element(local.groups, count.index), "description")
55
precedence = lookup(element(local.groups, count.index), "precedence")

Diff for: variables.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#
22
# aws_cognito_user_pool
33
#
4-
variable "create_user_pool" {
4+
variable "enabled" {
55
description = "Controls if Cognito User Pool should be created"
66
type = bool
77
default = false

0 commit comments

Comments
 (0)