Skip to content

Commit

Permalink
Merge pull request #5 from clouddrove/test-cognito
Browse files Browse the repository at this point in the history
Test cognito
  • Loading branch information
themaniskshah committed Dec 7, 2022
2 parents cedf0ca + 5e88763 commit 812a610
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 36 deletions.
56 changes: 44 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,51 @@ This module has a few dependencies:


Here are examples of how you can use this module in your inventory structure:
### Single Node
```hcl
module "cognito" {
source = "clouddrove/cognito/aws"
version = "0.14.0"
name = "cognito"
environment = "test"
label_order = ["environment", "name"]
enabled = true
cognito_domain = "cd-es-cog"
region = "eu-west-1"
software_token_enabled = false
}
provider "aws" {
region = "us-east-1"
}
module "cognito" {
source = "./../"
name = "cognito"
environment = "test"
label_order = ["environment", "name"]
enabled = true
allow_admin_create_user_only = false
advanced_security_mode = "OFF"
domain = "test"
mfa_configuration = "OFF"
deletion_protection = "INACTIVE"
users = {
user01 = {
email = "test01@test.com"
}
user02 = {
email = "test02@test.com"
}
}
user_groups = [
{ name = "test_group"
description = "This is test group."
}
]
clients = [
{
name = "test-client"
callback_urls = ["https://test.com/signinurl"]
generate_secret = true
logout_urls = []
refresh_token_validity = 30
allowed_oauth_flows_user_pool_client = false
supported_identity_providers = ["COGNITO"]
allowed_oauth_scopes = ["email", "openid", "profile", "phone"]
allowed_oauth_flows = ["code"]
}
]
}
```


Expand Down
54 changes: 43 additions & 11 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,49 @@ include:
# yamllint disable rule:line-length
usage: |-
Here are examples of how you can use this module in your inventory structure:
### Single Node
```hcl
module "cognito" {
source = "clouddrove/cognito/aws"
version = "0.14.0"
name = "cognito"
environment = "test"
label_order = ["environment", "name"]
enabled = true
cognito_domain = "cd-es-cog"
region = "eu-west-1"
software_token_enabled = false
provider "aws" {
region = "us-east-1"
}

module "cognito" {
source = "./../"

name = "cognito"
environment = "test"
label_order = ["environment", "name"]

enabled = true
allow_admin_create_user_only = false
advanced_security_mode = "OFF"
domain = "test"
mfa_configuration = "OFF"
deletion_protection = "INACTIVE"
users = {
user01 = {
email = "test01@test.com"
}
user02 = {
email = "test02@test.com"
}
}
user_groups = [
{ name = "test_group"
description = "This is test group."
}
]
clients = [
{
name = "test-client"
callback_urls = ["https://test.com/signinurl"]
generate_secret = true
logout_urls = []
refresh_token_validity = 30
allowed_oauth_flows_user_pool_client = false
supported_identity_providers = ["COGNITO"]
allowed_oauth_scopes = ["email", "openid", "profile", "phone"]
allowed_oauth_flows = ["code"]
}
]
}
```
13 changes: 1 addition & 12 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Managed By : CloudDrove
# Description : This Script is used to create VPC, Internet Gateway and Flow log.
# Description : This Script is used to create AWS Cognito.
# Copyright @ CloudDrove. All Right Reserved.

#Module : labels
Expand Down Expand Up @@ -293,11 +293,6 @@ resource "aws_cognito_user_pool_client" "client" {
refresh_token = lookup(token_validity_units.value, "refresh_token", null)
}
}

# depends_on = [
# aws_cognito_resource_server.resource,
# aws_cognito_identity_provider.identity_provider
# ]
}

locals {
Expand Down Expand Up @@ -368,12 +363,6 @@ resource "aws_cognito_identity_pool" "identity_pool" {
count = var.enabled ? 1 : 0
identity_pool_name = format("%s_identity_pool", module.labels.id)
allow_unauthenticated_identities = false

# cognito_identity_providers {
# client_id = aws_cognito_user_pool_client.client.*.id[0]
# provider_name = aws_cognito_user_pool.user_pool.*.endpoint[0]
# }

lifecycle { ignore_changes = [cognito_identity_providers] }
}

Expand Down
3 changes: 3 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
output "user_pool_id" {
value = aws_cognito_user_pool.user_pool.*.id[0]
description = "(Required) User pool the client belongs to."
}

output "name" {
value = aws_cognito_user_pool.user_pool.*.name[0]
description = "(Required) Name of the application client."
}

output "app_client_id" {
value = aws_cognito_user_pool_client.client.*.id[0]
description = "ID of the user pool client."
}

output "tags" {
Expand Down
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ variable "environment" {

variable "repository" {
type = string
default = "https://github.com/clouddrove/terraform-aws-vpc"
default = "https://github.com/clouddrove/terraform-aws-cognito"
description = "Terraform current module repo"
}

Expand Down

0 comments on commit 812a610

Please sign in to comment.