Skip to content

Commit

Permalink
Added support for dashboard using cloudfront DNS
Browse files Browse the repository at this point in the history
  • Loading branch information
seanturner026 committed May 24, 2021
1 parent 3ff8e18 commit 42e79e0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion r_api_gateway.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ resource "aws_apigatewayv2_api" "this" {
allow_credentials = true
allow_headers = ["Content-Type", "Authorization", "X-Session-Id"]
allow_methods = ["GET", "OPTIONS", "POST"]
allow_origins = ["https://${var.fqdn_alias}"]
allow_origins = [var.hosted_zone_name != "" && var.fqdn_alias != "" ? "https://${var.fqdn_alias}" : "https://${module.cloudfront.cloudfront_distribution_domain_name}"]
max_age = 600
}

Expand Down
2 changes: 1 addition & 1 deletion r_cognito.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ resource "aws_cognito_user_pool_client" "this" {
allowed_oauth_flows_user_pool_client = true
allowed_oauth_scopes = ["email", "openid"]
supported_identity_providers = ["COGNITO"]
callback_urls = ["https://${var.fqdn_alias}"]
callback_urls = [var.hosted_zone_name != "" && var.fqdn_alias != "" ? "https://${var.fqdn_alias}" : "https://${module.cloudfront.cloudfront_distribution_domain_name}"]

explicit_auth_flows = [
"ALLOW_ADMIN_USER_PASSWORD_AUTH",
Expand Down
6 changes: 3 additions & 3 deletions r_route53.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ resource "aws_route53_record" "alias" {
}

resource "aws_route53_record" "acm" {
for_each = {
for_each = var.hosted_zone_name != "" && var.fqdn_alias != "" ? {
for dvo in aws_acm_certificate.this[0].domain_validation_options : dvo.domain_name => {
name = dvo.resource_record_name
record = dvo.resource_record_value
type = dvo.resource_record_type
} if var.hosted_zone_name != "" && var.fqdn_alias != ""
}
}
} : {}

allow_overwrite = true
name = each.value.name
Expand Down

0 comments on commit 42e79e0

Please sign in to comment.