stacktape 3.5.8 → 3.6.0

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.
Files changed (123) hide show
  1. package/.tsconfig.bun-build.json +1 -0
  2. package/ai-docs/cli-ref/aws-profile-create.md +22 -0
  3. package/ai-docs/cli-ref/aws-profile-delete.md +22 -0
  4. package/ai-docs/cli-ref/aws-profile-list.md +20 -0
  5. package/ai-docs/cli-ref/aws-profile-update.md +22 -0
  6. package/ai-docs/cli-ref/bastion-session.md +29 -0
  7. package/ai-docs/cli-ref/bastion-tunnel.md +30 -0
  8. package/ai-docs/cli-ref/bucket-sync.md +30 -0
  9. package/ai-docs/cli-ref/cf-module-update.md +26 -0
  10. package/ai-docs/cli-ref/cf-rollback.md +28 -0
  11. package/ai-docs/cli-ref/codebuild-deploy.md +34 -0
  12. package/ai-docs/cli-ref/compile-template.md +25 -0
  13. package/ai-docs/cli-ref/container-session.md +30 -0
  14. package/ai-docs/cli-ref/debug-alarms.md +28 -0
  15. package/ai-docs/cli-ref/debug-aws-sdk.md +33 -0
  16. package/ai-docs/cli-ref/debug-container-exec.md +36 -0
  17. package/ai-docs/cli-ref/debug-dynamodb.md +35 -0
  18. package/ai-docs/cli-ref/debug-logs.md +34 -0
  19. package/ai-docs/cli-ref/debug-metrics.md +33 -0
  20. package/ai-docs/cli-ref/debug-opensearch.md +35 -0
  21. package/ai-docs/cli-ref/debug-redis.md +36 -0
  22. package/ai-docs/cli-ref/debug-sql.md +35 -0
  23. package/ai-docs/cli-ref/defaults-configure.md +29 -0
  24. package/ai-docs/cli-ref/defaults-list.md +20 -0
  25. package/ai-docs/cli-ref/delete.md +24 -0
  26. package/ai-docs/cli-ref/deploy.md +25 -0
  27. package/ai-docs/cli-ref/deployment-script-run.md +28 -0
  28. package/ai-docs/cli-ref/dev-stop.md +26 -0
  29. package/ai-docs/cli-ref/dev.md +45 -0
  30. package/ai-docs/cli-ref/domain-add.md +26 -0
  31. package/ai-docs/cli-ref/help.md +18 -0
  32. package/ai-docs/cli-ref/info-operations.md +22 -0
  33. package/ai-docs/cli-ref/info-stack.md +30 -0
  34. package/ai-docs/cli-ref/info-stacks.md +26 -0
  35. package/ai-docs/cli-ref/info-whoami.md +22 -0
  36. package/ai-docs/cli-ref/init.md +30 -0
  37. package/ai-docs/cli-ref/login.md +20 -0
  38. package/ai-docs/cli-ref/logout.md +18 -0
  39. package/ai-docs/cli-ref/mcp-add.md +22 -0
  40. package/ai-docs/cli-ref/mcp.md +20 -0
  41. package/ai-docs/cli-ref/org-create.md +24 -0
  42. package/ai-docs/cli-ref/org-delete.md +24 -0
  43. package/ai-docs/cli-ref/org-list.md +22 -0
  44. package/ai-docs/cli-ref/package-workloads.md +25 -0
  45. package/ai-docs/cli-ref/param-get.md +26 -0
  46. package/ai-docs/cli-ref/preview-changes.md +23 -0
  47. package/ai-docs/cli-ref/project-create.md +22 -0
  48. package/ai-docs/cli-ref/projects-list.md +22 -0
  49. package/ai-docs/cli-ref/rollback.md +28 -0
  50. package/ai-docs/cli-ref/script-run.md +29 -0
  51. package/ai-docs/cli-ref/secret-create.md +28 -0
  52. package/ai-docs/cli-ref/secret-delete.md +26 -0
  53. package/ai-docs/cli-ref/secret-get.md +26 -0
  54. package/ai-docs/cli-ref/upgrade.md +20 -0
  55. package/ai-docs/cli-ref/version.md +18 -0
  56. package/ai-docs/concept/connecting-resources.md +369 -0
  57. package/ai-docs/concept/directives.md +371 -0
  58. package/ai-docs/concept/extending-cloudformation.md +315 -0
  59. package/ai-docs/concept/overrides-and-transforms.md +352 -0
  60. package/ai-docs/concept/stages-and-environments.md +347 -0
  61. package/ai-docs/concept/typescript-config.md +447 -0
  62. package/ai-docs/concept/yaml-config.md +338 -0
  63. package/ai-docs/config-ref/_root.md +131 -0
  64. package/ai-docs/config-ref/application-load-balancer.md +1109 -0
  65. package/ai-docs/config-ref/astro-web.md +115 -0
  66. package/ai-docs/config-ref/aws-cdk-construct.md +68 -0
  67. package/ai-docs/config-ref/bastion.md +93 -0
  68. package/ai-docs/config-ref/batch-job.md +179 -0
  69. package/ai-docs/config-ref/bucket.md +348 -0
  70. package/ai-docs/config-ref/cdn.md +496 -0
  71. package/ai-docs/config-ref/custom-resource.md +80 -0
  72. package/ai-docs/config-ref/deployment-script.md +79 -0
  73. package/ai-docs/config-ref/dynamo-db-table.md +202 -0
  74. package/ai-docs/config-ref/edge-lambda-function.md +87 -0
  75. package/ai-docs/config-ref/efs-filesystem.md +72 -0
  76. package/ai-docs/config-ref/event-bus.md +63 -0
  77. package/ai-docs/config-ref/function.md +409 -0
  78. package/ai-docs/config-ref/hosting-bucket.md +171 -0
  79. package/ai-docs/config-ref/http-api-gateway.md +149 -0
  80. package/ai-docs/config-ref/http-endpoint.md +92 -0
  81. package/ai-docs/config-ref/kinesis-stream.md +97 -0
  82. package/ai-docs/config-ref/mongo-db-atlas-cluster.md +254 -0
  83. package/ai-docs/config-ref/multi-container-workload.md +399 -0
  84. package/ai-docs/config-ref/network-load-balancer.md +118 -0
  85. package/ai-docs/config-ref/nextjs-web.md +147 -0
  86. package/ai-docs/config-ref/nuxt-web.md +81 -0
  87. package/ai-docs/config-ref/open-search.md +206 -0
  88. package/ai-docs/config-ref/private-service.md +75 -0
  89. package/ai-docs/config-ref/redis-cluster.md +223 -0
  90. package/ai-docs/config-ref/relational-database.md +525 -0
  91. package/ai-docs/config-ref/remix-web.md +74 -0
  92. package/ai-docs/config-ref/sns-topic.md +69 -0
  93. package/ai-docs/config-ref/solidstart-web.md +75 -0
  94. package/ai-docs/config-ref/sqs-queue-not-empty.md +414 -0
  95. package/ai-docs/config-ref/sqs-queue.md +232 -0
  96. package/ai-docs/config-ref/state-machine.md +235 -0
  97. package/ai-docs/config-ref/sveltekit-web.md +81 -0
  98. package/ai-docs/config-ref/tanstack-web.md +75 -0
  99. package/ai-docs/config-ref/upstash-redis.md +59 -0
  100. package/ai-docs/config-ref/user-auth-pool.md +876 -0
  101. package/ai-docs/config-ref/web-app-firewall.md +212 -0
  102. package/ai-docs/config-ref/web-service.md +178 -0
  103. package/ai-docs/config-ref/worker-service.md +41 -0
  104. package/ai-docs/getting-started/console.md +232 -0
  105. package/ai-docs/getting-started/deployment.md +434 -0
  106. package/ai-docs/getting-started/dev-mode.md +118 -0
  107. package/ai-docs/getting-started/how-it-works.md +119 -0
  108. package/ai-docs/getting-started/intro.md +157 -0
  109. package/ai-docs/getting-started/using-with-ai.md +228 -0
  110. package/ai-docs/getting-started/workflow.md +197 -0
  111. package/ai-docs/index.json +1514 -0
  112. package/ai-docs/recipe/background-jobs.md +183 -0
  113. package/ai-docs/recipe/database-migrations.md +240 -0
  114. package/ai-docs/recipe/graphql-api.md +211 -0
  115. package/ai-docs/recipe/monorepo-setup.md +183 -0
  116. package/ai-docs/recipe/nextjs-full-stack.md +188 -0
  117. package/ai-docs/recipe/rest-api-with-database.md +156 -0
  118. package/ai-docs/recipe/scheduled-tasks.md +186 -0
  119. package/ai-docs/recipe/static-website.md +241 -0
  120. package/ai-docs/troubleshooting/cloudformation-stack-states.md +189 -0
  121. package/bin/stacktape.js +0 -12
  122. package/package.json +1 -1
  123. package/plain.d.ts +372 -111
