@go-to-k/cdkd 0.102.2 → 0.102.3
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 +75 -43
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3435,15 +3435,27 @@ var S3BucketProvider = class {
|
|
|
3435
3435
|
const region = await this.getRegion();
|
|
3436
3436
|
if (region !== "us-east-1") createParams.CreateBucketConfiguration = { LocationConstraint: region };
|
|
3437
3437
|
if (properties["ObjectLockEnabled"] === true || properties["ObjectLockEnabled"] === "true") createParams.ObjectLockEnabledForBucket = true;
|
|
3438
|
+
let createdNewBucket = false;
|
|
3438
3439
|
try {
|
|
3439
3440
|
await this.s3Client.send(new CreateBucketCommand(createParams));
|
|
3441
|
+
createdNewBucket = true;
|
|
3440
3442
|
this.logger.debug(`Created S3 bucket: ${bucketName}`);
|
|
3441
3443
|
} catch (createError) {
|
|
3442
3444
|
if (createError instanceof Error && (createError.name === "BucketAlreadyOwnedByYou" || createError.message.includes("you already own it"))) this.logger.debug(`S3 bucket ${bucketName} already exists and is owned by you`);
|
|
3443
3445
|
else throw createError;
|
|
3444
3446
|
}
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
+
try {
|
|
3448
|
+
await this.applyConfiguration(bucketName, properties);
|
|
3449
|
+
await this.applyAllSubConfigsForCreate(bucketName, properties);
|
|
3450
|
+
} catch (innerError) {
|
|
3451
|
+
if (createdNewBucket) try {
|
|
3452
|
+
await this.s3Client.send(new DeleteBucketCommand({ Bucket: bucketName }));
|
|
3453
|
+
this.logger.debug(`Cleaned up partially-created S3 bucket ${logicalId} (${bucketName}) after wiring failure`);
|
|
3454
|
+
} catch (cleanupError) {
|
|
3455
|
+
this.logger.warn(`Failed to clean up partially-created S3 bucket ${logicalId} (${bucketName}): ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}. Manual deletion may be required before the next deploy: aws s3api delete-bucket --bucket '${bucketName}'`);
|
|
3456
|
+
}
|
|
3457
|
+
throw innerError;
|
|
3458
|
+
}
|
|
3447
3459
|
const attributes = await this.buildAttributes(bucketName);
|
|
3448
3460
|
this.logger.debug(`Successfully created S3 bucket ${logicalId}: ${bucketName}`);
|
|
3449
3461
|
return {
|
|
@@ -7810,46 +7822,56 @@ var LogsLogGroupProvider = class {
|
|
|
7810
7822
|
const cfnTags = properties["Tags"];
|
|
7811
7823
|
createParams.tags = Object.fromEntries(cfnTags.map((t) => [t.Key, t.Value]));
|
|
7812
7824
|
}
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
|
|
7818
|
-
|
|
7819
|
-
|
|
7820
|
-
const policyDocument = typeof properties["DataProtectionPolicy"] === "string" ? properties["DataProtectionPolicy"] : JSON.stringify(properties["DataProtectionPolicy"]);
|
|
7821
|
-
await this.logsClient.send(new PutDataProtectionPolicyCommand({
|
|
7822
|
-
logGroupIdentifier: logGroupName,
|
|
7823
|
-
policyDocument
|
|
7824
|
-
}));
|
|
7825
|
+
let createdNewLogGroup = false;
|
|
7826
|
+
try {
|
|
7827
|
+
await this.logsClient.send(new CreateLogGroupCommand(createParams));
|
|
7828
|
+
createdNewLogGroup = true;
|
|
7829
|
+
} catch (createError) {
|
|
7830
|
+
if (createError instanceof ResourceAlreadyExistsException) this.logger.debug(`Log group ${logGroupName} already exists, using existing`);
|
|
7831
|
+
else throw createError;
|
|
7825
7832
|
}
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
if (
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
|
|
7833
|
+
try {
|
|
7834
|
+
const retentionInDays = properties["RetentionInDays"];
|
|
7835
|
+
if (retentionInDays) await this.logsClient.send(new PutRetentionPolicyCommand({
|
|
7836
|
+
logGroupName,
|
|
7837
|
+
retentionInDays
|
|
7838
|
+
}));
|
|
7839
|
+
if (properties["DataProtectionPolicy"]) {
|
|
7840
|
+
const policyDocument = typeof properties["DataProtectionPolicy"] === "string" ? properties["DataProtectionPolicy"] : JSON.stringify(properties["DataProtectionPolicy"]);
|
|
7841
|
+
await this.logsClient.send(new PutDataProtectionPolicyCommand({
|
|
7842
|
+
logGroupIdentifier: logGroupName,
|
|
7843
|
+
policyDocument
|
|
7844
|
+
}));
|
|
7845
|
+
}
|
|
7846
|
+
const fieldIndexPolicies = properties["FieldIndexPolicies"];
|
|
7847
|
+
if (fieldIndexPolicies && fieldIndexPolicies.length > 0) {
|
|
7848
|
+
if (fieldIndexPolicies.length > 1) this.logger.debug(`Log group ${logicalId} declares ${fieldIndexPolicies.length} FieldIndexPolicies; AWS only supports one log-group-level field index policy. Applying the first.`);
|
|
7849
|
+
const first = fieldIndexPolicies[0];
|
|
7850
|
+
const policyDocument = typeof first === "string" ? first : JSON.stringify(first);
|
|
7851
|
+
await this.logsClient.send(new PutIndexPolicyCommand({
|
|
7852
|
+
logGroupIdentifier: logGroupName,
|
|
7853
|
+
policyDocument
|
|
7854
|
+
}));
|
|
7855
|
+
}
|
|
7856
|
+
if (properties["BearerTokenAuthenticationEnabled"] !== void 0) await this.logsClient.send(new PutBearerTokenAuthenticationCommand({
|
|
7832
7857
|
logGroupIdentifier: logGroupName,
|
|
7833
|
-
|
|
7858
|
+
bearerTokenAuthenticationEnabled: properties["BearerTokenAuthenticationEnabled"]
|
|
7834
7859
|
}));
|
|
7860
|
+
} catch (innerError) {
|
|
7861
|
+
if (createdNewLogGroup) try {
|
|
7862
|
+
await this.logsClient.send(new DeleteLogGroupCommand({ logGroupName }));
|
|
7863
|
+
this.logger.debug(`Cleaned up partially-created log group ${logicalId} (${logGroupName}) after wiring failure`);
|
|
7864
|
+
} catch (cleanupError) {
|
|
7865
|
+
this.logger.warn(`Failed to clean up partially-created log group ${logicalId} (${logGroupName}): ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}. Manual deletion may be required before the next deploy: aws logs delete-log-group --log-group-name '${logGroupName}'`);
|
|
7866
|
+
}
|
|
7867
|
+
throw innerError;
|
|
7835
7868
|
}
|
|
7836
|
-
if (properties["BearerTokenAuthenticationEnabled"] !== void 0) await this.logsClient.send(new PutBearerTokenAuthenticationCommand({
|
|
7837
|
-
logGroupIdentifier: logGroupName,
|
|
7838
|
-
bearerTokenAuthenticationEnabled: properties["BearerTokenAuthenticationEnabled"]
|
|
7839
|
-
}));
|
|
7840
7869
|
this.logger.debug(`Successfully created log group ${logicalId}: ${logGroupName}`);
|
|
7841
7870
|
return {
|
|
7842
7871
|
physicalId: logGroupName,
|
|
7843
7872
|
attributes: { Arn: await this.buildArn(logGroupName) }
|
|
7844
7873
|
};
|
|
7845
7874
|
} catch (error) {
|
|
7846
|
-
if (error instanceof ResourceAlreadyExistsException) {
|
|
7847
|
-
this.logger.debug(`Log group ${logGroupName} already exists, using existing`);
|
|
7848
|
-
return {
|
|
7849
|
-
physicalId: logGroupName,
|
|
7850
|
-
attributes: { Arn: await this.buildArn(logGroupName) }
|
|
7851
|
-
};
|
|
7852
|
-
}
|
|
7853
7875
|
const cause = error instanceof Error ? error : void 0;
|
|
7854
7876
|
throw new ProvisioningError(`Failed to create log group ${logicalId}: ${error instanceof Error ? error.message : String(error)}`, resourceType, logicalId, logGroupName, cause);
|
|
7855
7877
|
}
|
|
@@ -8756,16 +8778,26 @@ var SSMParameterProvider = class {
|
|
|
8756
8778
|
if (properties["Policies"]) putParams.Policies = properties["Policies"];
|
|
8757
8779
|
if (properties["DataType"]) putParams.DataType = properties["DataType"];
|
|
8758
8780
|
await this.ssmClient.send(new PutParameterCommand(putParams));
|
|
8759
|
-
|
|
8760
|
-
|
|
8761
|
-
|
|
8762
|
-
|
|
8763
|
-
|
|
8764
|
-
|
|
8765
|
-
|
|
8766
|
-
|
|
8767
|
-
|
|
8768
|
-
|
|
8781
|
+
try {
|
|
8782
|
+
if (properties["Tags"]) {
|
|
8783
|
+
const ssmTags = properties["Tags"].map((t) => ({
|
|
8784
|
+
Key: t.Key,
|
|
8785
|
+
Value: t.Value
|
|
8786
|
+
}));
|
|
8787
|
+
await this.ssmClient.send(new AddTagsToResourceCommand({
|
|
8788
|
+
ResourceType: "Parameter",
|
|
8789
|
+
ResourceId: name,
|
|
8790
|
+
Tags: ssmTags
|
|
8791
|
+
}));
|
|
8792
|
+
}
|
|
8793
|
+
} catch (innerError) {
|
|
8794
|
+
try {
|
|
8795
|
+
await this.ssmClient.send(new DeleteParameterCommand({ Name: name }));
|
|
8796
|
+
this.logger.debug(`Cleaned up partially-created SSM parameter ${logicalId} (${name}) after wiring failure`);
|
|
8797
|
+
} catch (cleanupError) {
|
|
8798
|
+
this.logger.warn(`Failed to clean up partially-created SSM parameter ${logicalId} (${name}): ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}. Manual deletion may be required before the next deploy: aws ssm delete-parameter --name '${name}'`);
|
|
8799
|
+
}
|
|
8800
|
+
throw innerError;
|
|
8769
8801
|
}
|
|
8770
8802
|
this.logger.debug(`Successfully created SSM parameter ${logicalId}: ${name}`);
|
|
8771
8803
|
return {
|
|
@@ -42738,7 +42770,7 @@ function reorderArgs(argv) {
|
|
|
42738
42770
|
*/
|
|
42739
42771
|
async function main() {
|
|
42740
42772
|
const program = new Command();
|
|
42741
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.102.
|
|
42773
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.102.3");
|
|
42742
42774
|
program.addCommand(createBootstrapCommand());
|
|
42743
42775
|
program.addCommand(createSynthCommand());
|
|
42744
42776
|
program.addCommand(createListCommand());
|