unoverse 0.1.105 → 0.1.107

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -109,6 +109,9 @@ locals {
109
109
  # no cert, the ALB speaks plain HTTP on its DNS name. Setting domain later and
110
110
  # re-applying upgrades the SAME ALB in place — ACM cert, HTTPS listener, redirect.
111
111
  has_domain = var.domain != ""
112
+ # Where a person actually goes. Shared by the invitation email and the canvas_url output
113
+ # so the address in the email can never drift from the address in the deploy summary.
114
+ canvas_entry = var.domain != "" ? "https://canvas.${var.domain}" : "http://${aws_lb.public.dns_name}:3001"
112
115
  api_host = "api.${var.domain}"
113
116
  dns_auto = local.has_domain && var.route53_zone_id != ""
114
117
  }
@@ -419,6 +422,35 @@ resource "aws_cognito_user_pool" "pool" {
419
422
  lambda_version = "V2_0"
420
423
  }
421
424
  }
425
+
426
+ # THE INVITATION HAS TO SAY WHERE TO GO. Cognito's default message is a username and a
427
+ # temporary password and no address: the first administrator of a brand new universe
428
+ # receives credentials for a login page they have never been told the name of, and the
429
+ # hosted UI URL is buried in a terraform output they have no reason to read.
430
+ #
431
+ # The domain is built from the same random_id the domain resource uses, so this can name
432
+ # the URL without depending on that resource and creating a cycle back to this pool.
433
+ admin_create_user_config {
434
+ allow_admin_create_user_only = true
435
+ invite_message_template {
436
+ # LINK TO THE APP, NOT TO COGNITO. The hosted sign-in page needs a client_id, and the
437
+ # client is created FROM this pool — referencing it here is a dependency cycle. Canvas
438
+ # is also simply the better destination: it redirects to Cognito itself, and the
439
+ # administrator ends up where they were trying to go rather than on a login screen with
440
+ # nowhere to land afterwards.
441
+ # SMS IS REQUIRED EVEN WHEN ONLY EMAIL IS USED. Cognito validates the whole template:
442
+ # omit sms_message and UpdateUserPool rejects it for an empty value that must be at
443
+ # least six characters. It must contain {username} and {####} or the API refuses it.
444
+ sms_message = "Your ${var.name} universe: {username}, temporary password {####}"
445
+ email_subject = "Your ${var.name} universe is ready"
446
+ email_message = <<-MSG
447
+ <p>Your universe is deployed, and this account administers it.</p>
448
+ <p><b>Open it:</b> <a href="${local.canvas_entry}">${local.canvas_entry}</a></p>
449
+ <p>Username: <b>{username}</b><br/>Temporary password: <b>{####}</b></p>
450
+ <p>You will be asked to choose a new password the first time you sign in.</p>
451
+ MSG
452
+ }
453
+ }
422
454
  }
423
455
 
424
456
  # Groups ARE the RBAC surface: membership becomes the `roles`/`permissions`
@@ -24,7 +24,7 @@ output "acm_validation_records" {
24
24
 
25
25
  output "canvas_url" {
26
26
  description = "Public Canvas URL (canvas_public = true only) — add it to the client origins."
27
- value = var.canvas_public ? (local.has_domain ? "https://canvas.${var.domain}" : "http://${aws_lb.public.dns_name}:3001") : "canvas is admin-only (direct http://<instance-ip>:3001 from admin_cidr)"
27
+ value = var.canvas_public ? local.canvas_entry : "canvas is admin-only (direct http://<instance-ip>:3001 from admin_cidr)"
28
28
  }
29
29
 
30
30
  output "api_url" {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unoverse",
3
- "version": "0.1.105",
3
+ "version": "0.1.107",
4
4
  "description": "The Unoverse front door — create a Studio project, a universe, or a client app, and launch Studio.",
5
5
  "license": "SEE LICENSE IN README.md",
6
6
  "type": "module",