@@ -0,0 +1,876 @@
1
+ ---
2
+ docType: config-ref
3
+ title: User Auth Pool
4
+ resourceType: user-auth-pool
5
+ tags:
6
+ - user-auth-pool
7
+ - cognito
8
+ - auth
9
+ - authentication
10
+ source: types/stacktape-config/user-pools.d.ts
11
+ priority: 1
12
+ ---
13
+
14
+ # User Auth Pool
15
+
16
+ A resource for managing user authentication and authorization.
17
+
18
+ A user pool is a fully managed identity provider that handles user sign-up, sign-in, and access control.
19
+ It provides a secure and scalable way to manage user identities for your applications.
20
+
21
+ Resource type: `user-auth-pool`
22
+
23
+ ## TypeScript Definition
24
+
25
+ ```typescript
26
+ /**
27
+ * #### A resource for managing user authentication and authorization.
28
+ *
29
+ * ---
30
+ *
31
+ * A user pool is a fully managed identity provider that handles user sign-up, sign-in, and access control.
32
+ * It provides a secure and scalable way to manage user identities for your applications.
33
+ */
34
+ interface UserAuthPool {
35
+ type: 'user-auth-pool';
36
+ properties?: UserAuthPoolProps;
37
+ overrides?: ResourceOverrides;
38
+ }
39
+
40
+ interface UserAuthPoolProps {
41
+ /**
42
+ * #### Restrict account creation to administrators
43
+ *
44
+ * ---
45
+ *
46
+ * If enabled, new users can't sign up themselves. Accounts must be created through an admin flow (for example from an internal admin tool or script),
47
+ * which helps prevent unwanted self-registrations.
48
+ *
49
+ * Internally this controls `AdminCreateUserConfig.AllowAdminCreateUserOnly` on the Cognito user pool
50
+ * ([AWS::Cognito::UserPool](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-cognito-userpool)).
51
+ *
52
+ * @default false
53
+ */
54
+ allowOnlyAdminsToCreateAccount?: boolean;
55
+ /**
56
+ * #### Expire unused admin-created accounts
57
+ *
58
+ * ---
59
+ *
60
+ * When an admin creates a user account, Cognito issues a temporary password. This setting controls how many days that temporary password
61
+ * (and the corresponding account) stays valid if the user never signs in.
62
+ *
63
+ * Internally this maps to `AdminCreateUserConfig.UnusedAccountValidityDays`.
64
+ *
65
+ * @default 31
66
+ */
67
+ unusedAccountValidityDays?: number;
68
+ /**
69
+ * #### (Reserved) Require verified emails
70
+ *
71
+ * ---
72
+ *
73
+ * Present for forward compatibility. Stacktape currently derives email / phone verification behavior from `userVerificationType`,
74
+ * not from this flag directly.
75
+ *
76
+ * To require email-based verification today, use `userVerificationType: 'email-link' | 'email-code'` instead.
77
+ */
78
+ requireEmailVerification?: boolean;
79
+ /**
80
+ * #### (Reserved) Require verified phone numbers
81
+ *
82
+ * ---
83
+ *
84
+ * Present for forward compatibility. Stacktape currently derives email / phone verification behavior from `userVerificationType`,
85
+ * not from this flag directly.
86
+ *
87
+ * To require SMS-based verification today, use `userVerificationType: 'sms'`.
88
+ */
89
+ requirePhoneNumberVerification?: boolean;
90
+ /**
91
+ * #### Enable the Cognito Hosted UI
92
+ *
93
+ * ---
94
+ *
95
+ * Turns on Cognito's Hosted UI – a pre-built, hosted login and registration page – so you don't have to build your own auth screens.
96
+ * This is useful when you want to get started quickly or keep authentication logic outside of your main app.
97
+ *
98
+ * @default false
99
+ */
100
+ enableHostedUi?: boolean;
101
+ /**
102
+ * #### Hosted UI domain prefix
103
+ *
104
+ * ---
105
+ *
106
+ * Sets the first part of your Hosted UI URL: `https://<prefix>.auth.<region>.amazoncognito.com`.
107
+ * Pick something that matches your project or company name.
108
+ */
109
+ hostedUiDomainPrefix?: string;
110
+ /**
111
+ * #### Custom CSS for the Hosted UI
112
+ *
113
+ * ---
114
+ *
115
+ * Lets you override the default Cognito Hosted UI styling with your own CSS (colors, fonts, layouts, etc.),
116
+ * so the login experience matches the rest of your application.
117
+ *
118
+ * Behind the scenes this is applied using the `AWS::Cognito::UserPoolUICustomizationAttachment` resource.
119
+ */
120
+ hostedUiCSS?: string;
121
+ /**
122
+ * #### Lambda triggers for the user pool
123
+ *
124
+ * ---
125
+ *
126
+ * Connects AWS Lambda functions to Cognito "hooks" (triggers) such as pre-sign-up, post-confirmation, or token generation.
127
+ * You can use these to enforce additional validation, enrich user profiles, migrate users from another system, and more.
128
+ *
129
+ * Internally this maps to the Cognito user pool `LambdaConfig`.
130
+ */
131
+ hooks?: UserPoolHooks;
132
+ /**
133
+ * #### Email delivery settings
134
+ *
135
+ * ---
136
+ *
137
+ * Controls how Cognito sends emails (verification messages, password reset codes, admin invitations, etc.).
138
+ * You can either use Cognito's built-in email service or plug in your own SES identity for full control over the sender.
139
+ *
140
+ * This config is used to build the Cognito `EmailConfiguration` block
141
+ * ([AWS docs](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-cognito-userpool)).
142
+ */
143
+ emailConfiguration?: EmailConfiguration;
144
+ /**
145
+ * #### Invite message overrides
146
+ *
147
+ * ---
148
+ *
149
+ * Customizes the contents of the "invitation" message that users receive when an administrator creates their account
150
+ * (for example, when sending a temporary password and sign-in instructions).
151
+ *
152
+ * If you want to send custom emails through SES, you must also configure `emailConfiguration.sesAddressArn`.
153
+ */
154
+ inviteMessageConfig?: InviteMessageConfig;
155
+ /**
156
+ * #### Verification strategy
157
+ *
158
+ * ---
159
+ *
160
+ * Chooses how new users prove that they own their contact information:
161
+ *
162
+ * - `email-link`: Cognito emails a clickable link.
163
+ * - `email-code`: Cognito emails a short numeric code.
164
+ * - `sms`: Cognito sends a code via SMS to the user's phone number.
165
+ * - `none`: Users aren't required to verify email or phone during sign-up.
166
+ *
167
+ * Stacktape uses this value to configure `AutoVerifiedAttributes` and `VerificationMessageTemplate`
168
+ * on the underlying Cognito user pool.
169
+ */
170
+ userVerificationType?: UserVerificationType;
171
+ /**
172
+ * #### Verification message text
173
+ *
174
+ * ---
175
+ *
176
+ * Lets you customize the exact email and SMS texts that Cognito sends when asking users to verify their email / phone.
177
+ * For example, you can change subjects, body text, or the message that contains the `{####}` verification code.
178
+ */
179
+ userVerificationMessageConfig?: UserVerificationMessageConfig;
180
+ /**
181
+ * #### Multi-factor authentication
182
+ *
183
+ * ---
184
+ *
185
+ * Controls whether you use Multi‑Factor Authentication (MFA) and which second factors are allowed.
186
+ * MFA makes it much harder for attackers to access accounts even if they know a user's password.
187
+ *
188
+ * Under the hood this config drives both the `MfaConfiguration` and `EnabledMfas` properties in Cognito
189
+ * (see "MFA configuration" in the
190
+ * [AWS::Cognito::UserPool docs](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-cognito-userpool)).
191
+ */
192
+ mfaConfiguration?: MfaConfiguration;
193
+ /**
194
+ * #### Password strength rules
195
+ *
196
+ * ---
197
+ *
198
+ * Defines how strong user passwords must be – minimum length and whether they must include lowercase, uppercase,
199
+ * numbers, and/or symbols – plus how long temporary passwords issued to new users remain valid.
200
+ *
201
+ * This is applied to the Cognito `Policies.PasswordPolicy` block.
202
+ */
203
+ passwordPolicy?: PasswordPolicy;
204
+ /**
205
+ * #### Custom attributes schema
206
+ *
207
+ * ---
208
+ *
209
+ * Lets you define additional attributes (like `role`, `plan`, `companyId`, etc.) that are stored on each user,
210
+ * including their data type and validation constraints.
211
+ *
212
+ * These translate into the Cognito user pool `Schema` entries
213
+ * ([schema docs](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-cognito-userpool)).
214
+ */
215
+ schema?: AttributeSchema[];
216
+ /**
217
+ * #### Allow phone numbers as usernames
218
+ *
219
+ * ---
220
+ *
221
+ * If enabled (the default), users can sign in using their phone number in addition to any traditional username.
222
+ * Turning this off means phone numbers can still be stored, but can't be used to log in.
223
+ *
224
+ * This is implemented via Cognito's `UsernameAttributes` configuration.
225
+ *
226
+ * @default true
227
+ */
228
+ allowPhoneNumberAsUserName?: boolean;
229
+ /**
230
+ * #### Allow email addresses as usernames
231
+ *
232
+ * ---
233
+ *
234
+ * If enabled (the default), users can sign in using their email address instead of a dedicated username.
235
+ * Turning this off means emails can still be stored, but can't be used to log in directly.
236
+ *
237
+ * This is also controlled through Cognito `UsernameAttributes`.
238
+ *
239
+ * @default true
240
+ */
241
+ allowEmailAsUserName?: boolean;
242
+ /**
243
+ * #### Access token lifetime
244
+ *
245
+ * ---
246
+ *
247
+ * Controls how long an access token issued by Cognito stays valid after login. Shorter lifetimes reduce the window
248
+ * in which a stolen token can be abused, at the cost of more frequent refreshes.
249
+ *
250
+ * This value is passed to the user pool client as `AccessTokenValidity`.
251
+ */
252
+ accessTokenValiditySeconds?: number;
253
+ /**
254
+ * #### ID token lifetime
255
+ *
256
+ * ---
257
+ *
258
+ * Controls how long an ID token (which contains user profile and claims) is accepted before clients must obtain a new one.
259
+ *
260
+ * This is set on the user pool client as `IdTokenValidity`.
261
+ */
262
+ idTokenValiditySeconds?: number;
263
+ /**
264
+ * #### Refresh token lifetime
265
+ *
266
+ * ---
267
+ *
268
+ * Sets for how many days a refresh token can be used to obtain new access / ID tokens without requiring the user to sign in again.
269
+ * Longer lifetimes mean fewer re-authentications, but keep sessions alive for longer.
270
+ *
271
+ * This value is used as `RefreshTokenValidity` on the Cognito user pool client.
272
+ */
273
+ refreshTokenValidityDays?: number;
274
+ /**
275
+ * #### OAuth flows
276
+ *
277
+ * ---
278
+ *
279
+ * Specifies which OAuth 2.0 flows the user pool client is allowed to use:
280
+ *
281
+ * - `code`: Authorization Code flow (recommended for web apps and backends).
282
+ * - `implicit`: Implicit flow (legacy browser-only flow).
283
+ * - `client_credentials`: Server‑to‑server (no end user) machine credentials.
284
+ *
285
+ * These values populate `AllowedOAuthFlows` on the Cognito user pool client
286
+ * ([AWS::Cognito::UserPoolClient](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-cognito-userpoolclient)).
287
+ */
288
+ allowedOAuthFlows?: AllowedOauthFlow[];
289
+ /**
290
+ * #### OAuth scopes
291
+ *
292
+ * ---
293
+ *
294
+ * Lists which scopes clients can request when using OAuth (for example `email`, `openid`, `profile`).
295
+ * Scopes control which user information and permissions your app receives in tokens.
296
+ *
297
+ * These values are passed to the user pool client as `AllowedOAuthScopes`.
298
+ */
299
+ allowedOAuthScopes?: string[];
300
+ /**
301
+ * #### OAuth callback URLs
302
+ *
303
+ * ---
304
+ *
305
+ * The allowed URLs where Cognito is permitted to redirect users after successful authentication.
306
+ * These must exactly match the URLs registered with your frontend / backend, otherwise the redirect will fail.
307
+ *
308
+ * Mapped into `CallbackURLs` and `DefaultRedirectURI` on the user pool client.
309
+ */
310
+ callbackURLs?: string[];
311
+ /**
312
+ * #### OAuth logout URLs
313
+ *
314
+ * ---
315
+ *
316
+ * The URLs Cognito can redirect users to after they log out of the Hosted UI or end their session.
317
+ * Must also be explicitly configured so that sign-out redirects don't fail.
318
+ *
319
+ * These populate the `LogoutURLs` list on the user pool client.
320
+ */
321
+ logoutURLs?: string[];
322
+ /**
323
+ * #### External identity providers
324
+ *
325
+ * ---
326
+ *
327
+ * Allows users to sign in with third‑party identity providers like Google, Facebook, Login with Amazon, OIDC, SAML, or Sign in with Apple.
328
+ * Each entry configures one external provider (client ID/secret, attribute mapping, requested scopes, and advanced provider‑specific options).
329
+ *
330
+ * Under the hood Stacktape creates separate `AWS::Cognito::UserPoolIdentityProvider` resources and registers them
331
+ * in the user pool client's `SupportedIdentityProviders`.
332
+ */
333
+ identityProviders?: IdentityProvider[];
334
+ /**
335
+ * #### Associate a WAF
336
+ *
337
+ * ---
338
+ *
339
+ * Links the user pool to a `web-app-firewall` resource, so requests to the Hosted UI and token endpoints are inspected
340
+ * by AWS WAF rules you configure in Stacktape.
341
+ *
342
+ * Stacktape does this by creating a `WebACLAssociation` between the user pool and the referenced firewall.
343
+ */
344
+ useFirewall?: string;
345
+ /**
346
+ * #### Custom Domain
347
+ *
348
+ * ---
349
+ *
350
+ * Configures a custom domain for the Cognito Hosted UI (e.g., `auth.example.com`).
351
+ *
352
+ * When configured, Cognito creates a CloudFront distribution to serve your custom domain.
353
+ * Stacktape automatically:
354
+ * - Configures the user pool domain with your custom domain and an ACM certificate from us-east-1
355
+ * - Creates a DNS record pointing to the CloudFront distribution
356
+ *
357
+ * The domain must be registered and verified in your Stacktape account with a valid ACM certificate in us-east-1.
358
+ */
359
+ customDomain?: UserPoolCustomDomainConfiguration;
360
+ /**
361
+ * #### Generate a client secret
362
+ *
363
+ * ---
364
+ *
365
+ * Asks Cognito to generate a secret for the user pool client. Use this when you have trusted backends (like APIs or server‑side apps)
366
+ * that can safely store a client secret and use confidential OAuth flows.
367
+ *
368
+ * This flag controls the `GenerateSecret` property on the user pool client.
369
+ *
370
+ * @default false
371
+ */
372
+ generateClientSecret?: boolean;
373
+ /**
374
+ * #### Force external identity providers
375
+ *
376
+ * ---
377
+ *
378
+ * If `true`, users can't sign in with a username/password against the Cognito user directory at all.
379
+ * Instead, they must always use one of the configured external identity providers (Google, SAML, etc.).
380
+ *
381
+ * Internally this removes `COGNITO` from `SupportedIdentityProviders` on the user pool client.
382
+ *
383
+ * @default false
384
+ */
385
+ allowOnlyExternalIdentityProviders?: boolean;
386
+ }
387
+
388
+ type AllowedOauthFlow = 'code' | 'implicit' | 'client_credentials';
389
+
390
+ type UserVerificationType = 'email-link' | 'email-code' | 'sms' | 'none';
391
+
392
+ interface UserPoolCustomDomainConfiguration {
393
+ /**
394
+ * #### Domain Name
395
+ *
396
+ * ---
397
+ *
398
+ * Fully qualified domain name for the Cognito Hosted UI (e.g., `auth.example.com`).
399
+ */
400
+ domainName: string;
401
+ /**
402
+ * #### Custom Certificate ARN
403
+ *
404
+ * ---
405
+ *
406
+ * ARN of an ACM certificate in **us-east-1** to use for this domain.
407
+ * By default, Stacktape uses the certificate associated with your domain in us-east-1.
408
+ *
409
+ * The certificate must be in us-east-1 because Cognito uses CloudFront for custom domains.
410
+ */
411
+ customCertificateArn?: string;
412
+ /**
413
+ * #### Disable DNS Record Creation
414
+ *
415
+ * ---
416
+ *
417
+ * If `true`, Stacktape will not create a DNS record for this domain.
418
+ *
419
+ * @default false
420
+ */
421
+ disableDnsRecordCreation?: boolean;
422
+ }
423
+
424
+ interface UserPoolHooks {
425
+ /**
426
+ * #### Custom message hook
427
+ *
428
+ * Triggered whenever Cognito is about to send an email or SMS (sign‑up, verification, password reset, etc.).
429
+ * Lets you fully customize message contents or dynamically choose language/branding.
430
+ *
431
+ * Value must be the ARN of a Lambda function configured to handle the "Custom Message" trigger.
432
+ */
433
+ customMessage?: string;
434
+ /**
435
+ * #### Post-authentication hook
436
+ *
437
+ * Runs after a user has successfully authenticated. You can use this to record analytics, update last‑login timestamps,
438
+ * or block access based on additional checks.
439
+ */
440
+ postAuthentication?: string;
441
+ /**
442
+ * #### Post-confirmation hook
443
+ *
444
+ * Runs right after a user confirms their account (for example via email link or admin confirmation).
445
+ * This is often used to create user records in your own database or to provision resources.
446
+ */
447
+ postConfirmation?: string;
448
+ /**
449
+ * #### Pre-authentication hook
450
+ *
451
+ * Invoked just before Cognito validates a user's credentials. You can use this to block sign‑in attempts
452
+ * based on IP, device, or user state (for example, soft‑deleting an account).
453
+ */
454
+ preAuthentication?: string;
455
+ /**
456
+ * #### Pre-sign-up hook
457
+ *
458
+ * Called before a new user is created. Useful for validating input, auto‑confirming trusted users,
459
+ * or blocking sign‑ups that don't meet your business rules.
460
+ */
461
+ preSignUp?: string;
462
+ /**
463
+ * #### Pre-token-generation hook
464
+ *
465
+ * Runs right before Cognito issues tokens. Lets you customize token claims (for example, adding roles or flags)
466
+ * based on external systems or additional logic.
467
+ */
468
+ preTokenGeneration?: string;
469
+ /**
470
+ * #### User migration hook
471
+ *
472
+ * Lets you migrate users on‑the‑fly from another user store. When someone tries to sign in but doesn't exist in Cognito,
473
+ * this trigger can look them up elsewhere, import them, and let the sign‑in continue.
474
+ */
475
+ userMigration?: string;
476
+ /**
477
+ * #### Create auth challenge hook
478
+ *
479
+ * Part of Cognito's custom auth flow. This trigger is used to generate a challenge (for example sending a custom OTP)
480
+ * after `DefineAuthChallenge` decides a challenge is needed.
481
+ */
482
+ createAuthChallenge?: string;
483
+ /**
484
+ * #### Define auth challenge hook
485
+ *
486
+ * Also part of the custom auth flow. It decides whether a user needs another challenge, has passed, or has failed,
487
+ * based on previous challenges and responses.
488
+ */
489
+ defineAuthChallenge?: string;
490
+ /**
491
+ * #### Verify auth challenge response hook
492
+ *
493
+ * Validates the user's response to a custom challenge (for example, checking an OTP the user provides).
494
+ */
495
+ verifyAuthChallengeResponse?: string;
496
+ }
497
+
498
+ interface EmailConfiguration {
499
+ /**
500
+ * #### SES identity to send emails from
501
+ *
502
+ * ---
503
+ *
504
+ * ARN of an SES verified identity (email address or domain) that Cognito should use when sending emails.
505
+ * Required when you want full control over sending (for example for MFA via `EMAIL_OTP`), because Cognito
506
+ * must switch into `DEVELOPER` email sending mode.
507
+ */
508
+ sesAddressArn?: string;
509
+ /**
510
+ * #### From address
511
+ *
512
+ * ---
513
+ *
514
+ * The email address that appears in the "From" field of messages sent by Cognito (if you're using SES).
515
+ * This address must be verified in SES if you're sending through your own identity.
516
+ */
517
+ from?: string;
518
+ /**
519
+ * #### Reply-to address
520
+ *
521
+ * ---
522
+ *
523
+ * Optional address where replies to Cognito emails should be delivered.
524
+ * If not set, replies go to the `from` address (or the default Cognito sender).
525
+ */
526
+ replyToEmailAddress?: string;
527
+ }
528
+
529
+ interface InviteMessageConfig {
530
+ /**
531
+ * #### Invitation email body
532
+ *
533
+ * ---
534
+ *
535
+ * The text of the email sent when an administrator creates a new user.
536
+ * You can reference placeholders like `{username}` and `{####}` (temporary password or code) in the message.
537
+ */
538
+ emailMessage?: string;
539
+ /**
540
+ * #### Invitation email subject
541
+ */
542
+ emailSubject?: string;
543
+ /**
544
+ * #### Invitation SMS body
545
+ *
546
+ * ---
547
+ *
548
+ * The content of the SMS message sent when new users are created with a phone number.
549
+ * As with email, you can include placeholders such as `{username}` and `{####}`.
550
+ */
551
+ smsMessage?: string;
552
+ }
553
+
554
+ interface UserVerificationMessageConfig {
555
+ /**
556
+ * #### Email body when verifying with a code
557
+ *
558
+ * Used when `userVerificationType` is `email-code`. The message typically contains a `{####}` placeholder
559
+ * that Cognito replaces with a one‑time verification code.
560
+ */
561
+ emailMessageUsingCode?: string;
562
+ /**
563
+ * #### Email body when verifying with a link
564
+ *
565
+ * Used when `userVerificationType` is `email-link`. Cognito replaces special markers like `{##verify your email##}`
566
+ * with a clickable URL.
567
+ */
568
+ emailMessageUsingLink?: string;
569
+ /**
570
+ * #### Email subject when verifying with a code
571
+ */
572
+ emailSubjectUsingCode?: string;
573
+ /**
574
+ * #### Email subject when verifying with a link
575
+ */
576
+ emailSubjectUsingLink?: string;
577
+ /**
578
+ * #### SMS verification message
579
+ *
580
+ * ---
581
+ *
582
+ * Text of the SMS Cognito sends when verifying a phone number (for example containing `{####}`).
583
+ */
584
+ smsMessage?: string;
585
+ }
586
+
587
+ interface AttributeSchema {
588
+ /**
589
+ * #### Attribute name
590
+ *
591
+ * The logical name of the attribute as it appears on the user (for example `given_name`, `plan`, or `tenantId`).
592
+ */
593
+ name?: string;
594
+ /**
595
+ * #### Attribute data type
596
+ *
597
+ * The value type stored for this attribute (`String`, `Number`, etc.).
598
+ * This is passed to Cognito's `AttributeDataType`.
599
+ */
600
+ attributeDataType?: string;
601
+ /**
602
+ * #### Developer-only attribute
603
+ *
604
+ * If true, the attribute is only readable/writable by privileged backend code and not exposed to end users directly.
605
+ */
606
+ developerOnlyAttribute?: boolean;
607
+ /**
608
+ * #### Mutable after sign-up
609
+ *
610
+ * Controls whether the attribute can be changed after it has been initially set.
611
+ */
612
+ mutable?: boolean;
613
+ /**
614
+ * #### Required at sign-up
615
+ *
616
+ * If true, users must supply this attribute when creating an account.
617
+ */
618
+ required?: boolean;
619
+ /**
620
+ * #### Maximum numeric value
621
+ */
622
+ numberMaxValue?: number;
623
+ /**
624
+ * #### Minimum numeric value
625
+ */
626
+ numberMinValue?: number;
627
+ /**
628
+ * #### Maximum string length
629
+ */
630
+ stringMaxLength?: number;
631
+ /**
632
+ * #### Minimum string length
633
+ */
634
+ stringMinLength?: number;
635
+ }
636
+
637
+ interface PasswordPolicy {
638
+ /**
639
+ * #### Minimum password length
640
+ *
641
+ * The fewest characters a password can have. Longer passwords are generally more secure.
642
+ */
643
+ minimumLength?: number;
644
+ /**
645
+ * #### Require at least one lowercase letter
646
+ */
647
+ requireLowercase?: boolean;
648
+ /**
649
+ * #### Require at least one number
650
+ */
651
+ requireNumbers?: boolean;
652
+ /**
653
+ * #### Require at least one symbol
654
+ *
655
+ * Symbols are non‑alphanumeric characters such as `!`, `@`, or `#`.
656
+ */
657
+ requireSymbols?: boolean;
658
+ /**
659
+ * #### Require at least one uppercase letter
660
+ */
661
+ requireUppercase?: boolean;
662
+ /**
663
+ * #### Temporary password validity (days)
664
+ *
665
+ * How long a temporary password issued to a new user is valid before it must be changed on first sign‑in.
666
+ */
667
+ temporaryPasswordValidityDays?: number;
668
+ }
669
+
670
+ interface MfaConfiguration {
671
+ /**
672
+ * #### MFA requirement
673
+ *
674
+ * - `OFF`: MFA is completely disabled.
675
+ * - `ON`: All users must complete MFA during sign‑in.
676
+ * - `OPTIONAL`: Users can opt in to MFA; it's recommended but not strictly required.
677
+ *
678
+ * This value configures the Cognito `MfaConfiguration` property.
679
+ */
680
+ status?: 'ON' | 'OFF' | 'OPTIONAL';
681
+ /**
682
+ * #### Enabled MFA factor types
683
+ *
684
+ * ---
685
+ *
686
+ * Chooses which MFA methods users can use:
687
+ *
688
+ * - `SMS`: One‑time codes are sent via text message. Requires an SNS role so Cognito can send SMS.
689
+ * - `SOFTWARE_TOKEN`: Time‑based one‑time codes from an authenticator app.
690
+ * - `EMAIL_OTP`: Codes are sent by email. AWS requires that you configure a developer email sending identity
691
+ * (which Stacktape does when you provide `emailConfiguration.sesAddressArn`).
692
+ *
693
+ * These values are mapped to Cognito's `EnabledMfas` setting (`SMS_MFA`, `SOFTWARE_TOKEN_MFA`, `EMAIL_OTP`),
694
+ * whose behavior is described in
695
+ * [EnabledMfas in the AWS::Cognito::UserPool docs](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-cognito-userpool).
696
+ */
697
+ enabledTypes?: ('SMS' | 'SOFTWARE_TOKEN' | 'EMAIL_OTP')[];
698
+ }
699
+
700
+ interface IdentityProvider {
701
+ /**
702
+ * #### Provider type
703
+ *
704
+ * ---
705
+ *
706
+ * The kind of external identity provider you want to integrate:
707
+ *
708
+ * - `Facebook`, `Google`, `LoginWithAmazon`, `SignInWithApple`: social identity providers.
709
+ * - `OIDC`: a generic OpenID Connect provider.
710
+ * - `SAML`: a SAML 2.0 identity provider (often used for enterprise SSO).
711
+ */
712
+ type: 'Facebook' | 'Google' | 'LoginWithAmazon' | 'OIDC' | 'SAML' | 'SignInWithApple';
713
+ /**
714
+ * #### OAuth / OIDC client ID
715
+ *
716
+ * ---
717
+ *
718
+ * The client ID (sometimes called app ID) that you obtained from the external provider's console.
719
+ * Cognito presents this ID when redirecting users to the provider.
720
+ */
721
+ clientId: string;
722
+ /**
723
+ * #### OAuth / OIDC client secret
724
+ *
725
+ * ---
726
+ *
727
+ * The client secret associated with the `clientId`, used by Cognito when exchanging authorization codes for tokens.
728
+ * This value should be kept confidential and only configured from secure sources.
729
+ */
730
+ clientSecret: string;
731
+ /**
732
+ * #### Attribute mapping
733
+ *
734
+ * ---
735
+ *
736
+ * Maps attributes from the external provider (for example `email`, `given_name`) to Cognito user pool attributes.
737
+ * Keys are Cognito attribute names, values are attribute names from the identity provider.
738
+ *
739
+ * If not provided, Stacktape defaults to mapping `email -> email`.
740
+ */
741
+ attributeMapping?: { [awsAttributeName: string]: string };
742
+ /**
743
+ * #### Requested scopes
744
+ *
745
+ * ---
746
+ *
747
+ * Additional OAuth scopes to request from the identity provider (for example `openid`, `email`, `profile`).
748
+ * These control which pieces of user information and permissions your app receives in the provider's tokens.
749
+ *
750
+ * If omitted, Stacktape uses a reasonable default per provider (see
751
+ * [AWS::Cognito::UserPoolIdentityProvider](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-cognito-userpoolidentityprovider)).
752
+ */
753
+ authorizeScopes?: string[];
754
+ /**
755
+ * #### Advanced provider options
756
+ *
757
+ * ---
758
+ *
759
+ * Low‑level configuration passed directly into Cognito's `ProviderDetails` map.
760
+ * You can use this to override endpoints or supply provider‑specific keys as documented by AWS,
761
+ * for example `authorize_url`, `token_url`, `attributes_request_method`, `oidc_issuer`, and others.
762
+ *
763
+ * In most cases you don't need to set this – Stacktape configures sensible defaults for common providers.
764
+ */
765
+ providerDetails?: Record<string, any>;
766
+ }
767
+
768
+ interface CognitoAuthorizerProperties {
769
+ /**
770
+ * #### Name of the user pool to protect the API
771
+ *
772
+ * ---
773
+ *
774
+ * The Stacktape name of the `user-auth-pool` resource whose tokens should be accepted by this HTTP API authorizer.
775
+ * Stacktape uses this to:
776
+ *
777
+ * - Set the expected **audience** to the user pool client ID.
778
+ * - Build the expected **issuer** URL based on the user pool and AWS region.
779
+ *
780
+ * In practice this means only JWTs issued by this pool (and its client) will be considered valid.
781
+ */
782
+ userPoolName: string;
783
+ /**
784
+ * #### Where to read the JWT from in the request
785
+ *
786
+ * ---
787
+ *
788
+ * A list of identity sources that tell API Gateway where to look for the bearer token, using the
789
+ * `$request.*` syntax from API Gateway (for example `'$request.header.Authorization'`).
790
+ *
791
+ * If you omit this, Stacktape defaults to reading the token from the `Authorization` HTTP header,
792
+ * using a JWT authorizer as described in the API Gateway v2 authorizer docs
793
+ * ([AWS::ApiGatewayV2::Authorizer](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-apigatewayv2-authorizer)).
794
+ */
795
+ identitySources?: string[];
796
+ }
797
+
798
+ interface CognitoAuthorizer {
799
+ /**
800
+ * #### Cognito JWT authorizer
801
+ *
802
+ * ---
803
+ *
804
+ * Configures an HTTP API authorizer that validates JSON Web Tokens (JWTs) issued by a Cognito user pool.
805
+ * This is the simplest way to protect routes when your users sign in via `user-auth-pool`.
806
+ *
807
+ * Stacktape turns this into an API Gateway v2 authorizer of type `JWT` that checks the token's issuer and audience.
808
+ */
809
+ type: 'cognito';
810
+ properties: CognitoAuthorizerProperties;
811
+ }
812
+
813
+ interface LambdaAuthorizerProperties {
814
+ /**
815
+ * #### Name of the authorizer function
816
+ *
817
+ * ---
818
+ *
819
+ * The Stacktape name of a `function` resource that should run for each authorized request.
820
+ * API Gateway calls this Lambda, passes request details, and uses its response to allow or deny access.
821
+ */
822
+ functionName: string;
823
+ /**
824
+ * #### Use IAM-style (v1) authorizer responses
825
+ *
826
+ * ---
827
+ *
828
+ * - If `true`, your Lambda must return a full IAM policy document (the "v1" format).
829
+ * - If `false` or omitted, Stacktape enables **simple responses** (the HTTP API v2 payload format)
830
+ * so your Lambda can return a small JSON object with an `isAuthorized` flag and optional context.
831
+ *
832
+ * This flag is wired to `EnableSimpleResponses` on the underlying `AWS::ApiGatewayV2::Authorizer`.
833
+ */
834
+ iamResponse?: boolean;
835
+ /**
836
+ * #### Where to read identity data from
837
+ *
838
+ * ---
839
+ *
840
+ * A list of request fields API Gateway should pass into your Lambda authorizer (for example headers, query parameters,
841
+ * or stage variables) using the `$request.*` syntax.
842
+ *
843
+ * When left empty, no specific identity sources are configured and your Lambda must inspect the incoming event directly.
844
+ */
845
+ identitySources?: string[];
846
+ /**
847
+ * #### Cache authorizer results
848
+ *
849
+ * ---
850
+ *
851
+ * Number of seconds API Gateway should cache the result of the Lambda authorizer for a given identity.
852
+ * While cached, repeated requests skip calling your authorizer function and reuse the previous result.
853
+ *
854
+ * This value is applied to `AuthorizerResultTtlInSeconds`. If omitted, Stacktape sets it to `0` (no caching).
855
+ */
856
+ cacheResultSeconds?: number;
857
+ }
858
+
859
+ interface LambdaAuthorizer {
860
+ /**
861
+ * #### Lambda-based HTTP API authorizer
862
+ *
863
+ * ---
864
+ *
865
+ * Configures an API Gateway **request** authorizer that runs a Lambda function to decide whether a request is allowed.
866
+ * This is useful when your authorization logic can't be expressed as simple JWT validation – for example when you
867
+ * check API keys, look up permissions in a database, or integrate with a non-JWT identity system.
868
+ *
869
+ * Stacktape creates an `AWS::ApiGatewayV2::Authorizer` of type `REQUEST` and wires it up to your Lambda.
870
+ */
871
+ type: 'lambda';
872
+ properties: LambdaAuthorizerProperties;
873
+ }
874
+
875
+ type UserPoolReferencableParam = 'id' | 'clientId' | 'arn' | 'domain' | 'clientSecret' | 'providerUrl';
876
+ ```