@go-to-k/cdkd 0.102.5 → 0.102.7
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 +131 -64
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5017,42 +5017,52 @@ var SNSTopicProvider = class {
|
|
|
5017
5017
|
};
|
|
5018
5018
|
const topicArn = (await this.snsClient.send(new CreateTopicCommand(createParams))).TopicArn;
|
|
5019
5019
|
if (!topicArn) throw new Error("CreateTopic did not return TopicArn");
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
AttributeName: "ArchivePolicy",
|
|
5025
|
-
AttributeValue: archivePolicy
|
|
5026
|
-
}));
|
|
5027
|
-
}
|
|
5028
|
-
if (properties["DataProtectionPolicy"]) {
|
|
5029
|
-
const dataProtectionPolicy = typeof properties["DataProtectionPolicy"] === "string" ? properties["DataProtectionPolicy"] : JSON.stringify(properties["DataProtectionPolicy"]);
|
|
5030
|
-
await this.snsClient.send(new SetTopicAttributesCommand({
|
|
5031
|
-
TopicArn: topicArn,
|
|
5032
|
-
AttributeName: "DataProtectionPolicy",
|
|
5033
|
-
AttributeValue: dataProtectionPolicy
|
|
5034
|
-
}));
|
|
5035
|
-
}
|
|
5036
|
-
if (properties["DeliveryStatusLogging"]) {
|
|
5037
|
-
const loggingConfigs = properties["DeliveryStatusLogging"];
|
|
5038
|
-
for (const config of loggingConfigs) {
|
|
5039
|
-
const protocol = normalizeDeliveryStatusProtocolOrThrow(config["Protocol"], logicalId);
|
|
5040
|
-
if (config["SuccessFeedbackRoleArn"]) await this.snsClient.send(new SetTopicAttributesCommand({
|
|
5041
|
-
TopicArn: topicArn,
|
|
5042
|
-
AttributeName: `${protocol}SuccessFeedbackRoleArn`,
|
|
5043
|
-
AttributeValue: config["SuccessFeedbackRoleArn"]
|
|
5044
|
-
}));
|
|
5045
|
-
if (config["SuccessFeedbackSampleRate"]) await this.snsClient.send(new SetTopicAttributesCommand({
|
|
5020
|
+
try {
|
|
5021
|
+
if (properties["ArchivePolicy"]) {
|
|
5022
|
+
const archivePolicy = typeof properties["ArchivePolicy"] === "string" ? properties["ArchivePolicy"] : JSON.stringify(properties["ArchivePolicy"]);
|
|
5023
|
+
await this.snsClient.send(new SetTopicAttributesCommand({
|
|
5046
5024
|
TopicArn: topicArn,
|
|
5047
|
-
AttributeName:
|
|
5048
|
-
AttributeValue:
|
|
5025
|
+
AttributeName: "ArchivePolicy",
|
|
5026
|
+
AttributeValue: archivePolicy
|
|
5049
5027
|
}));
|
|
5050
|
-
|
|
5028
|
+
}
|
|
5029
|
+
if (properties["DataProtectionPolicy"]) {
|
|
5030
|
+
const dataProtectionPolicy = typeof properties["DataProtectionPolicy"] === "string" ? properties["DataProtectionPolicy"] : JSON.stringify(properties["DataProtectionPolicy"]);
|
|
5031
|
+
await this.snsClient.send(new SetTopicAttributesCommand({
|
|
5051
5032
|
TopicArn: topicArn,
|
|
5052
|
-
AttributeName:
|
|
5053
|
-
AttributeValue:
|
|
5033
|
+
AttributeName: "DataProtectionPolicy",
|
|
5034
|
+
AttributeValue: dataProtectionPolicy
|
|
5054
5035
|
}));
|
|
5055
5036
|
}
|
|
5037
|
+
if (properties["DeliveryStatusLogging"]) {
|
|
5038
|
+
const loggingConfigs = properties["DeliveryStatusLogging"];
|
|
5039
|
+
for (const config of loggingConfigs) {
|
|
5040
|
+
const protocol = normalizeDeliveryStatusProtocolOrThrow(config["Protocol"], logicalId);
|
|
5041
|
+
if (config["SuccessFeedbackRoleArn"]) await this.snsClient.send(new SetTopicAttributesCommand({
|
|
5042
|
+
TopicArn: topicArn,
|
|
5043
|
+
AttributeName: `${protocol}SuccessFeedbackRoleArn`,
|
|
5044
|
+
AttributeValue: config["SuccessFeedbackRoleArn"]
|
|
5045
|
+
}));
|
|
5046
|
+
if (config["SuccessFeedbackSampleRate"]) await this.snsClient.send(new SetTopicAttributesCommand({
|
|
5047
|
+
TopicArn: topicArn,
|
|
5048
|
+
AttributeName: `${protocol}SuccessFeedbackSampleRate`,
|
|
5049
|
+
AttributeValue: stringifyValue(config["SuccessFeedbackSampleRate"])
|
|
5050
|
+
}));
|
|
5051
|
+
if (config["FailureFeedbackRoleArn"]) await this.snsClient.send(new SetTopicAttributesCommand({
|
|
5052
|
+
TopicArn: topicArn,
|
|
5053
|
+
AttributeName: `${protocol}FailureFeedbackRoleArn`,
|
|
5054
|
+
AttributeValue: config["FailureFeedbackRoleArn"]
|
|
5055
|
+
}));
|
|
5056
|
+
}
|
|
5057
|
+
}
|
|
5058
|
+
} catch (innerError) {
|
|
5059
|
+
try {
|
|
5060
|
+
await this.snsClient.send(new DeleteTopicCommand({ TopicArn: topicArn }));
|
|
5061
|
+
this.logger.debug(`Cleaned up partially-created SNS topic ${logicalId} (${topicArn}) after wiring failure`);
|
|
5062
|
+
} catch (cleanupError) {
|
|
5063
|
+
this.logger.warn(`Failed to clean up partially-created SNS topic ${logicalId} (${topicArn}): ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}. Manual deletion may be required before the next deploy: aws sns delete-topic --topic-arn ${topicArn}`);
|
|
5064
|
+
}
|
|
5065
|
+
throw innerError;
|
|
5056
5066
|
}
|
|
5057
5067
|
this.logger.debug(`Successfully created SNS topic ${logicalId}: ${topicArn}`);
|
|
5058
5068
|
return {
|
|
@@ -9118,13 +9128,36 @@ var EventBridgeRuleProvider = class {
|
|
|
9118
9128
|
if (properties["Tags"]) putRuleParams["Tags"] = properties["Tags"];
|
|
9119
9129
|
const ruleArn = (await this.eventBridgeClient.send(new PutRuleCommand(putRuleParams))).RuleArn;
|
|
9120
9130
|
this.logger.debug(`Created EventBridge rule: ${ruleName} (${ruleArn})`);
|
|
9121
|
-
|
|
9122
|
-
|
|
9123
|
-
|
|
9124
|
-
|
|
9125
|
-
|
|
9126
|
-
|
|
9127
|
-
|
|
9131
|
+
const eventBusName = properties["EventBusName"];
|
|
9132
|
+
try {
|
|
9133
|
+
if (targets && targets.length > 0) {
|
|
9134
|
+
await this.eventBridgeClient.send(new PutTargetsCommand({
|
|
9135
|
+
Rule: ruleName,
|
|
9136
|
+
EventBusName: eventBusName,
|
|
9137
|
+
Targets: targets
|
|
9138
|
+
}));
|
|
9139
|
+
this.logger.debug(`Added ${targets.length} targets to rule ${ruleName}`);
|
|
9140
|
+
}
|
|
9141
|
+
} catch (innerError) {
|
|
9142
|
+
try {
|
|
9143
|
+
const targetIds = ((await this.eventBridgeClient.send(new ListTargetsByRuleCommand({
|
|
9144
|
+
Rule: ruleName,
|
|
9145
|
+
EventBusName: eventBusName
|
|
9146
|
+
}))).Targets || []).map((t) => t.Id).filter((id) => id !== void 0);
|
|
9147
|
+
if (targetIds.length > 0) await this.eventBridgeClient.send(new RemoveTargetsCommand({
|
|
9148
|
+
Rule: ruleName,
|
|
9149
|
+
EventBusName: eventBusName,
|
|
9150
|
+
Ids: targetIds
|
|
9151
|
+
}));
|
|
9152
|
+
await this.eventBridgeClient.send(new DeleteRuleCommand({
|
|
9153
|
+
Name: ruleName,
|
|
9154
|
+
EventBusName: eventBusName
|
|
9155
|
+
}));
|
|
9156
|
+
this.logger.debug(`Cleaned up partially-created EventBridge rule ${logicalId} (${ruleName}) after wiring failure`);
|
|
9157
|
+
} catch (cleanupError) {
|
|
9158
|
+
this.logger.warn(`Failed to clean up partially-created EventBridge rule ${logicalId} (${ruleName}): ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}. Manual deletion may be required before the next deploy: aws events list-targets-by-rule --rule ${ruleName}${eventBusName ? ` --event-bus-name ${eventBusName}` : ""} | jq -r '.Targets[].Id' | xargs aws events remove-targets --rule ${ruleName}${eventBusName ? ` --event-bus-name ${eventBusName}` : ""} --ids; aws events delete-rule --name ${ruleName}${eventBusName ? ` --event-bus-name ${eventBusName}` : ""}`);
|
|
9159
|
+
}
|
|
9160
|
+
throw innerError;
|
|
9128
9161
|
}
|
|
9129
9162
|
return {
|
|
9130
9163
|
physicalId: ruleArn,
|
|
@@ -15916,25 +15949,36 @@ var ELBv2Provider = class {
|
|
|
15916
15949
|
...tags.length > 0 && { Tags: tags }
|
|
15917
15950
|
}))).LoadBalancers?.[0];
|
|
15918
15951
|
if (!lb || !lb.LoadBalancerArn) throw new Error("CreateLoadBalancer did not return LoadBalancer ARN");
|
|
15919
|
-
|
|
15920
|
-
|
|
15921
|
-
|
|
15922
|
-
|
|
15923
|
-
|
|
15924
|
-
|
|
15925
|
-
|
|
15926
|
-
|
|
15927
|
-
|
|
15928
|
-
|
|
15929
|
-
|
|
15952
|
+
const lbArn = lb.LoadBalancerArn;
|
|
15953
|
+
this.logger.debug(`Successfully created LoadBalancer ${logicalId}: ${lbArn}`);
|
|
15954
|
+
try {
|
|
15955
|
+
const lbAttributes = properties["LoadBalancerAttributes"];
|
|
15956
|
+
if (lbAttributes && lbAttributes.length > 0) {
|
|
15957
|
+
await this.getClient().send(new ModifyLoadBalancerAttributesCommand({
|
|
15958
|
+
LoadBalancerArn: lbArn,
|
|
15959
|
+
Attributes: lbAttributes.map((attr) => ({
|
|
15960
|
+
Key: attr.Key,
|
|
15961
|
+
Value: attr.Value
|
|
15962
|
+
}))
|
|
15963
|
+
}));
|
|
15964
|
+
this.logger.debug(`Applied ${lbAttributes.length} LoadBalancer attributes for ${logicalId}`);
|
|
15965
|
+
}
|
|
15966
|
+
} catch (innerError) {
|
|
15967
|
+
try {
|
|
15968
|
+
await this.getClient().send(new DeleteLoadBalancerCommand({ LoadBalancerArn: lbArn }));
|
|
15969
|
+
this.logger.debug(`Cleaned up partially-created LoadBalancer ${logicalId} (${lbArn}) after wiring failure`);
|
|
15970
|
+
} catch (cleanupError) {
|
|
15971
|
+
this.logger.warn(`Failed to clean up partially-created LoadBalancer ${logicalId} (${lbArn}): ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}. Manual deletion may be required before the next deploy: aws elbv2 delete-load-balancer --load-balancer-arn ${lbArn}`);
|
|
15972
|
+
}
|
|
15973
|
+
throw innerError;
|
|
15930
15974
|
}
|
|
15931
15975
|
return {
|
|
15932
|
-
physicalId:
|
|
15976
|
+
physicalId: lbArn,
|
|
15933
15977
|
attributes: {
|
|
15934
15978
|
DNSName: lb.DNSName,
|
|
15935
15979
|
CanonicalHostedZoneID: lb.CanonicalHostedZoneId,
|
|
15936
|
-
LoadBalancerArn:
|
|
15937
|
-
LoadBalancerFullName:
|
|
15980
|
+
LoadBalancerArn: lbArn,
|
|
15981
|
+
LoadBalancerFullName: lbArn.split("/").slice(1).join("/"),
|
|
15938
15982
|
LoadBalancerName: lb.LoadBalancerName
|
|
15939
15983
|
}
|
|
15940
15984
|
};
|
|
@@ -16654,18 +16698,41 @@ var RDSProvider = class {
|
|
|
16654
16698
|
...tags.length > 0 && { Tags: tags }
|
|
16655
16699
|
}))).DBCluster) throw new Error("CreateDBCluster did not return DBCluster");
|
|
16656
16700
|
this.logger.debug(`Successfully created DBCluster ${logicalId}: ${dbClusterIdentifier}`);
|
|
16657
|
-
|
|
16658
|
-
|
|
16659
|
-
|
|
16660
|
-
|
|
16661
|
-
|
|
16662
|
-
|
|
16663
|
-
|
|
16664
|
-
|
|
16665
|
-
|
|
16666
|
-
|
|
16701
|
+
const wantsDeletionProtection = properties["DeletionProtection"] === true;
|
|
16702
|
+
try {
|
|
16703
|
+
if (process.env["CDKD_NO_WAIT"] !== "true") await this.waitForClusterAvailable(dbClusterIdentifier);
|
|
16704
|
+
const described = await this.describeDBCluster(dbClusterIdentifier);
|
|
16705
|
+
return {
|
|
16706
|
+
physicalId: dbClusterIdentifier,
|
|
16707
|
+
attributes: {
|
|
16708
|
+
"Endpoint.Address": described?.Endpoint ?? "",
|
|
16709
|
+
"Endpoint.Port": String(described?.Port ?? ""),
|
|
16710
|
+
"ReadEndpoint.Address": described?.ReaderEndpoint ?? "",
|
|
16711
|
+
Arn: described?.DBClusterArn ?? "",
|
|
16712
|
+
DBClusterResourceId: described?.DbClusterResourceId ?? ""
|
|
16713
|
+
}
|
|
16714
|
+
};
|
|
16715
|
+
} catch (innerError) {
|
|
16716
|
+
try {
|
|
16717
|
+
if (wantsDeletionProtection) try {
|
|
16718
|
+
await this.getClient().send(new ModifyDBClusterCommand({
|
|
16719
|
+
DBClusterIdentifier: dbClusterIdentifier,
|
|
16720
|
+
DeletionProtection: false,
|
|
16721
|
+
ApplyImmediately: true
|
|
16722
|
+
}));
|
|
16723
|
+
} catch (disableError) {
|
|
16724
|
+
this.logger.debug(`Could not disable DeletionProtection on partially-created DBCluster ${dbClusterIdentifier}: ${disableError instanceof Error ? disableError.message : String(disableError)} (proceeding with DeleteDBCluster anyway)`);
|
|
16725
|
+
}
|
|
16726
|
+
await this.getClient().send(new DeleteDBClusterCommand({
|
|
16727
|
+
DBClusterIdentifier: dbClusterIdentifier,
|
|
16728
|
+
SkipFinalSnapshot: true
|
|
16729
|
+
}));
|
|
16730
|
+
this.logger.debug(`Delete requested for partially-created DBCluster ${logicalId} (${dbClusterIdentifier}) after wiring failure (not waiting for deleted state)`);
|
|
16731
|
+
} catch (cleanupError) {
|
|
16732
|
+
this.logger.warn(`Failed to delete partially-created DBCluster ${logicalId} (${dbClusterIdentifier}): ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}. THE CLUSTER IS STILL RUNNING AND BILLING. Manual cleanup required: ${wantsDeletionProtection ? `aws rds modify-db-cluster --db-cluster-identifier ${dbClusterIdentifier} --no-deletion-protection --apply-immediately; ` : ""}aws rds delete-db-cluster --db-cluster-identifier ${dbClusterIdentifier} --skip-final-snapshot`);
|
|
16667
16733
|
}
|
|
16668
|
-
|
|
16734
|
+
throw innerError;
|
|
16735
|
+
}
|
|
16669
16736
|
} catch (error) {
|
|
16670
16737
|
if (error instanceof ProvisioningError) throw error;
|
|
16671
16738
|
const cause = error instanceof Error ? error : void 0;
|
|
@@ -42865,7 +42932,7 @@ function reorderArgs(argv) {
|
|
|
42865
42932
|
*/
|
|
42866
42933
|
async function main() {
|
|
42867
42934
|
const program = new Command();
|
|
42868
|
-
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.102.
|
|
42935
|
+
program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.102.7");
|
|
42869
42936
|
program.addCommand(createBootstrapCommand());
|
|
42870
42937
|
program.addCommand(createSynthCommand());
|
|
42871
42938
|
program.addCommand(createListCommand());
|