@go-to-k/cdkd 0.215.0 → 0.216.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.
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { a as setAwsClients, i as resetAwsClients, r as getAwsClients, t as AwsClients } from "./aws-clients-DWUnLza1.js";
|
|
3
|
-
import { $ as CFN_TEMPLATE_URL_LIMIT, A as DagBuilder, B as getDockerCmd, C as CloudControlProvider, D as IntrinsicFunctionResolver, Dt as withErrorHandling, E as isTerminationProtectionPropagationError, Et as normalizeAwsError, F as AssetPublisher, Ft as generateResourceName, G as getLegacyStateBucketName, H as runDockerStreaming, I as stringifyValue, It as generateResourceNameWithFallback, J as resolveSkipPrefix, K as resolveApp, L as WorkGraph, Lt as withSkipPrefix, M as LockManager, Mt as getLiveRenderer, N as S3StateBackend, Nt as PATTERN_B_NAME_PROPERTIES, O as applyRoleArnIfSet, P as shouldRetainResource, Pt as PATTERN_B_RESOURCE_TYPES, Q as CFN_TEMPLATE_BODY_LIMIT, R as buildDockerImage, Rt as withStackName, S as findActionableSilentDrops, T as disableInstanceApiTermination, U as Synthesizer, V as runDockerForeground, W as getDefaultStateBucketName, X as resolveStateBucketWithDefaultAndSource, Y as resolveStateBucketWithDefault, Z as warnDeprecatedNoPrefixCliFlag, _ as CDK_PATH_TAG, _t as ProvisioningError, a as withRetry, at as resolveBucketRegion, b as resolveExplicitPhysicalId, bt as StackHasActiveImportsError, c as formatResourceLine, d as gray, dt as LocalMigrateError, et as MIGRATE_TMP_PREFIX, f as green, ft as LocalStartServiceError, g as collectInlinePolicyNamesManagedBySiblings, gt as PartialFailureError, h as IAMRoleProvider, ht as NestedStackChildDirectDestroyError, i as withResourceDeadline, j as TemplateParser, jt as runStackBuffered, k as DiffCalculator, kt as getLogger, l as bold, m as yellow, mt as MissingCdkCliError, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as uploadCfnTemplate, o as isRetryableTransientError, p as red, q as resolveCaptureObservedState, r as DeployEngine, rt as AssemblyReader, s as IMPLICIT_DELETE_DEPENDENCIES, st as CdkdError, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as findLargeInlineResources, u as cyan, ut as LocalInvokeBuildError$1, v as matchesCdkPath, vt as ResourceTimeoutError, w as assertRegionMatch, x as ProviderRegistry, xt as StackTerminationProtectionError, y as normalizeAwsTagsToCfn, yt as ResourceUpdateNotSupportedError, z as formatDockerLoginError } from "./deploy-engine-
|
|
3
|
+
import { $ as CFN_TEMPLATE_URL_LIMIT, A as DagBuilder, B as getDockerCmd, C as CloudControlProvider, D as IntrinsicFunctionResolver, Dt as withErrorHandling, E as isTerminationProtectionPropagationError, Et as normalizeAwsError, F as AssetPublisher, Ft as generateResourceName, G as getLegacyStateBucketName, H as runDockerStreaming, I as stringifyValue, It as generateResourceNameWithFallback, J as resolveSkipPrefix, K as resolveApp, L as WorkGraph, Lt as withSkipPrefix, M as LockManager, Mt as getLiveRenderer, N as S3StateBackend, Nt as PATTERN_B_NAME_PROPERTIES, O as applyRoleArnIfSet, P as shouldRetainResource, Pt as PATTERN_B_RESOURCE_TYPES, Q as CFN_TEMPLATE_BODY_LIMIT, R as buildDockerImage, Rt as withStackName, S as findActionableSilentDrops, T as disableInstanceApiTermination, U as Synthesizer, V as runDockerForeground, W as getDefaultStateBucketName, X as resolveStateBucketWithDefaultAndSource, Y as resolveStateBucketWithDefault, Z as warnDeprecatedNoPrefixCliFlag, _ as CDK_PATH_TAG, _t as ProvisioningError, a as withRetry, at as resolveBucketRegion, b as resolveExplicitPhysicalId, bt as StackHasActiveImportsError, c as formatResourceLine, d as gray, dt as LocalMigrateError, et as MIGRATE_TMP_PREFIX, f as green, ft as LocalStartServiceError, g as collectInlinePolicyNamesManagedBySiblings, gt as PartialFailureError, h as IAMRoleProvider, ht as NestedStackChildDirectDestroyError, i as withResourceDeadline, j as TemplateParser, jt as runStackBuffered, k as DiffCalculator, kt as getLogger, l as bold, m as yellow, mt as MissingCdkCliError, n as DEFAULT_RESOURCE_WARN_AFTER_MS, nt as uploadCfnTemplate, o as isRetryableTransientError, p as red, q as resolveCaptureObservedState, r as DeployEngine, rt as AssemblyReader, s as IMPLICIT_DELETE_DEPENDENCIES, st as CdkdError, t as DEFAULT_RESOURCE_TIMEOUT_MS, tt as findLargeInlineResources, u as cyan, ut as LocalInvokeBuildError$1, v as matchesCdkPath, vt as ResourceTimeoutError, w as assertRegionMatch, x as ProviderRegistry, xt as StackTerminationProtectionError, y as normalizeAwsTagsToCfn, yt as ResourceUpdateNotSupportedError, z as formatDockerLoginError } from "./deploy-engine-hq-5c3kO.js";
|
|
4
4
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
5
5
|
import { randomBytes, randomUUID } from "node:crypto";
|
|
6
6
|
import { CopyObjectCommand, CreateBucketCommand, DeleteBucketAnalyticsConfigurationCommand, DeleteBucketCommand, DeleteBucketCorsCommand, DeleteBucketIntelligentTieringConfigurationCommand, DeleteBucketInventoryConfigurationCommand, DeleteBucketLifecycleCommand, DeleteBucketMetricsConfigurationCommand, DeleteBucketPolicyCommand, DeleteBucketReplicationCommand, DeleteBucketTaggingCommand, DeleteBucketWebsiteCommand, DeleteObjectsCommand, GetBucketAccelerateConfigurationCommand, GetBucketCorsCommand, GetBucketEncryptionCommand, GetBucketLifecycleConfigurationCommand, GetBucketLocationCommand, GetBucketLoggingCommand, GetBucketNotificationConfigurationCommand, GetBucketPolicyCommand, GetBucketReplicationCommand, GetBucketTaggingCommand, GetBucketVersioningCommand, GetBucketWebsiteCommand, GetObjectCommand, GetObjectLockConfigurationCommand, GetPublicAccessBlockCommand, HeadBucketCommand, ListBucketAnalyticsConfigurationsCommand, ListBucketIntelligentTieringConfigurationsCommand, ListBucketInventoryConfigurationsCommand, ListBucketMetricsConfigurationsCommand, ListBucketsCommand, ListDirectoryBucketsCommand, ListObjectVersionsCommand, ListObjectsV2Command, NoSuchBucket, PutBucketAccelerateConfigurationCommand, PutBucketAnalyticsConfigurationCommand, PutBucketCorsCommand, PutBucketEncryptionCommand, PutBucketIntelligentTieringConfigurationCommand, PutBucketInventoryConfigurationCommand, PutBucketLifecycleConfigurationCommand, PutBucketLoggingCommand, PutBucketMetricsConfigurationCommand, PutBucketNotificationConfigurationCommand, PutBucketOwnershipControlsCommand, PutBucketPolicyCommand, PutBucketReplicationCommand, PutBucketTaggingCommand, PutBucketVersioningCommand, PutBucketWebsiteCommand, PutObjectCommand, PutObjectLockConfigurationCommand, PutPublicAccessBlockCommand, S3Client, S3ServiceException } from "@aws-sdk/client-s3";
|
|
@@ -46,7 +46,7 @@ import { CreateClusterCommand, CreateServiceCommand, DeleteClusterCommand, Delet
|
|
|
46
46
|
import { AddTagsToResourceCommand as AddTagsToResourceCommand$2, CreateDBClusterCommand as CreateDBClusterCommand$1, CreateDBInstanceCommand as CreateDBInstanceCommand$1, CreateDBSubnetGroupCommand as CreateDBSubnetGroupCommand$1, DeleteDBClusterCommand as DeleteDBClusterCommand$1, DeleteDBInstanceCommand as DeleteDBInstanceCommand$1, DeleteDBSubnetGroupCommand as DeleteDBSubnetGroupCommand$1, DescribeDBClustersCommand as DescribeDBClustersCommand$1, DescribeDBInstancesCommand as DescribeDBInstancesCommand$1, DescribeDBSubnetGroupsCommand as DescribeDBSubnetGroupsCommand$1, DocDBClient, ListTagsForResourceCommand as ListTagsForResourceCommand$11, ModifyDBClusterCommand as ModifyDBClusterCommand$1, ModifyDBInstanceCommand as ModifyDBInstanceCommand$1, ModifyDBSubnetGroupCommand as ModifyDBSubnetGroupCommand$1, RemoveTagsFromResourceCommand as RemoveTagsFromResourceCommand$2 } from "@aws-sdk/client-docdb";
|
|
47
47
|
import { AddTagsToResourceCommand as AddTagsToResourceCommand$3, CreateDBClusterCommand as CreateDBClusterCommand$2, CreateDBInstanceCommand as CreateDBInstanceCommand$2, CreateDBSubnetGroupCommand as CreateDBSubnetGroupCommand$2, DeleteDBClusterCommand as DeleteDBClusterCommand$2, DeleteDBInstanceCommand as DeleteDBInstanceCommand$2, DeleteDBSubnetGroupCommand as DeleteDBSubnetGroupCommand$2, DescribeDBClustersCommand as DescribeDBClustersCommand$2, DescribeDBInstancesCommand as DescribeDBInstancesCommand$2, DescribeDBSubnetGroupsCommand as DescribeDBSubnetGroupsCommand$2, ListTagsForResourceCommand as ListTagsForResourceCommand$12, ModifyDBClusterCommand as ModifyDBClusterCommand$2, ModifyDBInstanceCommand as ModifyDBInstanceCommand$2, ModifyDBSubnetGroupCommand as ModifyDBSubnetGroupCommand$2, NeptuneClient, RemoveTagsFromResourceCommand as RemoveTagsFromResourceCommand$3 } from "@aws-sdk/client-neptune";
|
|
48
48
|
import { CreateWebACLCommand, DeleteWebACLCommand, GetWebACLCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$13, ListWebACLsCommand, TagResourceCommand as TagResourceCommand$13, UntagResourceCommand as UntagResourceCommand$12, UpdateWebACLCommand, WAFNonexistentItemException, WAFV2Client } from "@aws-sdk/client-wafv2";
|
|
49
|
-
import { CognitoIdentityProviderClient, CreateUserPoolCommand, DeleteUserPoolCommand, DescribeUserPoolCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$14, ListUserPoolsCommand, ResourceNotFoundException as ResourceNotFoundException$7, UpdateUserPoolCommand } from "@aws-sdk/client-cognito-identity-provider";
|
|
49
|
+
import { CognitoIdentityProviderClient, CreateUserPoolCommand, DeleteUserPoolCommand, DescribeUserPoolCommand, GetUserPoolMfaConfigCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$14, ListUserPoolsCommand, ResourceNotFoundException as ResourceNotFoundException$7, SetUserPoolMfaConfigCommand, UpdateUserPoolCommand } from "@aws-sdk/client-cognito-identity-provider";
|
|
50
50
|
import { AddTagsToResourceCommand as AddTagsToResourceCommand$4, CreateCacheClusterCommand, CreateCacheSubnetGroupCommand, DeleteCacheClusterCommand, DeleteCacheSubnetGroupCommand, DescribeCacheClustersCommand, DescribeCacheSubnetGroupsCommand, ElastiCacheClient, ListTagsForResourceCommand as ListTagsForResourceCommand$15, ModifyCacheClusterCommand, ModifyCacheSubnetGroupCommand, RemoveTagsFromResourceCommand as RemoveTagsFromResourceCommand$4 } from "@aws-sdk/client-elasticache";
|
|
51
51
|
import { CreatePrivateDnsNamespaceCommand, CreateServiceCommand as CreateServiceCommand$1, DeleteNamespaceCommand, DeleteServiceCommand as DeleteServiceCommand$1, GetNamespaceCommand, GetOperationCommand, GetServiceCommand, ListNamespacesCommand, ListServicesCommand as ListServicesCommand$1, ListTagsForResourceCommand as ListTagsForResourceCommand$16, NamespaceNotFound, ServiceDiscoveryClient, ServiceNotFound, UpdatePrivateDnsNamespaceCommand, UpdateServiceCommand as UpdateServiceCommand$1 } from "@aws-sdk/client-servicediscovery";
|
|
52
52
|
import { AppSyncClient, CreateApiKeyCommand, CreateDataSourceCommand, CreateGraphqlApiCommand, CreateResolverCommand, DeleteApiKeyCommand, DeleteDataSourceCommand, DeleteGraphqlApiCommand, DeleteResolverCommand, GetDataSourceCommand, GetGraphqlApiCommand, GetIntrospectionSchemaCommand, GetResolverCommand, ListApiKeysCommand, ListGraphqlApisCommand, NotFoundException as NotFoundException$4, StartSchemaCreationCommand, TagResourceCommand as TagResourceCommand$14, UntagResourceCommand as UntagResourceCommand$13, UpdateApiKeyCommand, UpdateDataSourceCommand, UpdateGraphqlApiCommand, UpdateResolverCommand } from "@aws-sdk/client-appsync";
|
|
@@ -24112,6 +24112,83 @@ function isEmptyObjectPlaceholder(value) {
|
|
|
24112
24112
|
return value !== null && typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === 0;
|
|
24113
24113
|
}
|
|
24114
24114
|
/**
|
|
24115
|
+
* The CFn `EnabledMfas` factor names AND their MFA-config-API meaning.
|
|
24116
|
+
*
|
|
24117
|
+
* `EnabledMfas` is a CFn-level `Array of String`, but Cognito has no
|
|
24118
|
+
* `EnabledMfas` field on `CreateUserPool` / `UpdateUserPool`. The factors are
|
|
24119
|
+
* activated via the separate `SetUserPoolMfaConfig` control-plane API, one
|
|
24120
|
+
* sub-block per factor:
|
|
24121
|
+
*
|
|
24122
|
+
* - `SMS_MFA` -> `SmsMfaConfiguration` (needs the pool's
|
|
24123
|
+
* `SmsConfiguration` SNS-caller ARN to be set too)
|
|
24124
|
+
* - `SOFTWARE_TOKEN_MFA` -> `SoftwareTokenMfaConfiguration.Enabled = true`
|
|
24125
|
+
* - `EMAIL_OTP` -> `EmailMfaConfiguration` (carries the email-OTP
|
|
24126
|
+
* message/subject template — i.e. CFn's
|
|
24127
|
+
* `EmailAuthenticationMessage` / `Subject`)
|
|
24128
|
+
*/
|
|
24129
|
+
const MFA_FACTOR_SMS = "SMS_MFA";
|
|
24130
|
+
const MFA_FACTOR_SOFTWARE_TOKEN = "SOFTWARE_TOKEN_MFA";
|
|
24131
|
+
const MFA_FACTOR_EMAIL_OTP = "EMAIL_OTP";
|
|
24132
|
+
/**
|
|
24133
|
+
* Build the `SetUserPoolMfaConfig` request from the CFn-level MFA properties,
|
|
24134
|
+
* or return `undefined` when none of the MFA-config-API-routed properties are
|
|
24135
|
+
* present (so the caller skips the extra control-plane call entirely).
|
|
24136
|
+
*
|
|
24137
|
+
* The properties that route through `SetUserPoolMfaConfig` (NOT CreateUserPool):
|
|
24138
|
+
* - `EnabledMfas` -> per-factor sub-blocks (see constants above)
|
|
24139
|
+
* - `EmailAuthenticationMessage`/`EmailAuthenticationSubject` -> the
|
|
24140
|
+
* `EmailMfaConfiguration` message/subject (email-OTP template)
|
|
24141
|
+
* - `WebAuthnRelyingPartyID`/`WebAuthnUserVerification` -> `WebAuthnConfiguration`
|
|
24142
|
+
*
|
|
24143
|
+
* `MfaConfiguration` (ON/OFF/OPTIONAL) MUST be threaded into this request:
|
|
24144
|
+
* `SetUserPoolMfaConfig` is a full-replace of the pool's MFA state, and an
|
|
24145
|
+
* omitted `MfaConfiguration` defaults to OFF on the wire — which resets the
|
|
24146
|
+
* pool to MFA-disabled and makes AWS reject (or silently drop) the per-factor
|
|
24147
|
+
* sub-blocks we are trying to enable. Use the template's `MfaConfiguration`
|
|
24148
|
+
* when present; default to `OPTIONAL` when factors are present but the template
|
|
24149
|
+
* omitted it (factors are meaningless under OFF, and OPTIONAL enables them
|
|
24150
|
+
* without forcing MFA on every user).
|
|
24151
|
+
*/
|
|
24152
|
+
/**
|
|
24153
|
+
* True when any MFA-config-API-routed property is present, i.e. a
|
|
24154
|
+
* `SetUserPoolMfaConfig` call will run post-create. When true, `create()` must
|
|
24155
|
+
* NOT forward `MfaConfiguration` to `CreateUserPool`: AWS rejects
|
|
24156
|
+
* `CreateUserPool` with `MfaConfiguration: ON/OPTIONAL` unless the pool already
|
|
24157
|
+
* has SMS configured (+ phone_number auto-verification) OR software-token MFA
|
|
24158
|
+
* enabled — but software-token / email-OTP MFA can only be enabled via the
|
|
24159
|
+
* post-create `SetUserPoolMfaConfig` call, not on `CreateUserPool`. So the
|
|
24160
|
+
* correct sequence is: `CreateUserPool` WITHOUT `MfaConfiguration` (defaults
|
|
24161
|
+
* OFF) -> `SetUserPoolMfaConfig` sets `MfaConfiguration` + the factor blocks
|
|
24162
|
+
* together (the factor satisfies the MFA requirement, no SMS needed). This
|
|
24163
|
+
* mirrors how CloudFormation/CDK sequence the two calls.
|
|
24164
|
+
*/
|
|
24165
|
+
function hasMfaConfigProps(properties) {
|
|
24166
|
+
const enabledMfas = Array.isArray(properties["EnabledMfas"]) ? properties["EnabledMfas"] : void 0;
|
|
24167
|
+
return enabledMfas !== void 0 && enabledMfas.length > 0 || !!properties["EmailAuthenticationMessage"] || !!properties["EmailAuthenticationSubject"] || !!properties["WebAuthnRelyingPartyID"] || !!properties["WebAuthnUserVerification"];
|
|
24168
|
+
}
|
|
24169
|
+
function buildMfaConfigRequest(physicalId, properties) {
|
|
24170
|
+
const enabledMfas = Array.isArray(properties["EnabledMfas"]) ? properties["EnabledMfas"] : void 0;
|
|
24171
|
+
const emailMessage = properties["EmailAuthenticationMessage"] || void 0;
|
|
24172
|
+
const emailSubject = properties["EmailAuthenticationSubject"] || void 0;
|
|
24173
|
+
const webAuthnRpId = properties["WebAuthnRelyingPartyID"] || void 0;
|
|
24174
|
+
const webAuthnUserVerification = properties["WebAuthnUserVerification"] || void 0;
|
|
24175
|
+
if (!hasMfaConfigProps(properties)) return void 0;
|
|
24176
|
+
const request = { UserPoolId: physicalId };
|
|
24177
|
+
request.MfaConfiguration = properties["MfaConfiguration"] ?? "OPTIONAL";
|
|
24178
|
+
const factors = new Set(enabledMfas ?? []);
|
|
24179
|
+
if (factors.has(MFA_FACTOR_SOFTWARE_TOKEN)) request.SoftwareTokenMfaConfiguration = { Enabled: true };
|
|
24180
|
+
if (factors.has(MFA_FACTOR_SMS)) request.SmsMfaConfiguration = { ...properties["SmsConfiguration"] ? { SmsConfiguration: properties["SmsConfiguration"] } : {} };
|
|
24181
|
+
if (factors.has(MFA_FACTOR_EMAIL_OTP) || emailMessage !== void 0 || emailSubject !== void 0) request.EmailMfaConfiguration = {
|
|
24182
|
+
...emailMessage !== void 0 ? { Message: emailMessage } : {},
|
|
24183
|
+
...emailSubject !== void 0 ? { Subject: emailSubject } : {}
|
|
24184
|
+
};
|
|
24185
|
+
if (webAuthnRpId !== void 0 || webAuthnUserVerification !== void 0) request.WebAuthnConfiguration = {
|
|
24186
|
+
...webAuthnRpId !== void 0 ? { RelyingPartyId: webAuthnRpId } : {},
|
|
24187
|
+
...webAuthnUserVerification !== void 0 ? { UserVerification: webAuthnUserVerification } : {}
|
|
24188
|
+
};
|
|
24189
|
+
return request;
|
|
24190
|
+
}
|
|
24191
|
+
/**
|
|
24115
24192
|
* AWS Cognito User Pool Provider
|
|
24116
24193
|
*
|
|
24117
24194
|
* Implements resource provisioning for AWS::Cognito::UserPool using the Cognito SDK.
|
|
@@ -24146,8 +24223,15 @@ var CognitoUserPoolProvider = class {
|
|
|
24146
24223
|
"EmailVerificationMessage",
|
|
24147
24224
|
"EmailVerificationSubject",
|
|
24148
24225
|
"SmsAuthenticationMessage",
|
|
24149
|
-
"SmsVerificationMessage"
|
|
24226
|
+
"SmsVerificationMessage",
|
|
24227
|
+
"UserPoolTier",
|
|
24228
|
+
"EnabledMfas",
|
|
24229
|
+
"EmailAuthenticationMessage",
|
|
24230
|
+
"EmailAuthenticationSubject",
|
|
24231
|
+
"WebAuthnRelyingPartyID",
|
|
24232
|
+
"WebAuthnUserVerification"
|
|
24150
24233
|
])]]);
|
|
24234
|
+
unhandledByDesign = new Map([["AWS::Cognito::UserPool", new Map([["WebAuthnFactorConfiguration", "No SDK wire path: @aws-sdk/client-cognito-identity-provider has no field accepting SINGLE_FACTOR | MULTI_FACTOR_WITH_USER_VERIFICATION (not on CreateUserPool/UpdateUserPool, nor SetUserPoolMfaConfig.WebAuthnConfiguration which only carries RelyingPartyId/UserVerification); CC-API-registry-only property"]])]]);
|
|
24151
24235
|
getClient() {
|
|
24152
24236
|
if (!this.cognitoClient) this.cognitoClient = new CognitoIdentityProviderClient(this.providerRegion ? { region: this.providerRegion } : {});
|
|
24153
24237
|
return this.cognitoClient;
|
|
@@ -24158,6 +24242,7 @@ var CognitoUserPoolProvider = class {
|
|
|
24158
24242
|
async create(logicalId, resourceType, properties) {
|
|
24159
24243
|
this.logger.debug(`Creating Cognito User Pool ${logicalId}`);
|
|
24160
24244
|
const poolName = properties["UserPoolName"] || generateResourceName(logicalId, { maxLength: 128 });
|
|
24245
|
+
let createdUserPoolId;
|
|
24161
24246
|
try {
|
|
24162
24247
|
const createParams = { PoolName: poolName };
|
|
24163
24248
|
if (properties["AutoVerifiedAttributes"]) createParams.AutoVerifiedAttributes = properties["AutoVerifiedAttributes"];
|
|
@@ -24168,7 +24253,7 @@ var CognitoUserPoolProvider = class {
|
|
|
24168
24253
|
}
|
|
24169
24254
|
if (properties["Schema"]) createParams.Schema = properties["Schema"];
|
|
24170
24255
|
if (properties["LambdaConfig"]) createParams.LambdaConfig = properties["LambdaConfig"];
|
|
24171
|
-
if (properties["MfaConfiguration"]) createParams.MfaConfiguration = properties["MfaConfiguration"];
|
|
24256
|
+
if (properties["MfaConfiguration"] && !hasMfaConfigProps(properties)) createParams.MfaConfiguration = properties["MfaConfiguration"];
|
|
24172
24257
|
if (properties["UserPoolTags"]) createParams.UserPoolTags = properties["UserPoolTags"];
|
|
24173
24258
|
if (properties["AdminCreateUserConfig"]) createParams.AdminCreateUserConfig = properties["AdminCreateUserConfig"];
|
|
24174
24259
|
if (properties["AccountRecoverySetting"]) createParams.AccountRecoverySetting = properties["AccountRecoverySetting"];
|
|
@@ -24185,13 +24270,16 @@ var CognitoUserPoolProvider = class {
|
|
|
24185
24270
|
if (properties["EmailVerificationSubject"]) createParams.EmailVerificationSubject = properties["EmailVerificationSubject"];
|
|
24186
24271
|
if (properties["SmsAuthenticationMessage"]) createParams.SmsAuthenticationMessage = properties["SmsAuthenticationMessage"];
|
|
24187
24272
|
if (properties["SmsVerificationMessage"]) createParams.SmsVerificationMessage = properties["SmsVerificationMessage"];
|
|
24273
|
+
if (properties["UserPoolTier"]) createParams.UserPoolTier = properties["UserPoolTier"];
|
|
24188
24274
|
const userPool = (await this.getClient().send(new CreateUserPoolCommand(createParams))).UserPool;
|
|
24189
24275
|
if (!userPool?.Id) throw new Error("CreateUserPool did not return UserPool.Id");
|
|
24190
24276
|
const userPoolId = userPool.Id;
|
|
24277
|
+
createdUserPoolId = userPoolId;
|
|
24191
24278
|
const userPoolArn = userPool.Arn;
|
|
24192
24279
|
const region = await this.getClient().config.region();
|
|
24193
24280
|
const providerName = `cognito-idp.${region}.amazonaws.com/${userPoolId}`;
|
|
24194
24281
|
const providerUrl = `https://cognito-idp.${region}.amazonaws.com/${userPoolId}`;
|
|
24282
|
+
await this.applyMfaConfig(userPoolId, properties);
|
|
24195
24283
|
this.logger.debug(`Successfully created Cognito User Pool ${logicalId}: ${userPoolId}`);
|
|
24196
24284
|
return {
|
|
24197
24285
|
physicalId: userPoolId,
|
|
@@ -24203,11 +24291,46 @@ var CognitoUserPoolProvider = class {
|
|
|
24203
24291
|
}
|
|
24204
24292
|
};
|
|
24205
24293
|
} catch (error) {
|
|
24294
|
+
if (createdUserPoolId) try {
|
|
24295
|
+
await this.getClient().send(new DeleteUserPoolCommand({ UserPoolId: createdUserPoolId }));
|
|
24296
|
+
this.logger.debug(`Rolled back partially-created Cognito User Pool ${createdUserPoolId}`);
|
|
24297
|
+
} catch (rollbackError) {
|
|
24298
|
+
this.logger.warn(`Failed to roll back partially-created Cognito User Pool ${createdUserPoolId}: ${rollbackError instanceof Error ? rollbackError.message : String(rollbackError)}`);
|
|
24299
|
+
}
|
|
24206
24300
|
const cause = error instanceof Error ? error : void 0;
|
|
24207
24301
|
throw new ProvisioningError(`Failed to create Cognito User Pool ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, poolName, cause);
|
|
24208
24302
|
}
|
|
24209
24303
|
}
|
|
24210
24304
|
/**
|
|
24305
|
+
* Apply the MFA-config-API-routed properties (EnabledMfas / email-OTP
|
|
24306
|
+
* message+subject / WebAuthn) via SetUserPoolMfaConfig. No-op when none are
|
|
24307
|
+
* present. Wrapped in a transient-error retry because back-to-back
|
|
24308
|
+
* control-plane writes on a freshly-created pool can briefly conflict
|
|
24309
|
+
* (mirrors DynamoDBTableProvider.retryOnTransientControlPlane).
|
|
24310
|
+
*/
|
|
24311
|
+
async applyMfaConfig(physicalId, properties) {
|
|
24312
|
+
const request = buildMfaConfigRequest(physicalId, properties);
|
|
24313
|
+
if (!request) return;
|
|
24314
|
+
await this.retryOnTransientControlPlane(() => this.getClient().send(new SetUserPoolMfaConfigCommand(request)), `SetUserPoolMfaConfig(${physicalId})`);
|
|
24315
|
+
}
|
|
24316
|
+
/**
|
|
24317
|
+
* Retry a Cognito control-plane call on transient "settling" errors. A
|
|
24318
|
+
* SetUserPoolMfaConfig issued immediately after CreateUserPool (or another
|
|
24319
|
+
* control-plane write) can briefly hit `ConcurrentModificationException` /
|
|
24320
|
+
* "please retry". Backoff 1s -> 2s -> 4s, default 3 attempts.
|
|
24321
|
+
*/
|
|
24322
|
+
async retryOnTransientControlPlane(fn, label, maxAttempts = 3) {
|
|
24323
|
+
for (let attempt = 1;; attempt++) try {
|
|
24324
|
+
return await fn();
|
|
24325
|
+
} catch (error) {
|
|
24326
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
24327
|
+
if (!((error instanceof Error ? error.name : "") === "ConcurrentModificationException" || /concurrent modification|please retry|try again|in progress/i.test(msg)) || attempt >= maxAttempts) throw error;
|
|
24328
|
+
const delayMs = Math.min(1e3 * 2 ** (attempt - 1), 4e3);
|
|
24329
|
+
this.logger.debug(`Transient error on "${label}" (attempt ${attempt}/${maxAttempts}): ${msg} — retrying in ${delayMs}ms`);
|
|
24330
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
24331
|
+
}
|
|
24332
|
+
}
|
|
24333
|
+
/**
|
|
24211
24334
|
* Update a Cognito User Pool
|
|
24212
24335
|
*
|
|
24213
24336
|
* Note: PoolName (UserPoolName) and Schema are immutable and cannot be changed after creation.
|
|
@@ -24238,7 +24361,9 @@ var CognitoUserPoolProvider = class {
|
|
|
24238
24361
|
if (properties["EmailVerificationSubject"] !== void 0) updateParams.EmailVerificationSubject = properties["EmailVerificationSubject"];
|
|
24239
24362
|
if (properties["SmsAuthenticationMessage"] !== void 0) updateParams.SmsAuthenticationMessage = properties["SmsAuthenticationMessage"];
|
|
24240
24363
|
if (properties["SmsVerificationMessage"] !== void 0) updateParams.SmsVerificationMessage = properties["SmsVerificationMessage"];
|
|
24364
|
+
if (properties["UserPoolTier"]) updateParams.UserPoolTier = properties["UserPoolTier"];
|
|
24241
24365
|
await this.getClient().send(new UpdateUserPoolCommand(updateParams));
|
|
24366
|
+
await this.applyMfaConfig(physicalId, properties);
|
|
24242
24367
|
this.logger.debug(`Successfully updated Cognito User Pool ${logicalId}`);
|
|
24243
24368
|
const userPool = (await this.getClient().send(new DescribeUserPoolCommand({ UserPoolId: physicalId }))).UserPool;
|
|
24244
24369
|
const region = await this.getClient().config.region();
|
|
@@ -24372,6 +24497,21 @@ var CognitoUserPoolProvider = class {
|
|
|
24372
24497
|
for (const [k, v] of Object.entries(pool.UserPoolTags)) if (!k.startsWith("aws:")) userTags[k] = v;
|
|
24373
24498
|
}
|
|
24374
24499
|
result["UserPoolTags"] = userTags;
|
|
24500
|
+
result["UserPoolTier"] = pool.UserPoolTier ?? "ESSENTIALS";
|
|
24501
|
+
try {
|
|
24502
|
+
const mfa = await this.getClient().send(new GetUserPoolMfaConfigCommand({ UserPoolId: physicalId }));
|
|
24503
|
+
const enabledMfas = [];
|
|
24504
|
+
if (mfa.SmsMfaConfiguration) enabledMfas.push(MFA_FACTOR_SMS);
|
|
24505
|
+
if (mfa.SoftwareTokenMfaConfiguration?.Enabled) enabledMfas.push(MFA_FACTOR_SOFTWARE_TOKEN);
|
|
24506
|
+
if (mfa.EmailMfaConfiguration) enabledMfas.push(MFA_FACTOR_EMAIL_OTP);
|
|
24507
|
+
result["EnabledMfas"] = enabledMfas;
|
|
24508
|
+
result["EmailAuthenticationMessage"] = mfa.EmailMfaConfiguration?.Message ?? "";
|
|
24509
|
+
result["EmailAuthenticationSubject"] = mfa.EmailMfaConfiguration?.Subject ?? "";
|
|
24510
|
+
result["WebAuthnRelyingPartyID"] = mfa.WebAuthnConfiguration?.RelyingPartyId ?? "";
|
|
24511
|
+
result["WebAuthnUserVerification"] = mfa.WebAuthnConfiguration?.UserVerification ?? "";
|
|
24512
|
+
} catch (mfaErr) {
|
|
24513
|
+
this.logger.debug(`GetUserPoolMfaConfig failed for ${physicalId}, skipping MFA-derived drift keys: ${mfaErr instanceof Error ? mfaErr.message : String(mfaErr)}`);
|
|
24514
|
+
}
|
|
24375
24515
|
return result;
|
|
24376
24516
|
}
|
|
24377
24517
|
/**
|
|
@@ -53033,7 +53173,7 @@ function reorderArgs(argv) {
|
|
|
53033
53173
|
async function main() {
|
|
53034
53174
|
installPipeCloseHandler();
|
|
53035
53175
|
const program = new Command();
|
|
53036
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.
|
|
53176
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.216.0");
|
|
53037
53177
|
program.addCommand(createBootstrapCommand());
|
|
53038
53178
|
program.addCommand(createSynthCommand());
|
|
53039
53179
|
program.addCommand(createListCommand());
|