@geek-fun/serverlessinsight 0.8.9 → 0.9.1
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/.serverlessinsight/state-cdn-flow-app-cdn-flow-service.json.backup +1 -1
- package/.serverlessinsight/state-iam-test-app-iam-test-service.json.backup +2 -2
- package/.serverlessinsight/state-insight-poc-app-insight-poc-tencent.json.backup +2 -2
- package/.serverlessinsight/state-insight-poc-app-log-insight-poc-tencent-log.json.backup +123 -0
- package/.serverlessinsight/state-insight-poc-deploy-app-insight-poc-deploy.json.backup +4 -4
- package/.serverlessinsight/state-insight-poc-destroy-app-insight-poc-destroy.json.backup +1 -1
- package/.serverlessinsight/state-insight-volc-app-insight-volc.json.backup +2 -2
- package/.serverlessinsight/state-insight-volc-nested-app-insight-volc-nested.json.backup +93 -0
- package/.serverlessinsight/state-nested-drift-app-nested-drift-service.json.backup +148 -0
- package/.serverlessinsight/state-role-reconcile-test-app-role-reconcile-test-service.json.backup +3 -3
- package/CHANGELOG.md +29 -0
- package/README.md +2 -2
- package/README.zh-CN.md +2 -2
- package/dist/package.json +2 -2
- package/dist/src/commands/deploy.js +12 -4
- package/dist/src/commands/destroy.js +8 -2
- package/dist/src/commands/forceUnlock.js +5 -5
- package/dist/src/commands/index.js +114 -53
- package/dist/src/commands/login.js +12 -1
- package/dist/src/commands/migrate.js +287 -0
- package/dist/src/commands/plan.js +7 -1
- package/dist/src/commands/show.js +37 -25
- package/dist/src/common/aliyunClient/apigwOperations.js +4 -4
- package/dist/src/common/aliyunClient/ecsOperations.js +22 -13
- package/dist/src/common/aliyunClient/fc3Operations.js +12 -3
- package/dist/src/common/aliyunClient/nasOperations.js +4 -3
- package/dist/src/common/aliyunClient/ossOperations.js +52 -8
- package/dist/src/common/aliyunClient/slsOperations.js +3 -2
- package/dist/src/common/aliyunClient/tablestoreOperations.js +22 -11
- package/dist/src/common/apiClient.js +22 -5
- package/dist/src/common/context.js +5 -4
- package/dist/src/common/lockManager.js +1 -1
- package/dist/src/common/migrationMarker.js +34 -0
- package/dist/src/common/nameBuilder.js +13 -1
- package/dist/src/common/planCompare.js +31 -1
- package/dist/src/common/planFormatter.js +69 -54
- package/dist/src/common/refreshPlanner.js +31 -8
- package/dist/src/common/runtimeMapper.js +7 -3
- package/dist/src/common/stateBackend/cosStateBackend.js +1 -1
- package/dist/src/common/stateBackend/index.js +5 -2
- package/dist/src/common/stateBackend/localStateBackend.js +8 -2
- package/dist/src/common/stateBackend/ossStateBackend.js +1 -1
- package/dist/src/common/stateBackend/remoteStateBackend.js +19 -2
- package/dist/src/common/stateBackend/saasStateBackend.js +83 -5
- package/dist/src/common/stateManager.js +56 -5
- package/dist/src/common/tencentClient/cosOperations.js +1 -1
- package/dist/src/common/tencentClient/scfOperations.js +2 -1
- package/dist/src/common/volcengineClient/apigwOperations.js +2 -2
- package/dist/src/common/volcengineClient/index.js +6 -2
- package/dist/src/common/volcengineClient/vefaasOperations.js +3 -3
- package/dist/src/lang/en.js +231 -7
- package/dist/src/lang/zh-CN.js +230 -7
- package/dist/src/parser/index.js +1 -1
- package/dist/src/stack/aliyunStack/apigwExecutor.js +2 -2
- package/dist/src/stack/aliyunStack/apigwPlanner.js +26 -5
- package/dist/src/stack/aliyunStack/apigwResource.js +22 -10
- package/dist/src/stack/aliyunStack/databaseExecutor.js +5 -5
- package/dist/src/stack/aliyunStack/databasePlanner.js +8 -3
- package/dist/src/stack/aliyunStack/databaseResource.js +28 -12
- package/dist/src/stack/aliyunStack/deployer.js +30 -13
- package/dist/src/stack/aliyunStack/esServerlessTypes.js +2 -1
- package/dist/src/stack/aliyunStack/fc3Executor.js +2 -2
- package/dist/src/stack/aliyunStack/fc3Planner.js +46 -25
- package/dist/src/stack/aliyunStack/fc3Resource.js +80 -31
- package/dist/src/stack/aliyunStack/ossExecutor.js +2 -2
- package/dist/src/stack/aliyunStack/ossPlanner.js +6 -1
- package/dist/src/stack/aliyunStack/ossResource.js +14 -3
- package/dist/src/stack/aliyunStack/rdsTypes.js +5 -1
- package/dist/src/stack/aliyunStack/tablestoreExecutor.js +2 -2
- package/dist/src/stack/aliyunStack/tablestorePlanner.js +2 -1
- package/dist/src/stack/aliyunStack/tablestoreResource.js +5 -4
- package/dist/src/stack/aliyunStack/tablestoreTypes.js +3 -2
- package/dist/src/stack/deploy.js +12 -7
- package/dist/src/stack/localStack/functionRunner.js +5 -4
- package/dist/src/stack/scfStack/cosExecutor.js +2 -2
- package/dist/src/stack/scfStack/cosPlanner.js +6 -1
- package/dist/src/stack/scfStack/cosResource.js +8 -4
- package/dist/src/stack/scfStack/deployer.js +21 -6
- package/dist/src/stack/scfStack/esServerlessExecutor.js +5 -5
- package/dist/src/stack/scfStack/esServerlessPlanner.js +6 -1
- package/dist/src/stack/scfStack/esServerlessResource.js +12 -4
- package/dist/src/stack/scfStack/esServerlessTypes.js +2 -1
- package/dist/src/stack/scfStack/scfExecutor.js +2 -2
- package/dist/src/stack/scfStack/scfPlanner.js +26 -27
- package/dist/src/stack/scfStack/scfResource.js +38 -13
- package/dist/src/stack/scfStack/tdsqlcExecutor.js +5 -5
- package/dist/src/stack/scfStack/tdsqlcPlanner.js +6 -1
- package/dist/src/stack/scfStack/tdsqlcResource.js +12 -4
- package/dist/src/stack/volcengineStack/apigwExecutor.js +2 -2
- package/dist/src/stack/volcengineStack/apigwPlanner.js +5 -1
- package/dist/src/stack/volcengineStack/apigwResource.js +7 -4
- package/dist/src/stack/volcengineStack/deployer.js +15 -4
- package/dist/src/stack/volcengineStack/tosExecutor.js +2 -2
- package/dist/src/stack/volcengineStack/tosPlanner.js +6 -1
- package/dist/src/stack/volcengineStack/tosResource.js +11 -4
- package/dist/src/stack/volcengineStack/vefaasExecutor.js +2 -2
- package/dist/src/stack/volcengineStack/vefaasPlanner.js +39 -11
- package/dist/src/stack/volcengineStack/vefaasResource.js +11 -3
- package/dist/src/validator/rootSchema.js +29 -2
- package/dist/src/validator/semanticValidation.js +24 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -197,7 +197,11 @@ const ensureOssCodeUpload = async (client, codePath, region, functionName) => {
|
|
|
197
197
|
return undefined;
|
|
198
198
|
}
|
|
199
199
|
const bucketName = `${constants_1.SI_BOOTSTRAP_BUCKET_PREFIX}-${region}`;
|
|
200
|
-
logger_1.logger.info(
|
|
200
|
+
logger_1.logger.info(lang_1.lang.__('FC3_UPLOADING_CODE', {
|
|
201
|
+
zipPath: node_path_1.default.basename(codePath),
|
|
202
|
+
size: (fileSize / (1024 * 1024)).toFixed(1),
|
|
203
|
+
bucketName,
|
|
204
|
+
}));
|
|
201
205
|
const existingBucket = await client.oss.getBucket(bucketName);
|
|
202
206
|
if (!existingBucket) {
|
|
203
207
|
logger_1.logger.info(lang_1.lang.__('CREATING_BOOTSTRAP_BUCKET', { bucketName }));
|
|
@@ -449,8 +453,7 @@ const createDependentResources = async (context, fn, serviceName, existingInstan
|
|
|
449
453
|
else {
|
|
450
454
|
const mountPoints = [];
|
|
451
455
|
for (const nasItem of fn.storage.nas) {
|
|
452
|
-
const
|
|
453
|
-
const accessGroupName = `${fn.name}-${context.stage}-nas-access-${mountPath}`;
|
|
456
|
+
const accessGroupName = (0, common_1.buildNasAccessGroupName)(fn.name, context.stage, nasItem.mount_path);
|
|
454
457
|
logger_1.logger.info(lang_1.lang.__('CREATING_NAS_ACCESS_GROUP', { accessGroupName }));
|
|
455
458
|
const accessGroup = await client.nas.createAccessGroup(accessGroupName);
|
|
456
459
|
logger_1.logger.info(lang_1.lang.__('CREATING_NAS_ACCESS_RULE', { accessGroupName }));
|
|
@@ -545,7 +548,7 @@ const deleteDependentResources = async (context, instances) => {
|
|
|
545
548
|
case 'ALIYUN_FC3_HTTP_TRIGGER':
|
|
546
549
|
// HTTP trigger deletion requires functionName which is not available here.
|
|
547
550
|
// It is handled directly in deleteResource before calling this function.
|
|
548
|
-
logger_1.logger.warn(
|
|
551
|
+
logger_1.logger.warn(lang_1.lang.__('FC3_HTTP_TRIGGER_DEPENDENT_CLEANUP', { triggerName: instance.id }));
|
|
549
552
|
break;
|
|
550
553
|
case 'ALIYUN_FC3_CUSTOM_DOMAIN':
|
|
551
554
|
logger_1.logger.info(lang_1.lang.__('DELETING_CUSTOM_DOMAIN', { domainName: instance.id }));
|
|
@@ -611,8 +614,10 @@ const createResource = async (context, fn, state) => {
|
|
|
611
614
|
},
|
|
612
615
|
};
|
|
613
616
|
}
|
|
614
|
-
|
|
615
|
-
|
|
617
|
+
// Container-only functions have no code block — mirror the planner's null
|
|
618
|
+
// codeHash (PR #237); the image lives in customContainerConfig, no zip push.
|
|
619
|
+
const codePath = fn.code?.path;
|
|
620
|
+
const codeHash = codePath ? await (0, common_1.computeZipContentHash)(codePath) : null;
|
|
616
621
|
const baseDefinition = (0, fc3Types_1.extractFc3Definition)(config, codeHash);
|
|
617
622
|
const definition = fn.iam ? { ...baseDefinition, iam: fn.iam } : baseDefinition;
|
|
618
623
|
const dependentInstances = dependentResources.instances.map((dep) => ({
|
|
@@ -637,32 +642,43 @@ const createResource = async (context, fn, state) => {
|
|
|
637
642
|
const isTainted = existingResourceState?.status === 'tainted';
|
|
638
643
|
const existingFunctionOnRetry = isTainted ? await client.fc3.getFunction(fn.name) : null;
|
|
639
644
|
if (existingFunctionOnRetry) {
|
|
640
|
-
logger_1.logger.info(
|
|
645
|
+
logger_1.logger.info(lang_1.lang.__('TAINTED_RECOVERY_SKIP_CREATE', { resourceType: 'Function', resourceName: fn.name }));
|
|
641
646
|
}
|
|
642
647
|
try {
|
|
643
648
|
if (!existingFunctionOnRetry) {
|
|
644
|
-
const ossCode =
|
|
649
|
+
const ossCode = codePath
|
|
650
|
+
? await ensureOssCodeUpload(client, codePath, context.region, fn.name)
|
|
651
|
+
: undefined;
|
|
645
652
|
await client.fc3.createFunction(config, codePath, ossCode);
|
|
646
653
|
}
|
|
647
654
|
}
|
|
648
655
|
catch (error) {
|
|
649
656
|
if (isRecoverableCreateError(error)) {
|
|
650
|
-
logger_1.logger.warn(
|
|
657
|
+
logger_1.logger.warn(lang_1.lang.__('FC3_CREATE_RECOVERABLE_RECONCILE', {
|
|
658
|
+
functionName: fn.name,
|
|
659
|
+
error: String(error),
|
|
660
|
+
}));
|
|
651
661
|
const functionAfterError = await client.fc3.getFunction(fn.name);
|
|
652
662
|
if (functionAfterError) {
|
|
653
663
|
if (functionAfterError.state === 'Failed') {
|
|
654
|
-
throw new types_1.PartialResourceError(stateAfterDependents, new Error(
|
|
664
|
+
throw new types_1.PartialResourceError(stateAfterDependents, new Error(lang_1.lang.__('FC3_FAILED_AFTER_CREATE', {
|
|
665
|
+
functionName: fn.name,
|
|
666
|
+
reason: functionAfterError.stateReason ?? 'unknown',
|
|
667
|
+
})));
|
|
655
668
|
}
|
|
656
|
-
logger_1.logger.info(
|
|
669
|
+
logger_1.logger.info(lang_1.lang.__('FC3_FOUND_AFTER_CREATE_RECONCILE', { functionName: fn.name }));
|
|
657
670
|
}
|
|
658
671
|
else {
|
|
659
672
|
await delay(RECOVERY_GET_FUNCTION_DELAY_MS);
|
|
660
673
|
const functionAfterDelay = await client.fc3.getFunction(fn.name);
|
|
661
674
|
if (functionAfterDelay) {
|
|
662
675
|
if (functionAfterDelay.state === 'Failed') {
|
|
663
|
-
throw new types_1.PartialResourceError(stateAfterDependents, new Error(
|
|
676
|
+
throw new types_1.PartialResourceError(stateAfterDependents, new Error(lang_1.lang.__('FC3_FAILED_AFTER_CREATE', {
|
|
677
|
+
functionName: fn.name,
|
|
678
|
+
reason: functionAfterDelay.stateReason ?? 'unknown',
|
|
679
|
+
})));
|
|
664
680
|
}
|
|
665
|
-
logger_1.logger.info(
|
|
681
|
+
logger_1.logger.info(lang_1.lang.__('FC3_FOUND_AFTER_DELAYED_RECONCILE', { functionName: fn.name }));
|
|
666
682
|
}
|
|
667
683
|
else {
|
|
668
684
|
throw new types_1.PartialResourceError(stateAfterDependents, error instanceof Error ? error : new Error(String(error)));
|
|
@@ -678,10 +694,18 @@ const createResource = async (context, fn, state) => {
|
|
|
678
694
|
// a resource that was never ours).
|
|
679
695
|
const probe = await client.fc3.getFunction(fn.name);
|
|
680
696
|
if (probe && (0, ownershipTag_1.isOwnedByStack)(context, logicalId, probe.tags)) {
|
|
681
|
-
logger_1.logger.info(
|
|
697
|
+
logger_1.logger.info(lang_1.lang.__('RESOURCE_OWNERSHIP_TAG_ADOPT', {
|
|
698
|
+
resourceType: 'Function',
|
|
699
|
+
name: fn.name,
|
|
700
|
+
tag: ownershipTag_1.OWNERSHIP_TAG_KEY,
|
|
701
|
+
}));
|
|
682
702
|
}
|
|
683
703
|
else {
|
|
684
|
-
throw new types_1.PartialResourceError(stateAfterDependents, new Error(
|
|
704
|
+
throw new types_1.PartialResourceError(stateAfterDependents, new Error(lang_1.lang.__('RESOURCE_EXISTS_NOT_OWNED_ADOPT', {
|
|
705
|
+
resourceType: 'Function',
|
|
706
|
+
resourceName: fn.name,
|
|
707
|
+
tagKey: ownershipTag_1.OWNERSHIP_TAG_KEY,
|
|
708
|
+
})));
|
|
685
709
|
}
|
|
686
710
|
}
|
|
687
711
|
else {
|
|
@@ -696,10 +720,13 @@ const createResource = async (context, fn, state) => {
|
|
|
696
720
|
throw new types_1.PartialResourceError(stateAfterDependents, error instanceof Error ? error : new Error(String(error)));
|
|
697
721
|
}
|
|
698
722
|
if (!functionInfo) {
|
|
699
|
-
throw new types_1.PartialResourceError(stateAfterDependents, new Error(
|
|
723
|
+
throw new types_1.PartialResourceError(stateAfterDependents, new Error(lang_1.lang.__('REFRESH_STATE_FUNCTION', { name: fn.name })));
|
|
700
724
|
}
|
|
701
725
|
if (functionInfo.state === 'Failed') {
|
|
702
|
-
throw new types_1.PartialResourceError(stateAfterDependents, new Error(
|
|
726
|
+
throw new types_1.PartialResourceError(stateAfterDependents, new Error(lang_1.lang.__('FC3_FUNCTION_FAILED_STATE', {
|
|
727
|
+
functionName: fn.name,
|
|
728
|
+
reason: functionInfo.stateReason ?? 'unknown',
|
|
729
|
+
})));
|
|
703
730
|
}
|
|
704
731
|
const sid = (0, common_1.buildSid)('aliyun', 'fc3', context.stage, fn.name);
|
|
705
732
|
const fcInstance = buildFc3InstanceFromProvider(functionInfo, sid);
|
|
@@ -761,6 +788,17 @@ const readResource = async (context, functionName) => {
|
|
|
761
788
|
return await client.fc3.getFunction(functionName);
|
|
762
789
|
};
|
|
763
790
|
exports.readResource = readResource;
|
|
791
|
+
/** Rewrite mount-target instance ids recorded before the M4 repair recreated
|
|
792
|
+
* their targets, so the returned state (and later destroy) tracks the live
|
|
793
|
+
* domains. */
|
|
794
|
+
const withRecreatedMountTargets = (instances, recreated) => instances.map((instance) => {
|
|
795
|
+
if (instance.type !== 'ALIYUN_NAS_MOUNT_TARGET') {
|
|
796
|
+
return instance;
|
|
797
|
+
}
|
|
798
|
+
const fileSystemId = instance.id.split('/')[0];
|
|
799
|
+
const liveDomain = recreated[fileSystemId];
|
|
800
|
+
return liveDomain ? { ...instance, id: `${fileSystemId}/${liveDomain}` } : instance;
|
|
801
|
+
});
|
|
764
802
|
const updateResource = async (context, fn, state, options) => {
|
|
765
803
|
const ctx = (0, common_1.getContext)();
|
|
766
804
|
const serviceName = `${ctx.app}-${ctx.service}`;
|
|
@@ -779,6 +817,10 @@ const updateResource = async (context, fn, state, options) => {
|
|
|
779
817
|
let role;
|
|
780
818
|
let securityGroup;
|
|
781
819
|
let nasConfig;
|
|
820
|
+
// File system id -> live mount target domain, captured by the M4 nested
|
|
821
|
+
// repair below; applied to the function config and the returned state so
|
|
822
|
+
// both track the target that actually exists after recreation.
|
|
823
|
+
const recreatedMountTargets = {};
|
|
782
824
|
// SLS dependent-instance types to drop from the resulting state when
|
|
783
825
|
// function logging is disabled (true -> false).
|
|
784
826
|
const droppedSlsDependentTypes = [];
|
|
@@ -1026,9 +1068,10 @@ const updateResource = async (context, fn, state, options) => {
|
|
|
1026
1068
|
failingFsId = fsEntry.id;
|
|
1027
1069
|
const liveTargets = await client.nas.listMountTargets(fsEntry.id);
|
|
1028
1070
|
if (!liveTargets || liveTargets.length === 0) {
|
|
1029
|
-
const
|
|
1030
|
-
|
|
1031
|
-
|
|
1071
|
+
const mountTarget = await client.nas.createMountTarget(fsEntry.id, (0, common_1.buildNasAccessGroupName)(fn.name, context.stage, nasStorageItems[0]?.mount_path ?? '/mnt/nas'), fn.network.vpc_id, fn.network.subnet_ids[0]);
|
|
1072
|
+
if (mountTarget?.mountTargetDomain) {
|
|
1073
|
+
recreatedMountTargets[fsEntry.id] = mountTarget.mountTargetDomain;
|
|
1074
|
+
}
|
|
1032
1075
|
logger_1.logger.warn(lang_1.lang.__('NESTED_MOUNT_TARGET_RECREATED', { fileSystemId: fsEntry.id }));
|
|
1033
1076
|
}
|
|
1034
1077
|
}
|
|
@@ -1039,10 +1082,16 @@ const updateResource = async (context, fn, state, options) => {
|
|
|
1039
1082
|
}
|
|
1040
1083
|
if (mountTargetInstances.length > 0 && nasStorageItems.length > 0) {
|
|
1041
1084
|
nasConfig = {
|
|
1042
|
-
mountPoints: mountTargetInstances.map((mt, idx) =>
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1085
|
+
mountPoints: mountTargetInstances.map((mt, idx) => {
|
|
1086
|
+
const [fileSystemId, recordedDomain] = mt.id.split('/');
|
|
1087
|
+
// Mount the target that now exists — a just-recreated domain replaces
|
|
1088
|
+
// the stale one recorded in state.
|
|
1089
|
+
const liveDomain = recreatedMountTargets[fileSystemId] ?? recordedDomain;
|
|
1090
|
+
return {
|
|
1091
|
+
serverAddr: `${liveDomain}:/`,
|
|
1092
|
+
mountDir: nasStorageItems[idx]?.mount_path ?? '/mnt/nas',
|
|
1093
|
+
};
|
|
1094
|
+
}),
|
|
1046
1095
|
};
|
|
1047
1096
|
}
|
|
1048
1097
|
}
|
|
@@ -1084,10 +1133,10 @@ const updateResource = async (context, fn, state, options) => {
|
|
|
1084
1133
|
},
|
|
1085
1134
|
};
|
|
1086
1135
|
}
|
|
1087
|
-
const codePath = fn.code
|
|
1136
|
+
const codePath = fn.code?.path;
|
|
1088
1137
|
const currentCodeHash = existingState?.definition?.codeHash;
|
|
1089
|
-
const desiredCodeHash = await (0, common_1.computeZipContentHash)(codePath);
|
|
1090
|
-
const codeChanged = currentCodeHash !== desiredCodeHash;
|
|
1138
|
+
const desiredCodeHash = codePath ? await (0, common_1.computeZipContentHash)(codePath) : null;
|
|
1139
|
+
const codeChanged = codePath ? currentCodeHash !== desiredCodeHash : false;
|
|
1091
1140
|
const existingConfig = existingState?.definition;
|
|
1092
1141
|
const desiredDefinition = (0, fc3Types_1.extractFc3Definition)(config, desiredCodeHash);
|
|
1093
1142
|
const { codeHash: _existingCodeHash, iam: _existingIam, ...existingConfigOnly } = existingConfig || {};
|
|
@@ -1099,7 +1148,7 @@ const updateResource = async (context, fn, state, options) => {
|
|
|
1099
1148
|
if (configChanged || roleBindingChanged || options?.force) {
|
|
1100
1149
|
await client.fc3.updateFunctionConfiguration(config);
|
|
1101
1150
|
}
|
|
1102
|
-
if (codeChanged) {
|
|
1151
|
+
if (codeChanged && codePath) {
|
|
1103
1152
|
const ossCode = await ensureOssCodeUpload(client, codePath, context.region, fn.name);
|
|
1104
1153
|
await client.fc3.updateFunctionCode(fn.name, codePath, ossCode);
|
|
1105
1154
|
}
|
|
@@ -1243,9 +1292,9 @@ const updateResource = async (context, fn, state, options) => {
|
|
|
1243
1292
|
}
|
|
1244
1293
|
const functionInfo = await client.fc3.getFunction(fn.name);
|
|
1245
1294
|
if (!functionInfo) {
|
|
1246
|
-
throw new Error(
|
|
1295
|
+
throw new Error(lang_1.lang.__('REFRESH_STATE_FUNCTION', { name: fn.name }));
|
|
1247
1296
|
}
|
|
1248
|
-
const codeHash = await (0, common_1.computeZipContentHash)(codePath);
|
|
1297
|
+
const codeHash = codePath ? await (0, common_1.computeZipContentHash)(codePath) : null;
|
|
1249
1298
|
const baseDefinition = (0, fc3Types_1.extractFc3Definition)(config, codeHash);
|
|
1250
1299
|
const definition = fn.iam ? { ...baseDefinition, iam: fn.iam } : baseDefinition;
|
|
1251
1300
|
const sid = (0, common_1.buildSid)('aliyun', 'fc3', context.stage, fn.name);
|
|
@@ -1300,7 +1349,7 @@ const updateResource = async (context, fn, state, options) => {
|
|
|
1300
1349
|
instances: [
|
|
1301
1350
|
fcInstance,
|
|
1302
1351
|
...lifecycleInstances,
|
|
1303
|
-
...existingDependentInstances,
|
|
1352
|
+
...withRecreatedMountTargets(existingDependentInstances, recreatedMountTargets),
|
|
1304
1353
|
...newDependentInstancesMapped,
|
|
1305
1354
|
],
|
|
1306
1355
|
lastUpdated: new Date().toISOString(),
|
|
@@ -33,14 +33,14 @@ const executeSingleItem = async (context, item, bucketsMap, currentState) => {
|
|
|
33
33
|
case 'create': {
|
|
34
34
|
const bucket = bucketsMap.get(item.logicalId);
|
|
35
35
|
if (!bucket) {
|
|
36
|
-
throw new Error(
|
|
36
|
+
throw new Error(lang_1.lang.__('RESOURCE_BUCKET_NOT_FOUND', { logicalId: item.logicalId }));
|
|
37
37
|
}
|
|
38
38
|
return executeCreateAction(context, bucket, currentState);
|
|
39
39
|
}
|
|
40
40
|
case 'update': {
|
|
41
41
|
const bucket = bucketsMap.get(item.logicalId);
|
|
42
42
|
if (!bucket) {
|
|
43
|
-
throw new Error(
|
|
43
|
+
throw new Error(lang_1.lang.__('RESOURCE_BUCKET_NOT_FOUND', { logicalId: item.logicalId }));
|
|
44
44
|
}
|
|
45
45
|
return executeUpdateAction(context, bucket, currentState);
|
|
46
46
|
}
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.generateBucketPlan = void 0;
|
|
7
7
|
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const lang_1 = require("../../lang");
|
|
8
9
|
const aliyunClient_1 = require("../../common/aliyunClient");
|
|
9
10
|
const refreshCache_1 = require("../../common/refreshCache");
|
|
10
11
|
const concurrency_1 = require("../../common/concurrency");
|
|
@@ -60,7 +61,11 @@ const generateBucketPlan = async (context, state, buckets) => {
|
|
|
60
61
|
desiredDefinition,
|
|
61
62
|
read: () => (0, refreshCache_1.cachedRefreshRead)(context, `oss.getBucket:${bucket.name}`, () => client.oss.getBucket(bucket.name)),
|
|
62
63
|
isOwned: (remote) => (0, ownershipTag_1.isOwnedByStack)(context, logicalId, toOwnershipTags(remote.tags)),
|
|
63
|
-
foreignError: () => new Error(
|
|
64
|
+
foreignError: () => new Error(lang_1.lang.__('RESOURCE_EXISTS_NOT_OWNED', {
|
|
65
|
+
resourceType: 'Bucket',
|
|
66
|
+
resourceName: bucket.name,
|
|
67
|
+
tagKey: ownershipTag_1.OWNERSHIP_TAG_KEY,
|
|
68
|
+
})),
|
|
64
69
|
cloudToDefinition: ossTypes_1.cloudOssToDefinition,
|
|
65
70
|
normalizeForDisplay: normalizeDefinitionForDisplay,
|
|
66
71
|
extraUpdate: () => Promise.resolve({ update: domainBindingPending, drifted: false }),
|
|
@@ -195,7 +195,10 @@ const createBucketResource = async (context, bucket, state) => {
|
|
|
195
195
|
const isTainted = existingResourceState?.status === 'tainted';
|
|
196
196
|
let existingBucketOnRetry = isTainted ? await client.oss.getBucket(config.bucketName) : null;
|
|
197
197
|
if (existingBucketOnRetry) {
|
|
198
|
-
logger_1.logger.info(
|
|
198
|
+
logger_1.logger.info(lang_1.lang.__('TAINTED_RECOVERY_SKIP_CREATE', {
|
|
199
|
+
resourceType: 'Bucket',
|
|
200
|
+
resourceName: config.bucketName,
|
|
201
|
+
}));
|
|
199
202
|
}
|
|
200
203
|
const instances = existingBucketOnRetry
|
|
201
204
|
? [buildOssInstanceFromProvider(existingBucketOnRetry, sid)]
|
|
@@ -216,7 +219,11 @@ const createBucketResource = async (context, bucket, state) => {
|
|
|
216
219
|
const isCdnEnabled = getIsCdnEnabled(bucket);
|
|
217
220
|
const isAccelerateEnabled = getIsAccelerateEnabled(bucket);
|
|
218
221
|
let cnameInfo;
|
|
219
|
-
const refuseAdoptionError = () => new Error(
|
|
222
|
+
const refuseAdoptionError = () => new Error(lang_1.lang.__('RESOURCE_EXISTS_NOT_OWNED_ADOPT', {
|
|
223
|
+
resourceType: 'Bucket',
|
|
224
|
+
resourceName: config.bucketName,
|
|
225
|
+
tagKey: ownershipTag_1.OWNERSHIP_TAG_KEY,
|
|
226
|
+
}));
|
|
220
227
|
try {
|
|
221
228
|
if (!existingBucketOnRetry) {
|
|
222
229
|
try {
|
|
@@ -239,7 +246,11 @@ const createBucketResource = async (context, bucket, state) => {
|
|
|
239
246
|
const probe = await client.oss.getBucket(config.bucketName);
|
|
240
247
|
if (probe && (0, ownershipTag_1.isOwnedByStack)(context, logicalId, toOwnershipTags(probe.tags))) {
|
|
241
248
|
existingBucketOnRetry = probe;
|
|
242
|
-
logger_1.logger.info(
|
|
249
|
+
logger_1.logger.info(lang_1.lang.__('RESOURCE_OWNERSHIP_TAG_ADOPT', {
|
|
250
|
+
resourceType: 'Bucket',
|
|
251
|
+
name: config.bucketName,
|
|
252
|
+
tag: ownershipTag_1.OWNERSHIP_TAG_KEY,
|
|
253
|
+
}));
|
|
243
254
|
}
|
|
244
255
|
else {
|
|
245
256
|
throw new types_1.PartialResourceError(stateAfterDependents, refuseAdoptionError());
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.cloudRdsToDefinition = exports.extractRdsDefinition = exports.databaseToRdsConfig = void 0;
|
|
4
|
+
const lang_1 = require("../../lang");
|
|
4
5
|
// Map database versions to RDS engine versions
|
|
5
6
|
const rdsEngineMap = new Map([
|
|
6
7
|
[
|
|
@@ -150,7 +151,10 @@ const rdsEngineMap = new Map([
|
|
|
150
151
|
const databaseToRdsConfig = (database) => {
|
|
151
152
|
const engineConfig = rdsEngineMap.get(`${database.type}-${database.version}`);
|
|
152
153
|
if (!engineConfig) {
|
|
153
|
-
throw new Error(
|
|
154
|
+
throw new Error(lang_1.lang.__('RDS_DB_TYPE_VERSION_UNSUPPORTED', {
|
|
155
|
+
type: database.type,
|
|
156
|
+
version: database.version,
|
|
157
|
+
}));
|
|
154
158
|
}
|
|
155
159
|
const { engine, version, category, dbInstanceClass, quota, storage } = engineConfig;
|
|
156
160
|
const config = {
|
|
@@ -45,14 +45,14 @@ const executeSingleItem = async (context, item, tablesMap, currentState) => {
|
|
|
45
45
|
case 'create': {
|
|
46
46
|
const table = tablesMap.get(item.logicalId);
|
|
47
47
|
if (!table) {
|
|
48
|
-
throw new Error(
|
|
48
|
+
throw new Error(lang_1.lang.__('RESOURCE_TABLE_NOT_FOUND', { logicalId: item.logicalId }));
|
|
49
49
|
}
|
|
50
50
|
return executeCreateAction(context, table, currentState);
|
|
51
51
|
}
|
|
52
52
|
case 'update': {
|
|
53
53
|
const table = tablesMap.get(item.logicalId);
|
|
54
54
|
if (!table) {
|
|
55
|
-
throw new Error(
|
|
55
|
+
throw new Error(lang_1.lang.__('RESOURCE_TABLE_NOT_FOUND', { logicalId: item.logicalId }));
|
|
56
56
|
}
|
|
57
57
|
return executeUpdateAction(context, table, currentState);
|
|
58
58
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateTablePlan = void 0;
|
|
4
|
+
const lang_1 = require("../../lang");
|
|
4
5
|
const aliyunClient_1 = require("../../common/aliyunClient");
|
|
5
6
|
const refreshCache_1 = require("../../common/refreshCache");
|
|
6
7
|
const concurrency_1 = require("../../common/concurrency");
|
|
@@ -38,7 +39,7 @@ const generateTablePlan = async (context, state, tables) => {
|
|
|
38
39
|
// TableStore has no table-level tags: an existing same-named table can
|
|
39
40
|
// never be verified as ours, so it is always refused on the probe path.
|
|
40
41
|
isOwned: () => false,
|
|
41
|
-
foreignError: () => new Error(
|
|
42
|
+
foreignError: () => new Error(lang_1.lang.__('TABLESTORE_EXISTS_UNVERIFIABLE_PROBE', { tableName: config.tableName })),
|
|
42
43
|
cloudToDefinition: tablestoreTypes_1.cloudTableStoreToDefinition,
|
|
43
44
|
refresh: context.refresh,
|
|
44
45
|
});
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.deleteTableResource = exports.updateTableResource = exports.readTableResource = exports.createTableResource = void 0;
|
|
4
4
|
const aliyunClient_1 = require("../../common/aliyunClient");
|
|
5
|
+
const lang_1 = require("../../lang");
|
|
5
6
|
const common_1 = require("../../common");
|
|
6
7
|
const types_1 = require("../../types");
|
|
7
8
|
const tablestoreTypes_1 = require("./tablestoreTypes");
|
|
@@ -76,7 +77,7 @@ const createTableResource = async (context, table, state) => {
|
|
|
76
77
|
// Refresh state from provider to get all attributes
|
|
77
78
|
const tableInfo = await tablestoreClient.getTable(config.tableName);
|
|
78
79
|
if (!tableInfo) {
|
|
79
|
-
throw new Error(
|
|
80
|
+
throw new Error(lang_1.lang.__('REFRESH_STATE_TABLE', { tableName: config.tableName }));
|
|
80
81
|
}
|
|
81
82
|
const resourceState = {
|
|
82
83
|
mode: 'managed',
|
|
@@ -99,7 +100,7 @@ const createTableResource = async (context, table, state) => {
|
|
|
99
100
|
if ((0, alreadyExists_1.isResourceAlreadyExistsError)(error, ['OTSObjectAlreadyExist', 'OTSInstanceAlreadyExist'])) {
|
|
100
101
|
const existingTable = await tablestoreClient.getTable(config.tableName);
|
|
101
102
|
if (existingTable) {
|
|
102
|
-
throw new types_1.PartialResourceError(stateAfterDependents, new Error(
|
|
103
|
+
throw new types_1.PartialResourceError(stateAfterDependents, new Error(lang_1.lang.__('TABLESTORE_EXISTS_UNVERIFIABLE', { tableName: config.tableName })));
|
|
103
104
|
}
|
|
104
105
|
}
|
|
105
106
|
throw new types_1.PartialResourceError(stateAfterDependents, error instanceof Error ? error : new Error(String(error)));
|
|
@@ -129,7 +130,7 @@ const updateTableResource = async (context, table, state) => {
|
|
|
129
130
|
// Refresh state from provider to get all attributes
|
|
130
131
|
const tableInfo = await tablestoreClient.getTable(config.tableName);
|
|
131
132
|
if (!tableInfo) {
|
|
132
|
-
throw new Error(
|
|
133
|
+
throw new Error(lang_1.lang.__('REFRESH_STATE_TABLE', { tableName: config.tableName }));
|
|
133
134
|
}
|
|
134
135
|
const definition = (0, tablestoreTypes_1.extractTableStoreDefinition)(config);
|
|
135
136
|
const sid = (0, common_1.buildSid)('aliyun', 'ots', context.stage, `${config.instanceName}/${config.tableName}`);
|
|
@@ -155,7 +156,7 @@ const deleteTableResource = async (context, instanceName, tableName, logicalId,
|
|
|
155
156
|
catch (err) {
|
|
156
157
|
const errorMessage = err?.message ?? '';
|
|
157
158
|
if (errorMessage.includes('OTSObjectNotExist') || errorMessage.includes('does not exist')) {
|
|
158
|
-
logger_1.logger.warn(
|
|
159
|
+
logger_1.logger.warn(lang_1.lang.__('OTS_TABLE_MISSING_SKIP_DELETE', { tableName, instanceId: instanceName }));
|
|
159
160
|
}
|
|
160
161
|
else {
|
|
161
162
|
throw err;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.cloudTableStoreToDefinition = exports.extractTableStoreDefinition = exports.tableToTableStoreConfig = void 0;
|
|
4
4
|
const types_1 = require("../../types");
|
|
5
|
+
const lang_1 = require("../../lang");
|
|
5
6
|
// Map from TableStore cluster type to TableEnum
|
|
6
7
|
const clusterTypeMap = new Map([
|
|
7
8
|
["TABLE_STORE_C" /* TableEnum.TABLE_STORE_C */, 'HYBRID'],
|
|
@@ -26,13 +27,13 @@ const attributeTypeToTableStoreType = (type) => {
|
|
|
26
27
|
const tableToTableStoreConfig = (table) => {
|
|
27
28
|
const clusterType = clusterTypeMap.get(table.type);
|
|
28
29
|
if (!clusterType) {
|
|
29
|
-
throw new Error(
|
|
30
|
+
throw new Error(lang_1.lang.__('OTS_TABLE_TYPE_UNSUPPORTED', { type: table.type }));
|
|
30
31
|
}
|
|
31
32
|
// Extract primary keys from keySchema
|
|
32
33
|
const primaryKey = table.keySchema.map((key) => {
|
|
33
34
|
const attribute = table.attributes.find((attr) => attr.name === key.name);
|
|
34
35
|
if (!attribute) {
|
|
35
|
-
throw new Error(
|
|
36
|
+
throw new Error(lang_1.lang.__('OTS_ATTRIBUTE_NOT_FOUND', { key: key.name }));
|
|
36
37
|
}
|
|
37
38
|
return {
|
|
38
39
|
name: key.name,
|
package/dist/src/stack/deploy.js
CHANGED
|
@@ -1,27 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.deployStack = void 0;
|
|
4
|
+
const lang_1 = require("../lang");
|
|
4
5
|
const common_1 = require("../common");
|
|
5
6
|
const scfStack_1 = require("./scfStack");
|
|
6
7
|
const aliyunStack_1 = require("./aliyunStack");
|
|
7
8
|
const volcengineStack_1 = require("./volcengineStack");
|
|
8
9
|
const deployHuawei = async () => {
|
|
9
|
-
throw new Error(
|
|
10
|
-
'The provider currently generates HCL templates but does not deploy them. ' +
|
|
11
|
-
'Please use Aliyun or Tencent providers, or contribute Huawei deployment support.');
|
|
10
|
+
throw new Error(lang_1.lang.__('HUAWEI_DEPLOY_NOT_IMPLEMENTED'));
|
|
12
11
|
};
|
|
13
|
-
|
|
12
|
+
/**
|
|
13
|
+
* `plan` (issue #246): the exact plan shown to the user for approval is the
|
|
14
|
+
* plan executed — deployers partition its items by resourceType instead of
|
|
15
|
+
* re-probing the cloud and re-deciding. Omit it to fall back to per-provider
|
|
16
|
+
* plan generation (legacy path kept for direct deployer callers).
|
|
17
|
+
*/
|
|
18
|
+
const deployStack = async (iac, backend, plan) => {
|
|
14
19
|
if (iac.provider.name === common_1.ProviderEnum.TENCENT) {
|
|
15
|
-
await (0, scfStack_1.deployTencentStack)(iac, backend);
|
|
20
|
+
await (0, scfStack_1.deployTencentStack)(iac, backend, plan);
|
|
16
21
|
}
|
|
17
22
|
else if (iac.provider.name === common_1.ProviderEnum.ALIYUN) {
|
|
18
|
-
await (0, aliyunStack_1.deployAliyunStack)(iac, backend);
|
|
23
|
+
await (0, aliyunStack_1.deployAliyunStack)(iac, backend, plan);
|
|
19
24
|
}
|
|
20
25
|
else if (iac.provider.name === common_1.ProviderEnum.HUAWEI) {
|
|
21
26
|
await deployHuawei();
|
|
22
27
|
}
|
|
23
28
|
else if (iac.provider.name === common_1.ProviderEnum.VOLCENGINE) {
|
|
24
|
-
await (0, volcengineStack_1.deployVolcengineStack)(iac, backend);
|
|
29
|
+
await (0, volcengineStack_1.deployVolcengineStack)(iac, backend, plan);
|
|
25
30
|
}
|
|
26
31
|
};
|
|
27
32
|
exports.deployStack = deployStack;
|
|
@@ -37,6 +37,7 @@ exports.invokeFunction = exports.runFunction = void 0;
|
|
|
37
37
|
const node_fs_1 = require("node:fs");
|
|
38
38
|
const node_path_1 = __importStar(require("node:path"));
|
|
39
39
|
const node_url_1 = require("node:url");
|
|
40
|
+
const lang_1 = require("../../lang");
|
|
40
41
|
const node_worker_threads_1 = require("node:worker_threads");
|
|
41
42
|
// ============================================================================
|
|
42
43
|
// Worker Thread Code (runs in worker context)
|
|
@@ -64,7 +65,7 @@ const loadHandlerModule = async (handlerPath) => {
|
|
|
64
65
|
const getHandlerFunction = (handlerModule, handlerMethod, handlerPath) => {
|
|
65
66
|
const handlerFn = handlerModule[handlerMethod];
|
|
66
67
|
if (typeof handlerFn !== 'function') {
|
|
67
|
-
throw new Error(
|
|
68
|
+
throw new Error(lang_1.lang.__('LOCAL_HANDLER_NOT_FOUND', { handlerMethod, handlerPath }));
|
|
68
69
|
}
|
|
69
70
|
return handlerFn;
|
|
70
71
|
};
|
|
@@ -86,7 +87,7 @@ const invokeHandler = (handlerFn, event, context) => new Promise((resolve, rejec
|
|
|
86
87
|
});
|
|
87
88
|
const createTimeoutHandler = (port, timeoutMs) => {
|
|
88
89
|
const timeoutId = setTimeout(() => {
|
|
89
|
-
port.postMessage(new Error(
|
|
90
|
+
port.postMessage(new Error(lang_1.lang.__('LOCAL_EXECUTION_TIMEOUT', { timeoutMs: String(timeoutMs) })));
|
|
90
91
|
port.close();
|
|
91
92
|
}, timeoutMs);
|
|
92
93
|
return {
|
|
@@ -209,7 +210,7 @@ const createMessageHandler = (port, resolve, reject) => {
|
|
|
209
210
|
if (resolved)
|
|
210
211
|
return;
|
|
211
212
|
resolved = true;
|
|
212
|
-
reject(new Error('
|
|
213
|
+
reject(new Error(lang_1.lang.__('LOCAL_PORT_CLOSED')));
|
|
213
214
|
};
|
|
214
215
|
port.on('message', handleMessage).on('error', handleError).on('close', handleClose);
|
|
215
216
|
return () => {
|
|
@@ -239,7 +240,7 @@ const runFunction = (funOptions, env) => {
|
|
|
239
240
|
const handleWorkerExit = (code) => {
|
|
240
241
|
if (code !== 0) {
|
|
241
242
|
cleanup();
|
|
242
|
-
reject(new Error(
|
|
243
|
+
reject(new Error(lang_1.lang.__('LOCAL_WORKER_EXITED', { code: String(code) })));
|
|
243
244
|
}
|
|
244
245
|
};
|
|
245
246
|
worker.once('error', handleWorkerError);
|
|
@@ -33,14 +33,14 @@ const executeSingleItem = async (context, item, bucketsMap, currentState) => {
|
|
|
33
33
|
case 'create': {
|
|
34
34
|
const bucket = bucketsMap.get(item.logicalId);
|
|
35
35
|
if (!bucket) {
|
|
36
|
-
throw new Error(
|
|
36
|
+
throw new Error(lang_1.lang.__('RESOURCE_BUCKET_NOT_FOUND', { logicalId: item.logicalId }));
|
|
37
37
|
}
|
|
38
38
|
return executeCreateAction(context, bucket, currentState);
|
|
39
39
|
}
|
|
40
40
|
case 'update': {
|
|
41
41
|
const bucket = bucketsMap.get(item.logicalId);
|
|
42
42
|
if (!bucket) {
|
|
43
|
-
throw new Error(
|
|
43
|
+
throw new Error(lang_1.lang.__('RESOURCE_BUCKET_NOT_FOUND', { logicalId: item.logicalId }));
|
|
44
44
|
}
|
|
45
45
|
return executeUpdateAction(context, bucket, currentState);
|
|
46
46
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateBucketPlan = void 0;
|
|
4
|
+
const lang_1 = require("../../lang");
|
|
4
5
|
const tencentClient_1 = require("../../common/tencentClient");
|
|
5
6
|
const refreshCache_1 = require("../../common/refreshCache");
|
|
6
7
|
const concurrency_1 = require("../../common/concurrency");
|
|
@@ -38,7 +39,11 @@ const generateBucketPlan = async (context, state, buckets) => {
|
|
|
38
39
|
desiredDefinition,
|
|
39
40
|
read: readBucket,
|
|
40
41
|
isOwned: (remote) => (0, ownershipTag_1.isOwnedByStack)(context, logicalId, remote.Tags),
|
|
41
|
-
foreignError: () => new Error(
|
|
42
|
+
foreignError: () => new Error(lang_1.lang.__('RESOURCE_EXISTS_NOT_OWNED', {
|
|
43
|
+
resourceType: 'Bucket',
|
|
44
|
+
resourceName: bucket.name,
|
|
45
|
+
tagKey: ownershipTag_1.OWNERSHIP_TAG_KEY,
|
|
46
|
+
})),
|
|
42
47
|
cloudToDefinition: cosTypes_1.cloudCosToDefinition,
|
|
43
48
|
extraUpdate: async () => {
|
|
44
49
|
// Policy needs a canonical compare: the cloud returns a parsed
|
|
@@ -254,11 +254,11 @@ const createBucketResource = async (context, bucket, state) => {
|
|
|
254
254
|
if (!(0, alreadyExists_1.isResourceAlreadyExistsError)(error, ['BucketAlreadyExists', 'BucketAlreadyOwnedByYou'])) {
|
|
255
255
|
throw error;
|
|
256
256
|
}
|
|
257
|
-
logger_1.logger.info(
|
|
257
|
+
logger_1.logger.info(lang_1.lang.__('OWNERSHIP_VERIFYING', { resourceType: 'Bucket', resourceName: bucket.name }));
|
|
258
258
|
}
|
|
259
259
|
const bucketInfo = await client.cos.getBucket(bucket.name, context.region);
|
|
260
260
|
if (!bucketInfo) {
|
|
261
|
-
throw new Error(
|
|
261
|
+
throw new Error(lang_1.lang.__('REFRESH_STATE_BUCKET', { name: bucket.name }));
|
|
262
262
|
}
|
|
263
263
|
// PutBucket succeeding does NOT prove the bucket is ours: a pre-existing
|
|
264
264
|
// bucket is returned idempotently. Only a bucket carrying our ownership tag
|
|
@@ -266,7 +266,11 @@ const createBucketResource = async (context, bucket, state) => {
|
|
|
266
266
|
// one may belong to another project and must fail loudly rather than be
|
|
267
267
|
// silently taken over (destroy would then remove a resource never ours).
|
|
268
268
|
if (!(0, ownershipTag_1.isOwnedByStack)(context, logicalId, bucketInfo.Tags)) {
|
|
269
|
-
throw new types_1.PartialResourceError(stateAfterDependents, new Error(
|
|
269
|
+
throw new types_1.PartialResourceError(stateAfterDependents, new Error(lang_1.lang.__('RESOURCE_EXISTS_NOT_OWNED_ADOPT', {
|
|
270
|
+
resourceType: 'Bucket',
|
|
271
|
+
resourceName: bucket.name,
|
|
272
|
+
tagKey: ownershipTag_1.OWNERSHIP_TAG_KEY,
|
|
273
|
+
})));
|
|
270
274
|
}
|
|
271
275
|
const sid = (0, common_1.buildSid)('tencent', 'cos', context.stage, bucket.name);
|
|
272
276
|
const instances = [
|
|
@@ -358,7 +362,7 @@ const updateBucketResource = async (context, bucket, state) => {
|
|
|
358
362
|
}
|
|
359
363
|
const bucketInfo = await client.cos.getBucket(bucket.name, context.region);
|
|
360
364
|
if (!bucketInfo) {
|
|
361
|
-
throw new Error(
|
|
365
|
+
throw new Error(lang_1.lang.__('REFRESH_STATE_BUCKET', { name: bucket.name }));
|
|
362
366
|
}
|
|
363
367
|
const definition = (0, cosTypes_1.extractCosBucketDefinition)(config);
|
|
364
368
|
const sid = (0, common_1.buildSid)('tencent', 'cos', context.stage, bucket.name);
|