-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add cognito to Terraform #61
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
resource "aws_cognito_user_pool" "main" { | ||
name = var.user_pool_name | ||
|
||
// Add additional configurations here | ||
} | ||
|
||
resource "aws_cognito_user_pool_client" "main" { | ||
name = var.client_name | ||
user_pool_id = aws_cognito_user_pool.main.id | ||
|
||
// Configure client here | ||
// For example: | ||
generate_secret = false | ||
allowed_oauth_flows = ["code", "implicit"] | ||
allowed_oauth_scopes = ["email", "openid"] | ||
allowed_oauth_flows_user_pool_client = true | ||
|
||
// Other configurations like callback URLs, logout URLs, etc. | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
output "user_pool_id" { | ||
description = "The ID of the Cognito User Pool" | ||
value = aws_cognito_user_pool.main.id | ||
} | ||
|
||
output "user_pool_client_id" { | ||
description = "The ID of the Cognito User Pool Client" | ||
value = aws_cognito_user_pool_client.main.id | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
variable "region" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should something be using this var? It doesn't look like this var is being referenced in any resource. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, it's set to the wrong default thought, i think...which is getting overridden when called in |
||
description = "AWS region" | ||
type = string | ||
default = "us-east-1" | ||
} | ||
|
||
variable "user_pool_name" { | ||
description = "Name of the Cognito User Pool" | ||
type = string | ||
} | ||
|
||
variable "client_name" { | ||
description = "Name of the Cognito User Pool Client" | ||
type = string | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question mainly for my understanding: where should the configuration of the project
user pool
andclient
be defined? Does the project create more resources in this file? or is it using the resources configuration defined incognito/main.tf
and the 3 var fields are the only customization possible?I think people depot deployment will eventually need several clients, ones with secret for the backends (people depot and CTJ?), and ones without secret for frontends (VRMS, website, CTJ?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey @fyliu - apologies for the late response here...i just noticed these comments yesterday.
the modules are basically the recipes that any project can use to build what they need. the variables can have default values but those can be overridden if you pass values when calling the module. so, files in /cognito define the resources (main.tf), along w/ their variables and outputs
the main.tf file inside of people-depot/project calls that module and passes the client info (or whatever other configs you want to pass it)
for adding multiple clients, you'd call the module multiple times like so:
if the configs need to change (like generate_secret = true) - then we can designate those as variables when creating the module and then pass the value when calling the module in project/main.tf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, each project would use the module inside their project directory's main.tf file. if it's a shared resource, we can move it to a shared directory...but it sounded like this would be project specific