-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from nearform/current
v0.1.18
- Loading branch information
Showing
22 changed files
with
974 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
locals { | ||
enable_domain_count = var.enable_dns && var.enable_certificates ? 1 : 0 | ||
} | ||
resource "aws_cognito_user_pool" "admin_user_pool" { | ||
name = "${module.labels.id}-admin-userpool" | ||
username_attributes = ["email"] | ||
} | ||
|
||
resource "aws_cognito_user_pool_client" "user_pool_client" { | ||
name = "${module.labels.id}-admin-userpool-client" | ||
user_pool_id = aws_cognito_user_pool.admin_user_pool.id | ||
allowed_oauth_flows = ["code", "implicit"] | ||
callback_urls = ["http://localhost"] | ||
default_redirect_uri = "http://localhost" | ||
allowed_oauth_scopes = ["phone", "email", "openid", "profile", "aws.cognito.signin.user.admin"] | ||
supported_identity_providers = ["COGNITO"] | ||
} | ||
|
||
resource "aws_cognito_user_pool_domain" "main" { | ||
count = local.enable_domain_count | ||
domain = format("%s-login.%s", module.labels.id, var.route53_zone) | ||
user_pool_id = aws_cognito_user_pool.admin_user_pool.id | ||
certificate_arn = aws_acm_certificate.wildcard_cert_us[0].arn | ||
} | ||
|
||
resource "aws_route53_record" "auth_cognito_A_record" { | ||
count = local.enable_domain_count | ||
provider = aws.dns | ||
name = aws_cognito_user_pool_domain.main[0].domain | ||
type = "A" | ||
zone_id = data.aws_route53_zone.primary[0].id | ||
alias { | ||
evaluate_target_health = false | ||
name = aws_cognito_user_pool_domain.main[0].cloudfront_distribution_arn | ||
# This zone_id is fixed | ||
zone_id = "Z2FDTNDATAQYW2" | ||
} | ||
} | ||
|
||
resource "aws_cognito_user_group" "settings_read" { | ||
name = "settings-read" | ||
user_pool_id = aws_cognito_user_pool.admin_user_pool.id | ||
} | ||
|
||
resource "aws_cognito_user_group" "settings_write" { | ||
name = "settings-write" | ||
user_pool_id = aws_cognito_user_pool.admin_user_pool.id | ||
} | ||
|
||
resource "aws_cognito_user_group" "otc_send" { | ||
name = "otc-send" | ||
user_pool_id = aws_cognito_user_pool.admin_user_pool.id | ||
} | ||
|
||
resource "aws_cognito_user_group" "qr_admin" { | ||
name = "qr-admin" | ||
user_pool_id = aws_cognito_user_pool.admin_user_pool.id | ||
} | ||
|
||
resource "aws_cognito_user_group" "qr_user" { | ||
name = "qr-user" | ||
user_pool_id = aws_cognito_user_pool.admin_user_pool.id | ||
} | ||
|
||
resource "aws_cognito_user_group" "manage_users" { | ||
name = "manage-users" | ||
user_pool_id = aws_cognito_user_pool.admin_user_pool.id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Admin Web App | ||
|
||
## Requirements | ||
|
||
### DNS Root Record for Cognito | ||
|
||
In order to configure cognito, a DNS Root `A` record **must** be set on domain's DNS table. | ||
|
||
Any target will work, even a fake IP address, Cognito must see that this record is just _present_. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.