@cdkd/cli 0.332.0 → 0.333.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/asg-provider-DgbCqJIh.js +1406 -0
- package/dist/asg-provider-DgbCqJIh.js.map +1 -0
- package/dist/cli.js +2 -2
- package/dist/{db-instance-modify-retry-B1PdmL5X.js → db-instance-modify-retry-DIOZy8ML.js} +3 -3
- package/dist/{db-instance-modify-retry-B1PdmL5X.js.map → db-instance-modify-retry-DIOZy8ML.js.map} +1 -1
- package/dist/{deploy-engine-5GASWIYI.js → deploy-engine-1ZXSkp13.js} +2204 -2056
- package/dist/deploy-engine-1ZXSkp13.js.map +1 -0
- package/dist/iam-role-provider-D7lZBTKM.js +756 -0
- package/dist/iam-role-provider-D7lZBTKM.js.map +1 -0
- package/dist/index.d.ts +166 -53
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/neptune-provider-B1o5gxWk.js +1644 -0
- package/dist/neptune-provider-B1o5gxWk.js.map +1 -0
- package/dist/{program-CaHG8EBB.js → program-BEkGI_kM.js} +5 -5
- package/dist/{program-CaHG8EBB.js.map → program-BEkGI_kM.js.map} +1 -1
- package/dist/{provider-classes-DdGvWb5T.js → provider-classes-Ce_PccaV.js} +35815 -31978
- package/dist/provider-classes-Ce_PccaV.js.map +1 -0
- package/dist/{rds-provider-BI5PcgWT.js → rds-provider-CpoJl-ki.js} +4 -4
- package/dist/{rds-provider-BI5PcgWT.js.map → rds-provider-CpoJl-ki.js.map} +1 -1
- package/dist/{created-resource-sink-DBYrPwKg.js → update-removal-B3ZdAPZ2.js} +119 -119
- package/dist/update-removal-B3ZdAPZ2.js.map +1 -0
- package/dist/{version-DXx2w7jk.js → version-CdcuSvWX.js} +2 -2
- package/dist/{version-DXx2w7jk.js.map → version-CdcuSvWX.js.map} +1 -1
- package/package.json +1 -1
- package/dist/asg-provider-CwwgTp0h.js +0 -1277
- package/dist/asg-provider-CwwgTp0h.js.map +0 -1
- package/dist/created-resource-sink-DBYrPwKg.js.map +0 -1
- package/dist/deploy-engine-5GASWIYI.js.map +0 -1
- package/dist/iam-role-provider-Cp9ASoIg.js +0 -698
- package/dist/iam-role-provider-Cp9ASoIg.js.map +0 -1
- package/dist/neptune-provider-C9IhSshh.js +0 -1438
- package/dist/neptune-provider-C9IhSshh.js.map +0 -1
- package/dist/provider-classes-DdGvWb5T.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { f as __exportAll, l as s3ClientDefaults, r as getAwsClients } from "./aws-clients-ez_oXu6x.js";
|
|
2
2
|
import { $ as safeMsg, B as SAFE_MSG_ALTERED_CHAR, C as fallbackNamePropertyFor, D as getCurrentSkipPrefix, E as generatedNameFor, F as withNameGeneration, H as STACK_REF_MAX_CODE_POINTS, I as withSkipPrefix, J as displaySafe, K as displayAwsMessage, L as withStackScope, M as looksLikeCdkdGeneratedName, O as getCurrentStackInstanceId, P as stackInstanceNameSuffix, Q as plainIdentOr, R as withStackScopeBeforeStateRead, S as explicitNamePropertyFor, T as generateResourceNameWithFallback, U as UNRENDERABLE, V as SECRET_REF_MAX_CODE_POINTS, W as asIsMessage, X as isPasteableIdent, Y as displayStackName, a as safeStringify$1, b as currentNameGeneration, c as isStdoutReservedForPayload, f as currentLogLineMasker, j as isNameGeneration, k as getCurrentStackName, m as getLiveRenderer, n as describeAwsFailure, nt as truncateCodePoints, p as installLogLineMaskerSource, q as displayIdent, s as getLogger, t as VERBOSE_POINTER, tt as terminalSafe, v as alternateNamePropertiesFor, y as applyDefaultNameForFallback, z as withoutGeneratedFallbackName } from "./aws-failure-text-DiHodi76.js";
|
|
3
|
-
import { $ as isTerminalDeleteFailure, $n as physicalIdShownBesideCommand, $t as formatLockExpiry, An as MalformedProducerRecordRefusalError, Ar as isThrottlingError, At as stateOrphanRecordRemedy, B as
|
|
3
|
+
import { $ as isTerminalDeleteFailure, $n as physicalIdShownBesideCommand, $t as formatLockExpiry, An as MalformedProducerRecordRefusalError, Ar as isThrottlingError, At as stateOrphanRecordRemedy, B as resolveExplicitPhysicalId, Bt as createdBeforeFailure, Cn as DeploymentNotApprovedError, Dr as retryClassificationText, Er as isTransientServerError, Et as logicalIdShown, F as isQuotableImportValue, Fn as ResourceUpdateNotSupportedError, Ft as maskerOrIdentity, Gt as markAuxiliaryFailure, H as assertRegionMatch, Hn as isSoftAbort, Ht as hasCreatedBeforeFailure, I as normalizeAwsTagsToCfn, It as withDerivedNameMasks, Jn as UNSHOWABLE_VALUE, Jt as replayMadeAnotherResource, K as ProtectionFlipRegistry, Kn as SHELL_ACTIVE, Kt as markCreatedBeforeFailure, L as quotedRemedyLogicalId, Lt as RETRY_AUXILIARY_OWNER, Mr as markRedactedCause, Mt as createMaskedRetryLogger, Nn as ProvisioningError, Nr as wrapMaskedAwsError, Nt as isSecretDerivedValue, On as LockError, Ot as resourceTypeShown, Pn as ResourceTimeoutError, Pt as maskDeep, Qn as pasteableCommand, R as refusalTypeShown, Rn as StateError, Rt as carryCreatedBeforeFailure, Sr as isAmbiguousOutcomeError, St as canonicalizeRoute53QueryName, Tn as IntrinsicResolutionRefusalError, Tr as isRetryableTransientError, U as isMarkedNotGone, Un as normalizeAwsError, Ut as isAuxiliaryFailure, V as RESOURCE_NOT_FOUND, Vt as createdResourceIdentityBeforeFailure, W as markNotGone, Wt as isAuxiliaryMarkOf, Xt as buildForceUnlockCommand, Y as deleteWithProtectionCompensation, Yn as commandHole, Yt as UNREPRODUCIBLE_LOCK_CLAUSE, Zn as isInertUnquoted, _n as AssetError, _r as stripControlChars, an as DEFAULT_STATE_PREFIX, bn as CrossAccountSecretRefusalError, br as formatRetryClassificationSignals, bt as isInterruptedWaitError, c as clearCreatedReport, cr as hasReplayMayCollide, dn as withPasteableAwsProfile, dr as isRecreateRetryableError, dt as pasteableAwsCommand, en as formatLockOperation, er as plainOrDescribed, f as retractCreatedResource, fn as ambientClientDefaults, fr as isReplayedNameCollisionFrom, ft as protectedReplacementAdvice, g as holdsSecretDerivedEntry, gn as AccountIdUnavailableError, gr as escapeRegExp$3, gt as monotonicNowMs, hn as credentialFingerprint, hr as relayedNameCollision, ht as ElapsedBudgetRegistry, in as CUSTOM_RESOURCE_RESPONSE_PREFIX, ir as withheldTargetClause, it as runDeleteAttempt, j as withoutServerErrorRetries, jr as markNonRetryable, jt as createMaskedLogSinks, kn as MacroExpansionError, kr as isMarkedNonRetryable, kt as segmentAfterAnchor, l as collectCreatedResources, ln as producerRecordKey, lr as isNameCollisionErrorFrom, mn as clientDefaultsFor, mr as markReplayMayCollide, mt as ElapsedBudget, n as prepareRemovalForUpdate, nn as recoveryCommandFlags, nr as shellBoundedDisplay, nt as protectionFlipKey, o as withoutInjectedRemovals, on as injectiveKey, pn as ambientCredentialConfig, q as compensateProtectionFlip, qn as SHELL_ACTIVE_WHY, r as removalWarning, rn as sanitizeRecoveryValue, rr as shellQuote, s as CreatedResourceSink, sr as isUpdateUnsupportedError, st as DELETION_PROTECTION_DOC_POINTER, tn as formatLockOwner, tr as quotedOrDescribed, tt as observeThenDisableProtection, u as reportCreatedResource, ur as isNameCooldownError, vn as CdkdError, wn as DynamicReferenceRegionAmbiguousError, wr as isIamPropagationError, wt as compositeIdSeparatorRefusal, x as withUnchangedSecretPrincipalLists, xn as DependencyError, xr as isAmbiguousCcHandlerErrorCode, xt as startInterruptWatch, zn as SynthesisError } from "./update-removal-B3ZdAPZ2.js";
|
|
4
4
|
import { a as setAssumedRoleCredentials, c as ambientRegion, i as getPreAssumeEnvCredentials, n as awsClientDefaults, o as setPreAssumeEnvCredentials, r as getAssumedRoleCredentials, s as quietS3Logger, t as SECOND_ROLE_PUBLISH_REFUSAL } from "./aws-client-defaults-BLXFsfMa.js";
|
|
5
|
-
import { t as getCdkdVersion } from "./version-
|
|
5
|
+
import { t as getCdkdVersion } from "./version-CdcuSvWX.js";
|
|
6
6
|
import { createHash, randomUUID } from "node:crypto";
|
|
7
7
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
8
8
|
import { CreateBucketCommand, DeleteObjectCommand, DeleteObjectsCommand, GetBucketLifecycleConfigurationCommand, GetBucketLocationCommand, GetBucketReplicationCommand, GetObjectCommand, HeadBucketCommand, HeadObjectCommand, ListObjectVersionsCommand, ListObjectsV2Command, NoSuchKey, PutBucketEncryptionCommand, PutBucketLifecycleConfigurationCommand, PutBucketPolicyCommand, PutObjectCommand, PutPublicAccessBlockCommand, S3Client, S3ServiceException } from "@aws-sdk/client-s3";
|
|
@@ -1026,7 +1026,7 @@ var VpcContextProvider = class {
|
|
|
1026
1026
|
};
|
|
1027
1027
|
|
|
1028
1028
|
// src/synthesis/context-providers/cc-api-provider.ts
|
|
1029
|
-
function parseResourceModel(body, typeName) {
|
|
1029
|
+
function parseResourceModel$1(body, typeName) {
|
|
1030
1030
|
try {
|
|
1031
1031
|
return JSON.parse(body);
|
|
1032
1032
|
} catch (err) {
|
|
@@ -1085,7 +1085,7 @@ var CcApiContextProvider = class {
|
|
|
1085
1085
|
Identifier: identifier
|
|
1086
1086
|
}));
|
|
1087
1087
|
if (!response.ResourceDescription?.Properties) return null;
|
|
1088
|
-
return parseResourceModel(response.ResourceDescription.Properties, typeName);
|
|
1088
|
+
return parseResourceModel$1(response.ResourceDescription.Properties, typeName);
|
|
1089
1089
|
} catch (error) {
|
|
1090
1090
|
if (error.name === "ResourceNotFoundException") return null;
|
|
1091
1091
|
throw error;
|
|
@@ -1099,7 +1099,7 @@ var CcApiContextProvider = class {
|
|
|
1099
1099
|
TypeName: typeName,
|
|
1100
1100
|
...nextToken && { NextToken: nextToken }
|
|
1101
1101
|
}));
|
|
1102
|
-
for (const desc of response.ResourceDescriptions ?? []) if (desc.Properties) resources.push(parseResourceModel(desc.Properties, typeName));
|
|
1102
|
+
for (const desc of response.ResourceDescriptions ?? []) if (desc.Properties) resources.push(parseResourceModel$1(desc.Properties, typeName));
|
|
1103
1103
|
nextToken = response.NextToken;
|
|
1104
1104
|
} while (nextToken);
|
|
1105
1105
|
return resources;
|
|
@@ -16791,6 +16791,7 @@ const PROPERTY_COVERAGE_BY_TYPE = /* @__PURE__ */ new Map([
|
|
|
16791
16791
|
"Ipv6Addresses",
|
|
16792
16792
|
"KeyName",
|
|
16793
16793
|
"LaunchTemplate",
|
|
16794
|
+
"LicenseSpecifications",
|
|
16794
16795
|
"MetadataOptions",
|
|
16795
16796
|
"Monitoring",
|
|
16796
16797
|
"NetworkInterfaces",
|
|
@@ -16801,6 +16802,7 @@ const PROPERTY_COVERAGE_BY_TYPE = /* @__PURE__ */ new Map([
|
|
|
16801
16802
|
"SecurityGroupIds",
|
|
16802
16803
|
"SecurityGroups",
|
|
16803
16804
|
"SourceDestCheck",
|
|
16805
|
+
"SsmAssociations",
|
|
16804
16806
|
"SubnetId",
|
|
16805
16807
|
"Tags",
|
|
16806
16808
|
"Tenancy",
|
|
@@ -16815,16 +16817,13 @@ const PROPERTY_COVERAGE_BY_TYPE = /* @__PURE__ */ new Map([
|
|
|
16815
16817
|
["HostId", "not yet implemented by cdkd"],
|
|
16816
16818
|
["HostResourceGroupArn", "not yet implemented by cdkd"],
|
|
16817
16819
|
["KernelId", "not yet implemented by cdkd"],
|
|
16818
|
-
["
|
|
16819
|
-
["RamdiskId", "not yet implemented by cdkd"],
|
|
16820
|
-
["SsmAssociations", "not yet implemented by cdkd"]
|
|
16820
|
+
["RamdiskId", "not yet implemented by cdkd"]
|
|
16821
16821
|
]),
|
|
16822
16822
|
createOnlyDrops: /* @__PURE__ */ new Set([
|
|
16823
16823
|
"ElasticGpuSpecifications",
|
|
16824
16824
|
"ElasticInferenceAccelerators",
|
|
16825
16825
|
"EnclaveOptions",
|
|
16826
|
-
"HostResourceGroupArn"
|
|
16827
|
-
"LicenseSpecifications"
|
|
16826
|
+
"HostResourceGroupArn"
|
|
16828
16827
|
]),
|
|
16829
16828
|
readOnly: /* @__PURE__ */ new Set([
|
|
16830
16829
|
"InstanceId",
|
|
@@ -26815,6 +26814,1007 @@ var DiffCalculator = class DiffCalculator {
|
|
|
26815
26814
|
}
|
|
26816
26815
|
};
|
|
26817
26816
|
|
|
26817
|
+
// src/provisioning/json-patch-generator.ts
|
|
26818
|
+
var JsonPatchGenerator = class {
|
|
26819
|
+
logger = getLogger().child("JsonPatchGenerator");
|
|
26820
|
+
generatePatch(previousProperties, desiredProperties) {
|
|
26821
|
+
const patches = [];
|
|
26822
|
+
for (const [key, value] of Object.entries(desiredProperties)) {
|
|
26823
|
+
const previousValue = Object.hasOwn(previousProperties, key) ? previousProperties[key] : void 0;
|
|
26824
|
+
if (previousValue === void 0) patches.push({
|
|
26825
|
+
op: "add",
|
|
26826
|
+
path: `/${this.escapeJsonPointer(key)}`,
|
|
26827
|
+
value
|
|
26828
|
+
});
|
|
26829
|
+
else if (!this.deepEqual(previousValue, value)) patches.push({
|
|
26830
|
+
op: "replace",
|
|
26831
|
+
path: `/${this.escapeJsonPointer(key)}`,
|
|
26832
|
+
value
|
|
26833
|
+
});
|
|
26834
|
+
}
|
|
26835
|
+
for (const key of Object.keys(previousProperties)) if (!Object.hasOwn(desiredProperties, key)) patches.push({
|
|
26836
|
+
op: "remove",
|
|
26837
|
+
path: `/${this.escapeJsonPointer(key)}`
|
|
26838
|
+
});
|
|
26839
|
+
this.logger.debug(`Generated ${patches.length} patch operations`);
|
|
26840
|
+
return patches;
|
|
26841
|
+
}
|
|
26842
|
+
generateFullReplacementPatch(properties) {
|
|
26843
|
+
return [{
|
|
26844
|
+
op: "replace",
|
|
26845
|
+
path: "/",
|
|
26846
|
+
value: properties
|
|
26847
|
+
}];
|
|
26848
|
+
}
|
|
26849
|
+
escapeJsonPointer(str) {
|
|
26850
|
+
return str.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
26851
|
+
}
|
|
26852
|
+
deepEqual(a, b) {
|
|
26853
|
+
if (a === b) return true;
|
|
26854
|
+
if (typeof a !== typeof b) return false;
|
|
26855
|
+
if (a === null || b === null) return false;
|
|
26856
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
26857
|
+
if (a.length !== b.length) return false;
|
|
26858
|
+
return a.every((item, index) => this.deepEqual(item, b[index]));
|
|
26859
|
+
}
|
|
26860
|
+
if (typeof a === "object" && typeof b === "object") {
|
|
26861
|
+
const aObj = a;
|
|
26862
|
+
const bObj = b;
|
|
26863
|
+
const aKeys = Object.keys(aObj);
|
|
26864
|
+
const bKeys = Object.keys(bObj);
|
|
26865
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
26866
|
+
return aKeys.every((key) => Object.hasOwn(bObj, key) && this.deepEqual(aObj[key], bObj[key]));
|
|
26867
|
+
}
|
|
26868
|
+
return false;
|
|
26869
|
+
}
|
|
26870
|
+
};
|
|
26871
|
+
|
|
26872
|
+
// src/provisioning/wait-abandoned.ts
|
|
26873
|
+
const WAIT_ABANDONED_MARKER = Symbol.for("cdkd.waitAbandoned");
|
|
26874
|
+
const ABANDONED_REQUEST = Symbol.for("cdkd.waitAbandoned.request");
|
|
26875
|
+
const MAX_CAUSE_CHAIN_DEPTH = 5;
|
|
26876
|
+
function markWaitAbandoned(error, request) {
|
|
26877
|
+
if (!Object.isExtensible(error)) return error;
|
|
26878
|
+
Object.defineProperty(error, WAIT_ABANDONED_MARKER, {
|
|
26879
|
+
value: true,
|
|
26880
|
+
enumerable: false,
|
|
26881
|
+
configurable: true,
|
|
26882
|
+
writable: false
|
|
26883
|
+
});
|
|
26884
|
+
if (request !== void 0) Object.defineProperty(error, ABANDONED_REQUEST, {
|
|
26885
|
+
value: Object.freeze({ ...request }),
|
|
26886
|
+
enumerable: false,
|
|
26887
|
+
configurable: true,
|
|
26888
|
+
writable: false
|
|
26889
|
+
});
|
|
26890
|
+
return error;
|
|
26891
|
+
}
|
|
26892
|
+
function isWaitAbandonedError(error) {
|
|
26893
|
+
let current = error;
|
|
26894
|
+
for (let depth = 0; depth < MAX_CAUSE_CHAIN_DEPTH && current != null; depth++) {
|
|
26895
|
+
if (current[WAIT_ABANDONED_MARKER] === true) return true;
|
|
26896
|
+
current = current.cause;
|
|
26897
|
+
}
|
|
26898
|
+
return false;
|
|
26899
|
+
}
|
|
26900
|
+
function abandonedRequestOf(error) {
|
|
26901
|
+
let current = error;
|
|
26902
|
+
for (let depth = 0; depth < MAX_CAUSE_CHAIN_DEPTH && current != null; depth++) {
|
|
26903
|
+
const request = current[ABANDONED_REQUEST];
|
|
26904
|
+
if (request !== void 0) return request;
|
|
26905
|
+
current = current.cause;
|
|
26906
|
+
}
|
|
26907
|
+
}
|
|
26908
|
+
|
|
26909
|
+
// src/provisioning/cloud-control/shared.ts
|
|
26910
|
+
const JSON_STRING_PROPERTIES = { "AWS::Events::Rule": /* @__PURE__ */ new Set(["EventPattern"]) };
|
|
26911
|
+
function stringifyJsonProperties(resourceType, properties) {
|
|
26912
|
+
const jsonProps = JSON_STRING_PROPERTIES[resourceType];
|
|
26913
|
+
if (!jsonProps) return properties;
|
|
26914
|
+
const result = { ...properties };
|
|
26915
|
+
for (const key of jsonProps) if (key in result && typeof result[key] === "object" && result[key] !== null) result[key] = JSON.stringify(result[key]);
|
|
26916
|
+
return result;
|
|
26917
|
+
}
|
|
26918
|
+
function stripNullValues(obj) {
|
|
26919
|
+
if (obj === null || obj === void 0) return;
|
|
26920
|
+
if (Array.isArray(obj)) return obj.map(stripNullValues).filter((v) => v !== void 0);
|
|
26921
|
+
if (typeof obj === "object") {
|
|
26922
|
+
const result = {};
|
|
26923
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
26924
|
+
const stripped = stripNullValues(value);
|
|
26925
|
+
if (stripped !== void 0) result[key] = stripped;
|
|
26926
|
+
}
|
|
26927
|
+
return result;
|
|
26928
|
+
}
|
|
26929
|
+
return obj;
|
|
26930
|
+
}
|
|
26931
|
+
function s3RedirectRegion(error) {
|
|
26932
|
+
const e = error;
|
|
26933
|
+
if (e?.name !== "PermanentRedirect" && e?.$metadata?.httpStatusCode !== 301) return void 0;
|
|
26934
|
+
for (const candidate of [
|
|
26935
|
+
e?.$response?.headers?.["x-amz-bucket-region"],
|
|
26936
|
+
e?.Region,
|
|
26937
|
+
e?.BucketRegion
|
|
26938
|
+
]) {
|
|
26939
|
+
if (typeof candidate !== "string") continue;
|
|
26940
|
+
const region = canonicalizeRegion(candidate.trim());
|
|
26941
|
+
if (region !== void 0 && /^[a-z]{2}(-[a-z]+)+-\d+$/.test(region)) return region;
|
|
26942
|
+
}
|
|
26943
|
+
}
|
|
26944
|
+
var CloudControlOperationFailedError = class CloudControlOperationFailedError extends ProvisioningError {
|
|
26945
|
+
ccErrorCode;
|
|
26946
|
+
ccOperation;
|
|
26947
|
+
constructor(message, resourceType, logicalId, physicalId, ccErrorCode, ccOperation) {
|
|
26948
|
+
super(message, resourceType, logicalId, physicalId);
|
|
26949
|
+
this.ccErrorCode = ccErrorCode;
|
|
26950
|
+
this.ccOperation = ccOperation;
|
|
26951
|
+
this.name = "CloudControlOperationFailedError";
|
|
26952
|
+
Object.setPrototypeOf(this, CloudControlOperationFailedError.prototype);
|
|
26953
|
+
}
|
|
26954
|
+
};
|
|
26955
|
+
var CloudControlWaitAbandonedError = class CloudControlWaitAbandonedError extends ProvisioningError {
|
|
26956
|
+
requestToken;
|
|
26957
|
+
ccOperation;
|
|
26958
|
+
lastSeenIdentifier;
|
|
26959
|
+
constructor(message, resourceType, logicalId, requestToken, ccOperation, lastSeenIdentifier, cause) {
|
|
26960
|
+
super(message, resourceType, logicalId, lastSeenIdentifier, cause);
|
|
26961
|
+
this.requestToken = requestToken;
|
|
26962
|
+
this.ccOperation = ccOperation;
|
|
26963
|
+
this.lastSeenIdentifier = lastSeenIdentifier;
|
|
26964
|
+
this.name = "CloudControlWaitAbandonedError";
|
|
26965
|
+
Object.setPrototypeOf(this, CloudControlWaitAbandonedError.prototype);
|
|
26966
|
+
markWaitAbandoned(this, {
|
|
26967
|
+
requestToken,
|
|
26968
|
+
operation: ccOperation
|
|
26969
|
+
});
|
|
26970
|
+
}
|
|
26971
|
+
};
|
|
26972
|
+
function failedOutcome$1(errorCode, identifier) {
|
|
26973
|
+
return identifier && errorCode !== "AlreadyExists" && errorCode !== "ResourceConflict" ? {
|
|
26974
|
+
status: "failed",
|
|
26975
|
+
remnant: identifier
|
|
26976
|
+
} : { status: "failed" };
|
|
26977
|
+
}
|
|
26978
|
+
|
|
26979
|
+
// src/provisioning/cloud-control/id-log.ts
|
|
26980
|
+
var IdScrubLog = class {
|
|
26981
|
+
needles = [];
|
|
26982
|
+
base;
|
|
26983
|
+
mask;
|
|
26984
|
+
evidence;
|
|
26985
|
+
constructor(base, mask, evidence) {
|
|
26986
|
+
this.base = base;
|
|
26987
|
+
this.mask = mask;
|
|
26988
|
+
this.evidence = evidence;
|
|
26989
|
+
}
|
|
26990
|
+
get withheld() {
|
|
26991
|
+
return this.needles.length > 0;
|
|
26992
|
+
}
|
|
26993
|
+
addId(id) {
|
|
26994
|
+
if (!this.evidence || id === void 0 || id === "") return;
|
|
26995
|
+
const parts = [id, ...id.split("|")].filter((needle) => needle !== "");
|
|
26996
|
+
const raw = [...new Set(parts.flatMap((part) => [
|
|
26997
|
+
part,
|
|
26998
|
+
displaySafe(part),
|
|
26999
|
+
displaySafe(part, { asciiOnly: true })
|
|
27000
|
+
]))].filter((needle) => needle !== "" && needle !== "***");
|
|
27001
|
+
const masked = raw.map((needle) => this.mask(needle));
|
|
27002
|
+
this.needles = [.../* @__PURE__ */ new Set([
|
|
27003
|
+
...this.needles,
|
|
27004
|
+
...raw,
|
|
27005
|
+
...masked.filter((m, i) => m !== "" && m !== raw[i] && m !== "***")
|
|
27006
|
+
])].sort((a, b) => b.length - a.length);
|
|
27007
|
+
}
|
|
27008
|
+
scrub = (text) => maskMatchSpans(this.mask(text), this.needles, "***");
|
|
27009
|
+
scrubKeepingResume(text, requestTokens) {
|
|
27010
|
+
const tokens = requestTokens.filter((token) => token !== "");
|
|
27011
|
+
if (tokens.length === 0) return this.scrub(text);
|
|
27012
|
+
const keep = new RegExp(`(${[RESUME_COMMAND.source, ...tokens.map(escapeRegExp$1)].join("|")})`);
|
|
27013
|
+
return text.split(keep).map((segment, i) => i % 2 === 1 ? this.mask(segment) : this.scrub(segment)).join("");
|
|
27014
|
+
}
|
|
27015
|
+
scrubError(error) {
|
|
27016
|
+
if (this.needles.length === 0 || !(error instanceof Error)) return error;
|
|
27017
|
+
const original = errorCauseChain(error);
|
|
27018
|
+
const tokens = abandonedRequestTokens(error);
|
|
27019
|
+
const scrubbed = maskSecretsInError(error, /* @__PURE__ */ new Map(), (text) => this.scrubKeepingResume(text, tokens));
|
|
27020
|
+
const clones = errorCauseChain(scrubbed);
|
|
27021
|
+
original.forEach((link, i) => {
|
|
27022
|
+
const clone = clones[i];
|
|
27023
|
+
if (clone === void 0 || clone === link) return;
|
|
27024
|
+
for (const key of VERBATIM_ERROR_FIELDS) {
|
|
27025
|
+
const descriptor = Object.getOwnPropertyDescriptor(link, key);
|
|
27026
|
+
if (descriptor === void 0 || typeof descriptor.value !== "string") continue;
|
|
27027
|
+
try {
|
|
27028
|
+
Object.defineProperty(clone, key, descriptor);
|
|
27029
|
+
} catch {}
|
|
27030
|
+
}
|
|
27031
|
+
});
|
|
27032
|
+
return scrubbed;
|
|
27033
|
+
}
|
|
27034
|
+
warnKeepingResume(message, requestTokens) {
|
|
27035
|
+
this.base.warn(this.scrubKeepingResume(message, requestTokens));
|
|
27036
|
+
}
|
|
27037
|
+
debug(message) {
|
|
27038
|
+
this.base.debug(this.scrub(message));
|
|
27039
|
+
}
|
|
27040
|
+
info(message) {
|
|
27041
|
+
this.base.info(this.scrub(message));
|
|
27042
|
+
}
|
|
27043
|
+
warn(message) {
|
|
27044
|
+
this.base.warn(this.scrub(message));
|
|
27045
|
+
}
|
|
27046
|
+
error(message) {
|
|
27047
|
+
this.base.error(this.scrub(message));
|
|
27048
|
+
}
|
|
27049
|
+
};
|
|
27050
|
+
const VERBATIM_ERROR_FIELDS = ["logicalId", "resourceType"];
|
|
27051
|
+
function escapeRegExp$1(text) {
|
|
27052
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
27053
|
+
}
|
|
27054
|
+
const RESUME_COMMAND = /aws(?: --profile (?:'(?:[^'\n]|'\\'')*'|\S+))? cloudcontrol get-resource-request-status --request-token \S+(?: --region \S+)?/;
|
|
27055
|
+
function abandonedRequestTokens(error) {
|
|
27056
|
+
return error instanceof Error ? errorCauseChain(error).flatMap((link) => link instanceof CloudControlWaitAbandonedError ? [link.requestToken] : []) : [];
|
|
27057
|
+
}
|
|
27058
|
+
const idLogScope = new AsyncLocalStorage();
|
|
27059
|
+
async function inIdLogScope(idLog, fn) {
|
|
27060
|
+
try {
|
|
27061
|
+
return await idLogScope.run(idLog, fn);
|
|
27062
|
+
} catch (error) {
|
|
27063
|
+
throw idLog.scrubError(error);
|
|
27064
|
+
}
|
|
27065
|
+
}
|
|
27066
|
+
function identifierCarriedBy(error) {
|
|
27067
|
+
return error instanceof ProvisioningError ? error.physicalId : void 0;
|
|
27068
|
+
}
|
|
27069
|
+
function holdsSecretDerivedLeaf(value, mask, depth = 0) {
|
|
27070
|
+
if (typeof value === "string") return isSecretDerivedValue(value, mask);
|
|
27071
|
+
if (value === null || typeof value !== "object") return false;
|
|
27072
|
+
if (depth > 64) return true;
|
|
27073
|
+
if (Array.isArray(value)) return value.some((entry) => holdsSecretDerivedLeaf(entry, mask, depth + 1));
|
|
27074
|
+
return Object.entries(value).some(([key, entry]) => isSecretDerivedValue(key, mask) || holdsSecretDerivedLeaf(entry, mask, depth + 1));
|
|
27075
|
+
}
|
|
27076
|
+
const IMPORT_YIELDED_NO_ATTRIBUTES_CONSEQUENCE = "Attributes the stack's state already records for this physical id are kept; without them, an Fn::GetAtt against this resource falls back to a value constructed from its physical id.";
|
|
27077
|
+
function isLiteralDeployOnlyKey(resourceType, key, desired, mask) {
|
|
27078
|
+
if (resourceType !== "AWS::SSM::Parameter" || key !== "Value") return false;
|
|
27079
|
+
const declared = desired["Value"];
|
|
27080
|
+
return typeof declared === "string" && !isSecretDerivedValue(declared, mask);
|
|
27081
|
+
}
|
|
27082
|
+
function maskLeavesDeep(value) {
|
|
27083
|
+
if (Array.isArray(value)) return value.map((element) => maskLeavesDeep(element));
|
|
27084
|
+
if (value !== null && typeof value === "object") {
|
|
27085
|
+
const out = Object.create(null);
|
|
27086
|
+
for (const [key, nested] of Object.entries(value)) out[key] = maskLeavesDeep(nested);
|
|
27087
|
+
return out;
|
|
27088
|
+
}
|
|
27089
|
+
return "***";
|
|
27090
|
+
}
|
|
27091
|
+
|
|
27092
|
+
// src/provisioning/getatt-attributes.generated.ts
|
|
27093
|
+
const WRITABLE_GETATT_ATTRIBUTES = {
|
|
27094
|
+
"AWS::Amplify::Branch": ["BranchName"],
|
|
27095
|
+
"AWS::Amplify::Domain": [
|
|
27096
|
+
"AutoSubDomainCreationPatterns",
|
|
27097
|
+
"AutoSubDomainIAMRole",
|
|
27098
|
+
"DomainName",
|
|
27099
|
+
"EnableAutoSubDomain"
|
|
27100
|
+
],
|
|
27101
|
+
"AWS::AppMesh::GatewayRoute": [
|
|
27102
|
+
"GatewayRouteName",
|
|
27103
|
+
"MeshName",
|
|
27104
|
+
"MeshOwner",
|
|
27105
|
+
"VirtualGatewayName"
|
|
27106
|
+
],
|
|
27107
|
+
"AWS::AppMesh::Mesh": ["MeshName"],
|
|
27108
|
+
"AWS::AppMesh::Route": [
|
|
27109
|
+
"MeshName",
|
|
27110
|
+
"MeshOwner",
|
|
27111
|
+
"RouteName",
|
|
27112
|
+
"VirtualRouterName"
|
|
27113
|
+
],
|
|
27114
|
+
"AWS::AppMesh::VirtualGateway": [
|
|
27115
|
+
"MeshName",
|
|
27116
|
+
"MeshOwner",
|
|
27117
|
+
"VirtualGatewayName"
|
|
27118
|
+
],
|
|
27119
|
+
"AWS::AppMesh::VirtualNode": [
|
|
27120
|
+
"MeshName",
|
|
27121
|
+
"MeshOwner",
|
|
27122
|
+
"VirtualNodeName"
|
|
27123
|
+
],
|
|
27124
|
+
"AWS::AppMesh::VirtualRouter": [
|
|
27125
|
+
"MeshName",
|
|
27126
|
+
"MeshOwner",
|
|
27127
|
+
"VirtualRouterName"
|
|
27128
|
+
],
|
|
27129
|
+
"AWS::AppMesh::VirtualService": [
|
|
27130
|
+
"MeshName",
|
|
27131
|
+
"MeshOwner",
|
|
27132
|
+
"VirtualServiceName"
|
|
27133
|
+
],
|
|
27134
|
+
"AWS::AppSync::DataSource": ["Name"],
|
|
27135
|
+
"AWS::AppSync::DomainName": ["DomainName"],
|
|
27136
|
+
"AWS::AppSync::FunctionConfiguration": ["DataSourceName", "Name"],
|
|
27137
|
+
"AWS::AppSync::Resolver": ["FieldName", "TypeName"],
|
|
27138
|
+
"AWS::Backup::BackupSelection": ["BackupPlanId"],
|
|
27139
|
+
"AWS::Backup::BackupVault": ["BackupVaultName"],
|
|
27140
|
+
"AWS::CleanRooms::AnalysisTemplate": ["Schema"],
|
|
27141
|
+
"AWS::Cloud9::EnvironmentEC2": ["Name"],
|
|
27142
|
+
"AWS::CloudWatch::InsightRule": ["RuleName"],
|
|
27143
|
+
"AWS::CodeArtifact::Domain": ["EncryptionKey"],
|
|
27144
|
+
"AWS::CodeArtifact::Repository": ["DomainName", "DomainOwner"],
|
|
27145
|
+
"AWS::EC2::CapacityReservation": [
|
|
27146
|
+
"AvailabilityZone",
|
|
27147
|
+
"InstanceType",
|
|
27148
|
+
"Tenancy"
|
|
27149
|
+
],
|
|
27150
|
+
"AWS::EC2::Instance": ["AvailabilityZone"],
|
|
27151
|
+
"AWS::EC2::SecurityGroup": ["VpcId"],
|
|
27152
|
+
"AWS::EC2::Subnet": [
|
|
27153
|
+
"AvailabilityZone",
|
|
27154
|
+
"AvailabilityZoneId",
|
|
27155
|
+
"CidrBlock",
|
|
27156
|
+
"OutpostArn",
|
|
27157
|
+
"VpcId"
|
|
27158
|
+
],
|
|
27159
|
+
"AWS::EC2::VPC": ["CidrBlock"],
|
|
27160
|
+
"AWS::EFS::MountTarget": ["IpAddress"],
|
|
27161
|
+
"AWS::EKS::Nodegroup": ["ClusterName", "NodegroupName"],
|
|
27162
|
+
"AWS::ElasticLoadBalancingV2::LoadBalancer": ["SecurityGroups"],
|
|
27163
|
+
"AWS::EventSchemas::Discoverer": ["CrossAccount"],
|
|
27164
|
+
"AWS::EventSchemas::Registry": ["RegistryName"],
|
|
27165
|
+
"AWS::EventSchemas::Schema": ["SchemaName"],
|
|
27166
|
+
"AWS::Events::EventBus": ["Name"],
|
|
27167
|
+
"AWS::GameLift::GameSessionQueue": ["Name"],
|
|
27168
|
+
"AWS::GameLift::MatchmakingConfiguration": ["Name"],
|
|
27169
|
+
"AWS::GameLift::MatchmakingRuleSet": ["Name"],
|
|
27170
|
+
"AWS::Grafana::Workspace": ["GrafanaVersion"],
|
|
27171
|
+
"AWS::Greengrass::ConnectorDefinition": ["Name"],
|
|
27172
|
+
"AWS::Greengrass::CoreDefinition": ["Name"],
|
|
27173
|
+
"AWS::Greengrass::DeviceDefinition": ["Name"],
|
|
27174
|
+
"AWS::Greengrass::FunctionDefinition": ["Name"],
|
|
27175
|
+
"AWS::Greengrass::Group": ["Name", "RoleArn"],
|
|
27176
|
+
"AWS::Greengrass::LoggerDefinition": ["Name"],
|
|
27177
|
+
"AWS::Greengrass::ResourceDefinition": ["Name"],
|
|
27178
|
+
"AWS::Greengrass::SubscriptionDefinition": ["Name"],
|
|
27179
|
+
"AWS::ImageBuilder::Component": ["Name"],
|
|
27180
|
+
"AWS::ImageBuilder::ContainerRecipe": ["Name"],
|
|
27181
|
+
"AWS::ImageBuilder::DistributionConfiguration": ["Name"],
|
|
27182
|
+
"AWS::ImageBuilder::ImagePipeline": ["Name"],
|
|
27183
|
+
"AWS::ImageBuilder::ImageRecipe": ["Name"],
|
|
27184
|
+
"AWS::ImageBuilder::InfrastructureConfiguration": ["Name"],
|
|
27185
|
+
"AWS::Kinesis::StreamConsumer": ["ConsumerName", "StreamARN"],
|
|
27186
|
+
"AWS::MSK::Cluster": ["CurrentVersion"],
|
|
27187
|
+
"AWS::ManagedBlockchain::Member": ["NetworkId"],
|
|
27188
|
+
"AWS::ManagedBlockchain::Node": ["MemberId", "NetworkId"],
|
|
27189
|
+
"AWS::MediaConvert::JobTemplate": ["Name"],
|
|
27190
|
+
"AWS::MediaConvert::Preset": ["Name"],
|
|
27191
|
+
"AWS::MediaConvert::Queue": ["Name"],
|
|
27192
|
+
"AWS::NetworkManager::ConnectAttachment": ["ProposedSegmentChange"],
|
|
27193
|
+
"AWS::NetworkManager::SiteToSiteVpnAttachment": ["ProposedSegmentChange"],
|
|
27194
|
+
"AWS::NetworkManager::TransitGatewayRouteTableAttachment": ["ProposedSegmentChange"],
|
|
27195
|
+
"AWS::NetworkManager::VpcAttachment": ["ProposedSegmentChange"],
|
|
27196
|
+
"AWS::OpsWorks::Instance": ["AvailabilityZone"],
|
|
27197
|
+
"AWS::OpsWorks::UserProfile": ["SshUsername"],
|
|
27198
|
+
"AWS::QuickSight::Analysis": ["Errors", "Sheets"],
|
|
27199
|
+
"AWS::RDS::DBInstance": ["DBSystemId"],
|
|
27200
|
+
"AWS::RDS::DBParameterGroup": ["DBParameterGroupName"],
|
|
27201
|
+
"AWS::RedshiftServerless::Workgroup": ["Workgroup"],
|
|
27202
|
+
"AWS::RoboMaker::RobotApplication": ["CurrentRevisionId"],
|
|
27203
|
+
"AWS::RoboMaker::SimulationApplication": ["CurrentRevisionId"],
|
|
27204
|
+
"AWS::Route53Resolver::ResolverEndpoint": [
|
|
27205
|
+
"Direction",
|
|
27206
|
+
"Name",
|
|
27207
|
+
"OutpostArn",
|
|
27208
|
+
"PreferredInstanceType",
|
|
27209
|
+
"ResolverEndpointType"
|
|
27210
|
+
],
|
|
27211
|
+
"AWS::Route53Resolver::ResolverRule": [
|
|
27212
|
+
"DomainName",
|
|
27213
|
+
"Name",
|
|
27214
|
+
"ResolverEndpointId",
|
|
27215
|
+
"TargetIps"
|
|
27216
|
+
],
|
|
27217
|
+
"AWS::Route53Resolver::ResolverRuleAssociation": [
|
|
27218
|
+
"Name",
|
|
27219
|
+
"ResolverRuleId",
|
|
27220
|
+
"VPCId"
|
|
27221
|
+
],
|
|
27222
|
+
"AWS::S3::AccessPoint": ["Name"],
|
|
27223
|
+
"AWS::SNS::Topic": ["TopicName"],
|
|
27224
|
+
"AWS::SQS::Queue": ["QueueName"],
|
|
27225
|
+
"AWS::SSM::Parameter": ["Type"],
|
|
27226
|
+
"AWS::SSM::ResourceDataSync": ["SyncName"],
|
|
27227
|
+
"AWS::SageMaker::CodeRepository": ["CodeRepositoryName"],
|
|
27228
|
+
"AWS::SageMaker::Endpoint": ["EndpointName"],
|
|
27229
|
+
"AWS::SageMaker::EndpointConfig": ["EndpointConfigName"],
|
|
27230
|
+
"AWS::SageMaker::Model": ["ModelName"],
|
|
27231
|
+
"AWS::SageMaker::ModelPackage": ["LastModifiedTime"],
|
|
27232
|
+
"AWS::SageMaker::NotebookInstance": ["NotebookInstanceName"],
|
|
27233
|
+
"AWS::SageMaker::NotebookInstanceLifecycleConfig": ["NotebookInstanceLifecycleConfigName"],
|
|
27234
|
+
"AWS::SageMaker::Workteam": ["WorkteamName"],
|
|
27235
|
+
"AWS::ServiceDiscovery::Service": ["Name"],
|
|
27236
|
+
"AWS::Signer::SigningProfile": ["ProfileName"],
|
|
27237
|
+
"AWS::StepFunctions::Activity": ["Name"],
|
|
27238
|
+
"AWS::Transfer::User": ["ServerId", "UserName"]
|
|
27239
|
+
};
|
|
27240
|
+
const SHAPE_MISMATCHED_GETATT_ATTRIBUTES = {
|
|
27241
|
+
"AWS::DocDB::DBCluster": ["Port"],
|
|
27242
|
+
"AWS::Events::EventBus": ["Policy"],
|
|
27243
|
+
"AWS::MediaLive::Input": ["Destinations", "Sources"]
|
|
27244
|
+
};
|
|
27245
|
+
|
|
27246
|
+
// src/provisioning/read-only-properties.ts
|
|
27247
|
+
function isDefinitiveRefusal(error) {
|
|
27248
|
+
if (isThrottlingError(error)) return false;
|
|
27249
|
+
let current = error;
|
|
27250
|
+
for (let depth = 0; depth < 5 && current != null; depth++) {
|
|
27251
|
+
const status = current.$metadata?.httpStatusCode;
|
|
27252
|
+
if (status !== void 0) return status >= 400 && status < 500;
|
|
27253
|
+
current = current.cause;
|
|
27254
|
+
}
|
|
27255
|
+
return false;
|
|
27256
|
+
}
|
|
27257
|
+
const readOnlyPropertiesCache = /* @__PURE__ */ new Map();
|
|
27258
|
+
const attributeNamesCache = /* @__PURE__ */ new Map();
|
|
27259
|
+
async function getTopLevelAttributeNames(resourceType) {
|
|
27260
|
+
const readOnly = await getTopLevelReadOnlyProperties(resourceType);
|
|
27261
|
+
if (readOnly === void 0) return void 0;
|
|
27262
|
+
const writable = Object.hasOwn(WRITABLE_GETATT_ATTRIBUTES, resourceType) ? WRITABLE_GETATT_ATTRIBUTES[resourceType] : void 0;
|
|
27263
|
+
if (!writable || writable.length === 0) return readOnly;
|
|
27264
|
+
const cached = attributeNamesCache.get(resourceType);
|
|
27265
|
+
if (cached) return cached;
|
|
27266
|
+
const names = /* @__PURE__ */ new Set([...readOnly, ...writable]);
|
|
27267
|
+
attributeNamesCache.set(resourceType, names);
|
|
27268
|
+
return names;
|
|
27269
|
+
}
|
|
27270
|
+
const deployAttributeNamesCache = /* @__PURE__ */ new Map();
|
|
27271
|
+
async function getTopLevelDeployAttributeNames(resourceType) {
|
|
27272
|
+
const certified = await getTopLevelAttributeNames(resourceType);
|
|
27273
|
+
if (certified === void 0) return void 0;
|
|
27274
|
+
const mismatched = Object.hasOwn(SHAPE_MISMATCHED_GETATT_ATTRIBUTES, resourceType) ? SHAPE_MISMATCHED_GETATT_ATTRIBUTES[resourceType] : void 0;
|
|
27275
|
+
if (!mismatched || mismatched.length === 0) return certified;
|
|
27276
|
+
const cached = deployAttributeNamesCache.get(resourceType);
|
|
27277
|
+
if (cached) return cached;
|
|
27278
|
+
const names = /* @__PURE__ */ new Set([...certified, ...mismatched]);
|
|
27279
|
+
deployAttributeNamesCache.set(resourceType, names);
|
|
27280
|
+
return names;
|
|
27281
|
+
}
|
|
27282
|
+
function getTopLevelReadOnlyProperties(resourceType) {
|
|
27283
|
+
if (hasNoRegistrySchema(resourceType)) return Promise.resolve(void 0);
|
|
27284
|
+
const cached = readOnlyPropertiesCache.get(resourceType);
|
|
27285
|
+
if (cached) return cached;
|
|
27286
|
+
const entry = fetchTopLevelReadOnlyProperties(resourceType).catch((error) => {
|
|
27287
|
+
if (!isDefinitiveRefusal(error)) readOnlyPropertiesCache.delete(resourceType);
|
|
27288
|
+
const message = describeAwsFailure(error).detail;
|
|
27289
|
+
getLogger().child("ReadOnlyProperties").debug(`Failed to resolve read-only properties for ${displaySafe(resourceType, { asciiOnly: true })} via cloudformation:DescribeType (${message}).`);
|
|
27290
|
+
});
|
|
27291
|
+
readOnlyPropertiesCache.set(resourceType, entry);
|
|
27292
|
+
return entry;
|
|
27293
|
+
}
|
|
27294
|
+
async function fetchTopLevelReadOnlyProperties(resourceType) {
|
|
27295
|
+
const logger = getLogger().child("ReadOnlyProperties");
|
|
27296
|
+
const response = await describeTypeWithThrottleRetry(resourceType);
|
|
27297
|
+
const result = /* @__PURE__ */ new Set();
|
|
27298
|
+
if (response.Schema) {
|
|
27299
|
+
const readOnly = JSON.parse(response.Schema).readOnlyProperties;
|
|
27300
|
+
if (Array.isArray(readOnly)) for (const path of readOnly) {
|
|
27301
|
+
if (typeof path !== "string") continue;
|
|
27302
|
+
const match = /^\/properties\/([^/]+)/.exec(path);
|
|
27303
|
+
if (match?.[1]) result.add(unescapeJsonPointerSegment(match[1]));
|
|
27304
|
+
}
|
|
27305
|
+
}
|
|
27306
|
+
logger.debug(`Resolved ${result.size} top-level read-only properties for ${displaySafe(resourceType, { asciiOnly: true })}` + (result.size > 0 ? `: ${[...result].join(", ")}` : ""));
|
|
27307
|
+
return result;
|
|
27308
|
+
}
|
|
27309
|
+
function unescapeJsonPointerSegment(segment) {
|
|
27310
|
+
return segment.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
27311
|
+
}
|
|
27312
|
+
|
|
27313
|
+
// src/provisioning/cloud-control/poll-failure.ts
|
|
27314
|
+
const POLL_TRANSPORT_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
27315
|
+
"ECONNRESET",
|
|
27316
|
+
"ECONNREFUSED",
|
|
27317
|
+
"ECONNABORTED",
|
|
27318
|
+
"EPIPE",
|
|
27319
|
+
"ETIMEDOUT",
|
|
27320
|
+
"ENOTFOUND",
|
|
27321
|
+
"EAI_AGAIN",
|
|
27322
|
+
"EHOSTUNREACH",
|
|
27323
|
+
"ENETUNREACH",
|
|
27324
|
+
"ENETDOWN",
|
|
27325
|
+
"EPROTO",
|
|
27326
|
+
"EADDRNOTAVAIL"
|
|
27327
|
+
]);
|
|
27328
|
+
const POLL_TRANSPORT_ERROR_NAMES = /* @__PURE__ */ new Set([
|
|
27329
|
+
"TimeoutError",
|
|
27330
|
+
"RequestTimeout",
|
|
27331
|
+
"RequestTimeoutException",
|
|
27332
|
+
"RequestAbortedException"
|
|
27333
|
+
]);
|
|
27334
|
+
const POLL_TRANSPORT_CODE_IN_MESSAGE = new RegExp(`\\b(?:${[...POLL_TRANSPORT_ERROR_CODES].join("|")})\\b`);
|
|
27335
|
+
const POLL_CAUSE_CHAIN_DEPTH = 5;
|
|
27336
|
+
function describePollFailure(error) {
|
|
27337
|
+
if (error === void 0) return {
|
|
27338
|
+
display: "",
|
|
27339
|
+
detail: "",
|
|
27340
|
+
marker: false
|
|
27341
|
+
};
|
|
27342
|
+
if (!(error instanceof Error)) {
|
|
27343
|
+
const other = describeAwsFailure(error);
|
|
27344
|
+
return {
|
|
27345
|
+
display: other.summary,
|
|
27346
|
+
detail: other.detail,
|
|
27347
|
+
marker: false
|
|
27348
|
+
};
|
|
27349
|
+
}
|
|
27350
|
+
const described = describeAwsFailure(error);
|
|
27351
|
+
if (!described.redacted) return {
|
|
27352
|
+
display: error.message,
|
|
27353
|
+
detail: "",
|
|
27354
|
+
marker: false
|
|
27355
|
+
};
|
|
27356
|
+
if (error.message === "") return {
|
|
27357
|
+
display: "",
|
|
27358
|
+
detail: "",
|
|
27359
|
+
marker: false
|
|
27360
|
+
};
|
|
27361
|
+
return {
|
|
27362
|
+
display: described.summary,
|
|
27363
|
+
detail: described.detail,
|
|
27364
|
+
marker: true
|
|
27365
|
+
};
|
|
27366
|
+
}
|
|
27367
|
+
function isTransientPollFailure(error) {
|
|
27368
|
+
if (isThrottlingError(error) || isTransientServerError(error)) return true;
|
|
27369
|
+
let current = error;
|
|
27370
|
+
for (let depth = 0; depth < 5 && current != null; depth++) {
|
|
27371
|
+
const code = current.code;
|
|
27372
|
+
if (typeof code === "string" && POLL_TRANSPORT_ERROR_CODES.has(code)) return true;
|
|
27373
|
+
const name = current.name;
|
|
27374
|
+
if (typeof name === "string" && POLL_TRANSPORT_ERROR_NAMES.has(name)) return true;
|
|
27375
|
+
const message = current.message;
|
|
27376
|
+
if (typeof message === "string" && POLL_TRANSPORT_CODE_IN_MESSAGE.test(message)) return true;
|
|
27377
|
+
current = current.cause;
|
|
27378
|
+
}
|
|
27379
|
+
return false;
|
|
27380
|
+
}
|
|
27381
|
+
function isNotFoundMessage(message) {
|
|
27382
|
+
return /not\s*found|does\s*not\s*exist|no\s*such|non\s*existent|\bno\b[^.;:]{0,80}\bfound\b/i.test(message);
|
|
27383
|
+
}
|
|
27384
|
+
function isCcDeleteGoneError(error, volumePath) {
|
|
27385
|
+
if (isWaitAbandonedError(error)) return false;
|
|
27386
|
+
if (error instanceof CloudControlOperationFailedError) return error.ccOperation === "DELETE" && error.ccErrorCode === "NotFound";
|
|
27387
|
+
const name = error?.name;
|
|
27388
|
+
if (volumePath) return name === "InvalidVolume.NotFound";
|
|
27389
|
+
return name === "ResourceNotFoundException";
|
|
27390
|
+
}
|
|
27391
|
+
function markNotGoneOnNeedle(error) {
|
|
27392
|
+
if (!(error instanceof Error)) return error;
|
|
27393
|
+
const message = error.message;
|
|
27394
|
+
if (!isWaitAbandonedError(error) && (message.includes("does not exist") || message.includes("not found") || message.includes("NotFound") || message.includes("No policy found") || message.includes("NoSuchEntity"))) return markNotGone(error);
|
|
27395
|
+
return error;
|
|
27396
|
+
}
|
|
27397
|
+
|
|
27398
|
+
// src/provisioning/cloud-control/create.ts
|
|
27399
|
+
async function create$2(logicalId, resourceType, properties, context) {
|
|
27400
|
+
const mask = maskerOrIdentity(context?.maskSecrets);
|
|
27401
|
+
const idLog = new IdScrubLog(this.logger, mask, holdsSecretDerivedLeaf(properties, mask));
|
|
27402
|
+
return inIdLogScope(idLog, () => this.createInIdLogScope(logicalId, resourceType, properties, idLog, mask));
|
|
27403
|
+
}
|
|
27404
|
+
async function createInIdLogScope(logicalId, resourceType, properties, idLog, mask) {
|
|
27405
|
+
this.logger.debug(`Creating resource ${logicalId} (${resourceType})`);
|
|
27406
|
+
const attributeNamesLookup = getTopLevelDeployAttributeNames(resourceType);
|
|
27407
|
+
try {
|
|
27408
|
+
const cleanProperties = stripNullValues(properties);
|
|
27409
|
+
const ccProperties = stringifyJsonProperties(resourceType, cleanProperties);
|
|
27410
|
+
const desiredState = JSON.stringify(ccProperties);
|
|
27411
|
+
this.logger.debug(`DesiredState for ${logicalId}: keys=${JSON.stringify(maskDeep(Object.keys(ccProperties), mask))}`);
|
|
27412
|
+
const createResponse = await this.cloudControlClient.send(new CreateResourceCommand({
|
|
27413
|
+
TypeName: resourceType,
|
|
27414
|
+
DesiredState: desiredState
|
|
27415
|
+
}));
|
|
27416
|
+
if (!createResponse.ProgressEvent?.RequestToken) throw new ProvisioningError(`Failed to create resource ${logicalId}: No request token received`, resourceType, logicalId);
|
|
27417
|
+
this.logger.debug(`Create request submitted for ${logicalId}, token: ${createResponse.ProgressEvent.RequestToken}`);
|
|
27418
|
+
const progressEvent = await this.waitForOperation(createResponse.ProgressEvent.RequestToken, logicalId, "CREATE", resourceType);
|
|
27419
|
+
if (!progressEvent.Identifier) throw new ProvisioningError(`Failed to create resource ${logicalId}: No physical ID returned`, resourceType, logicalId);
|
|
27420
|
+
idLog.addId(progressEvent.Identifier);
|
|
27421
|
+
this.logger.debug(`Created resource ${logicalId}, physical ID: ${progressEvent.Identifier}`);
|
|
27422
|
+
const result = { physicalId: progressEvent.Identifier };
|
|
27423
|
+
if (progressEvent.ResourceModel) result.attributes = this.parseResourceModel(progressEvent.ResourceModel);
|
|
27424
|
+
result.attributes = await this.mergeSparseModelReadback(resourceType, progressEvent.Identifier, result.attributes || {});
|
|
27425
|
+
const modelKeys = Object.keys(result.attributes);
|
|
27426
|
+
result.attributes = await this.enrichResourceAttributes(resourceType, progressEvent.Identifier, result.attributes);
|
|
27427
|
+
result.attributes = await this.maskDeployedNonAttributeKeys(result.attributes, modelKeys, resourceType, progressEvent.Identifier, attributeNamesLookup, properties, mask);
|
|
27428
|
+
return result;
|
|
27429
|
+
} catch (error) {
|
|
27430
|
+
idLog.addId(identifierCarriedBy(error));
|
|
27431
|
+
await this.cleanupFailedCreateRemnant(error, resourceType, logicalId, mask);
|
|
27432
|
+
this.handleError(error, "CREATE", resourceType, logicalId);
|
|
27433
|
+
}
|
|
27434
|
+
}
|
|
27435
|
+
async function cleanupFailedCreateRemnant(error, resourceType, logicalId, mask) {
|
|
27436
|
+
if (!(error instanceof CloudControlOperationFailedError)) return;
|
|
27437
|
+
if (error.ccOperation !== "CREATE" || !error.physicalId) return;
|
|
27438
|
+
if (error.ccErrorCode === "AlreadyExists") return;
|
|
27439
|
+
if (error.ccErrorCode === "ResourceConflict") return;
|
|
27440
|
+
this.logger.info(`CREATE of ${logicalId} failed after materializing ${error.physicalId}; deleting the remnant so a retry can re-create it`);
|
|
27441
|
+
try {
|
|
27442
|
+
const cleanupResult = await this.delete(logicalId, error.physicalId, resourceType, void 0, { maskSecrets: mask });
|
|
27443
|
+
if (cleanupResult?.outcome === "skipped") {
|
|
27444
|
+
this.logger.warn(`Skipped deleting the remnant ${error.physicalId} left by the failed CREATE of ${logicalId} (a retry may fail with AlreadyExists until it is removed manually): ${displaySafe(cleanupResult.reason)}`);
|
|
27445
|
+
return;
|
|
27446
|
+
}
|
|
27447
|
+
this.logger.debug(`Removed failed-create remnant ${error.physicalId} for ${logicalId}`);
|
|
27448
|
+
} catch (cleanupError) {
|
|
27449
|
+
const message = describeAwsFailure(cleanupError).detail;
|
|
27450
|
+
if (isWaitAbandonedError(cleanupError)) {
|
|
27451
|
+
const line = `Could not confirm whether the remnant ${error.physicalId} left by the failed CREATE of ${logicalId} was removed (a retry may fail with AlreadyExists until it is removed manually): ${displaySafe(message)}`;
|
|
27452
|
+
const log = this.logger;
|
|
27453
|
+
if (log instanceof IdScrubLog) log.warnKeepingResume(line, abandonedRequestTokens(cleanupError));
|
|
27454
|
+
else log.warn(line);
|
|
27455
|
+
return;
|
|
27456
|
+
}
|
|
27457
|
+
if (isNotFoundMessage(message)) {
|
|
27458
|
+
this.logger.info(`The remnant ${error.physicalId} left by the failed CREATE of ${logicalId} was already gone (not found); nothing to clean up`);
|
|
27459
|
+
return;
|
|
27460
|
+
}
|
|
27461
|
+
this.logger.warn(`Failed to delete the remnant ${error.physicalId} left by the failed CREATE of ${logicalId} (a retry may fail with AlreadyExists until it is removed manually): ${displaySafe(message)}`);
|
|
27462
|
+
}
|
|
27463
|
+
}
|
|
27464
|
+
|
|
27465
|
+
// src/provisioning/guardduty-detector-patch.ts
|
|
27466
|
+
const DETECTOR_TYPE = "AWS::GuardDuty::Detector";
|
|
27467
|
+
const READ_BACK_KEYS = ["Features", "DataSources"];
|
|
27468
|
+
function withGuardDutyDetectorReadBackOps(resourceType, patch, desired, readback) {
|
|
27469
|
+
if (resourceType !== DETECTOR_TYPE || patch.length === 0) return patch;
|
|
27470
|
+
let out = patch;
|
|
27471
|
+
if (readback) {
|
|
27472
|
+
out = patch.map((op) => op.path === "/Features" ? narrowToChangedFeatures(op, readback.previous["Features"]) : op);
|
|
27473
|
+
if (out.some((op) => op.path === "/Features" && op.op !== "remove")) out = out.map((op) => op.path === "/DataSources" ? {
|
|
27474
|
+
op: "remove",
|
|
27475
|
+
path: "/DataSources"
|
|
27476
|
+
} : op);
|
|
27477
|
+
}
|
|
27478
|
+
const extra = [];
|
|
27479
|
+
for (const key of READ_BACK_KEYS) {
|
|
27480
|
+
if (out.some((op) => op.path === `/${key}`)) continue;
|
|
27481
|
+
if (readback) {
|
|
27482
|
+
if (Object.prototype.hasOwnProperty.call(readback.previous, key)) extra.push({
|
|
27483
|
+
op: "remove",
|
|
27484
|
+
path: `/${key}`
|
|
27485
|
+
});
|
|
27486
|
+
continue;
|
|
27487
|
+
}
|
|
27488
|
+
extra.push(Object.prototype.hasOwnProperty.call(desired, key) ? {
|
|
27489
|
+
op: "add",
|
|
27490
|
+
path: `/${key}`,
|
|
27491
|
+
value: desired[key]
|
|
27492
|
+
} : {
|
|
27493
|
+
op: "remove",
|
|
27494
|
+
path: `/${key}`
|
|
27495
|
+
});
|
|
27496
|
+
}
|
|
27497
|
+
return extra.length === 0 && out === patch ? patch : [...out, ...extra];
|
|
27498
|
+
}
|
|
27499
|
+
function narrowToChangedFeatures(op, current) {
|
|
27500
|
+
if (!Array.isArray(op.value) || !Array.isArray(current)) return op;
|
|
27501
|
+
const byName = /* @__PURE__ */ new Map();
|
|
27502
|
+
for (const entry of current) byName.set(featureName(entry), entry);
|
|
27503
|
+
const changed = [];
|
|
27504
|
+
for (const entry of op.value) {
|
|
27505
|
+
const name = featureName(entry);
|
|
27506
|
+
if (name === void 0) return op;
|
|
27507
|
+
if (!isDeepStrictEqual(entry, byName.get(name))) changed.push(entry);
|
|
27508
|
+
}
|
|
27509
|
+
if (changed.length === 0) throw markNonRetryable(/* @__PURE__ */ new Error("cannot revert Features: the live list differs from the recorded baseline only in the order of its entries or in entries GuardDuty added, which UpdateDetector cannot undo, so nothing on this detector was reverted. cdkd drift --accept would record the live list, but it records the live value of EVERY drifted property of the stack, not only Features: revert any other drift on this detector first (for example with aws guardduty update-detector), then run it."));
|
|
27510
|
+
return {
|
|
27511
|
+
...op,
|
|
27512
|
+
value: changed
|
|
27513
|
+
};
|
|
27514
|
+
}
|
|
27515
|
+
function featureName(entry) {
|
|
27516
|
+
const name = entry?.["Name"];
|
|
27517
|
+
return typeof name === "string" ? name : void 0;
|
|
27518
|
+
}
|
|
27519
|
+
|
|
27520
|
+
// src/provisioning/apigwv2-body-import-patch.ts
|
|
27521
|
+
const API_TYPE = "AWS::ApiGatewayV2::Api";
|
|
27522
|
+
const DEFINITION_KEYS = ["Body", "BodyS3Location"];
|
|
27523
|
+
const IMPORT_KEYS = [
|
|
27524
|
+
...DEFINITION_KEYS,
|
|
27525
|
+
"BasePath",
|
|
27526
|
+
"FailOnWarnings"
|
|
27527
|
+
];
|
|
27528
|
+
function isApiGatewayV2Import(resourceType, desired) {
|
|
27529
|
+
return resourceType === API_TYPE && DEFINITION_KEYS.some((key) => Object.prototype.hasOwnProperty.call(desired, key));
|
|
27530
|
+
}
|
|
27531
|
+
function splitApiGatewayV2ImportPatch(patch, previous, desired) {
|
|
27532
|
+
const importPaths = new Set(IMPORT_KEYS.map((key) => `/${key}`));
|
|
27533
|
+
const rest = patch.filter((op) => !importPaths.has(op.path));
|
|
27534
|
+
if (!IMPORT_KEYS.some((key) => !isDeepStrictEqual(previous[key], desired[key]))) return {
|
|
27535
|
+
rest,
|
|
27536
|
+
reimport: void 0
|
|
27537
|
+
};
|
|
27538
|
+
if (Object.prototype.hasOwnProperty.call(desired, "Description") && !rest.some((op) => op.path === "/Description")) rest.push({
|
|
27539
|
+
op: "add",
|
|
27540
|
+
path: "/Description",
|
|
27541
|
+
value: desired["Description"]
|
|
27542
|
+
});
|
|
27543
|
+
const body = desired["Body"];
|
|
27544
|
+
const basePath = desired["BasePath"];
|
|
27545
|
+
const failOnWarnings = desired["FailOnWarnings"];
|
|
27546
|
+
return {
|
|
27547
|
+
rest,
|
|
27548
|
+
reimport: {
|
|
27549
|
+
body: body === void 0 ? void 0 : typeof body === "string" ? body : JSON.stringify(body),
|
|
27550
|
+
fromS3: Object.prototype.hasOwnProperty.call(desired, "BodyS3Location"),
|
|
27551
|
+
bodyS3Location: desired["BodyS3Location"],
|
|
27552
|
+
basePath: typeof basePath === "string" ? basePath : void 0,
|
|
27553
|
+
failOnWarnings: failOnWarnings === true || failOnWarnings === "true" ? true : failOnWarnings === false || failOnWarnings === "false" ? false : void 0
|
|
27554
|
+
}
|
|
27555
|
+
};
|
|
27556
|
+
}
|
|
27557
|
+
function apiGatewayV2DefinitionObject(location) {
|
|
27558
|
+
if (location === null || typeof location !== "object" || Array.isArray(location)) return;
|
|
27559
|
+
const { Bucket, Key, Version, Etag } = location;
|
|
27560
|
+
if (typeof Bucket !== "string" || Bucket === "" || typeof Key !== "string" || Key === "") return;
|
|
27561
|
+
if (Version !== void 0 && typeof Version !== "string") return void 0;
|
|
27562
|
+
if (Etag !== void 0 && typeof Etag !== "string") return void 0;
|
|
27563
|
+
return {
|
|
27564
|
+
bucket: Bucket,
|
|
27565
|
+
key: Key,
|
|
27566
|
+
version: Version === "" ? void 0 : Version,
|
|
27567
|
+
etag: Etag === "" ? void 0 : Etag
|
|
27568
|
+
};
|
|
27569
|
+
}
|
|
27570
|
+
|
|
27571
|
+
// src/provisioning/secret-reference-immutable.ts
|
|
27572
|
+
const IDENTITY = maskerOrIdentity(void 0);
|
|
27573
|
+
async function unchangedBehindSecretReference(evidence) {
|
|
27574
|
+
const { resourceType, key, desired, previous, physicalName, maskSecrets } = evidence;
|
|
27575
|
+
if (physicalName !== void 0 && physicalName !== "") return isSecretDerivedValue(previous, IDENTITY) && desired === physicalName;
|
|
27576
|
+
if (!onlySecretReferencesDiffer(desired, previous, maskSecrets)) return false;
|
|
27577
|
+
return await engineReplacesOnAnyChange(resourceType, key);
|
|
27578
|
+
}
|
|
27579
|
+
let registry;
|
|
27580
|
+
async function engineReplacesOnAnyChange(resourceType, key) {
|
|
27581
|
+
registry ??= new ReplacementRulesRegistry();
|
|
27582
|
+
if (registry.isClassified(resourceType, key)) return registry.conditionalReplacementVerdict(resourceType, key, void 0, void 0) === void 0 && registry.requiresReplacement(resourceType, key, void 0, void 0);
|
|
27583
|
+
return (await getCreateOnlyPropertyPaths(resourceType)).some((path) => path.length === 1 && path[0] === key);
|
|
27584
|
+
}
|
|
27585
|
+
function onlySecretReferencesDiffer(desired, previous, maskSecrets) {
|
|
27586
|
+
return compare(desired, previous, maskerOrIdentity(maskSecrets)) === "references-only";
|
|
27587
|
+
}
|
|
27588
|
+
function compare(desired, previous, mask) {
|
|
27589
|
+
if (typeof previous === "string") {
|
|
27590
|
+
if (desired === previous) return "equal";
|
|
27591
|
+
return resolvesReference(desired, previous, mask) ? "references-only" : "differs";
|
|
27592
|
+
}
|
|
27593
|
+
if (Array.isArray(previous)) {
|
|
27594
|
+
if (!Array.isArray(desired) || desired.length !== previous.length) return "differs";
|
|
27595
|
+
return combine(previous.map((item, i) => compare(desired[i], item, mask)));
|
|
27596
|
+
}
|
|
27597
|
+
if (isPlainObject$6(previous)) {
|
|
27598
|
+
if (!isPlainObject$6(desired)) return "differs";
|
|
27599
|
+
if (!Object.keys(desired).every((k) => Object.prototype.hasOwnProperty.call(previous, k))) return "differs";
|
|
27600
|
+
return combine(Object.keys(previous).map((k) => compare(desired[k], previous[k], mask)));
|
|
27601
|
+
}
|
|
27602
|
+
return JSON.stringify(desired) === JSON.stringify(previous) ? "equal" : "differs";
|
|
27603
|
+
}
|
|
27604
|
+
function combine(verdicts) {
|
|
27605
|
+
if (verdicts.includes("differs")) return "differs";
|
|
27606
|
+
return verdicts.includes("references-only") ? "references-only" : "equal";
|
|
27607
|
+
}
|
|
27608
|
+
function resolvesReference(desired, previous, mask) {
|
|
27609
|
+
if (typeof desired !== "string" || desired === "") return false;
|
|
27610
|
+
const tokens = dynamicReferenceTokens(previous);
|
|
27611
|
+
if (tokens.length === 0) return false;
|
|
27612
|
+
if (mask(desired) === desired) return false;
|
|
27613
|
+
const literals = [];
|
|
27614
|
+
let rest = previous;
|
|
27615
|
+
for (const token of tokens) {
|
|
27616
|
+
const at = rest.indexOf(token);
|
|
27617
|
+
literals.push(rest.slice(0, at));
|
|
27618
|
+
rest = rest.slice(at + token.length);
|
|
27619
|
+
}
|
|
27620
|
+
literals.push(rest);
|
|
27621
|
+
const pattern = literals.map(escapeRegExp).join("[\\s\\S]*");
|
|
27622
|
+
return new RegExp(`^${pattern}$`).test(desired);
|
|
27623
|
+
}
|
|
27624
|
+
function isPlainObject$6(value) {
|
|
27625
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
27626
|
+
}
|
|
27627
|
+
function escapeRegExp(text) {
|
|
27628
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
27629
|
+
}
|
|
27630
|
+
|
|
27631
|
+
// src/provisioning/cloud-control/update.ts
|
|
27632
|
+
async function update$2(logicalId, physicalId, resourceType, properties, previousProperties, context) {
|
|
27633
|
+
const mask = maskerOrIdentity(context?.maskSecrets);
|
|
27634
|
+
const idLog = new IdScrubLog(this.logger, mask, holdsSecretDerivedLeaf(properties, mask) || holdsSecretDerivedLeaf(previousProperties, mask));
|
|
27635
|
+
idLog.addId(physicalId);
|
|
27636
|
+
return inIdLogScope(idLog, () => this.updateInIdLogScope(logicalId, physicalId, resourceType, properties, previousProperties, context, idLog));
|
|
27637
|
+
}
|
|
27638
|
+
async function updateInIdLogScope(logicalId, physicalId, resourceType, properties, previousProperties, context, idLog) {
|
|
27639
|
+
idLog.debug(`Updating resource ${logicalId} (${resourceType}), physical ID: ${physicalId}`);
|
|
27640
|
+
await this.assertRecordedRegionAgainstClient("pre-update", context?.expectedRegion, resourceType, logicalId, physicalId);
|
|
27641
|
+
try {
|
|
27642
|
+
const cleanPreviousProperties = stringifyJsonProperties(resourceType, stripNullValues(previousProperties));
|
|
27643
|
+
const cleanProperties = stringifyJsonProperties(resourceType, stripNullValues(properties));
|
|
27644
|
+
for (const key of Object.keys(cleanPreviousProperties)) {
|
|
27645
|
+
if (!Object.prototype.hasOwnProperty.call(cleanProperties, key)) continue;
|
|
27646
|
+
const previous = cleanPreviousProperties[key];
|
|
27647
|
+
const desired = cleanProperties[key];
|
|
27648
|
+
if (previous === desired) continue;
|
|
27649
|
+
if (await unchangedBehindSecretReference({
|
|
27650
|
+
resourceType,
|
|
27651
|
+
key,
|
|
27652
|
+
desired,
|
|
27653
|
+
previous,
|
|
27654
|
+
maskSecrets: context?.maskSecrets
|
|
27655
|
+
})) cleanPreviousProperties[key] = desired;
|
|
27656
|
+
}
|
|
27657
|
+
let patch = this.patchGenerator.generatePatch(cleanPreviousProperties, cleanProperties);
|
|
27658
|
+
if (patch.length === 0) {
|
|
27659
|
+
this.logger.debug(`No property changes detected for ${logicalId}, skipping update`);
|
|
27660
|
+
return {
|
|
27661
|
+
physicalId,
|
|
27662
|
+
wasReplaced: false,
|
|
27663
|
+
sentNothing: true
|
|
27664
|
+
};
|
|
27665
|
+
}
|
|
27666
|
+
const attributeNamesLookup = getTopLevelDeployAttributeNames(resourceType);
|
|
27667
|
+
const writeOnlyProperties = await getTopLevelWriteOnlyProperties(resourceType);
|
|
27668
|
+
if (writeOnlyProperties.size > 0) {
|
|
27669
|
+
const keptOnPreviousSide = getTopLevelKeysHoldingUnreadableCreateOnly(resourceType, cleanProperties);
|
|
27670
|
+
const previousWithoutWriteOnly = { ...cleanPreviousProperties };
|
|
27671
|
+
for (const propertyName of writeOnlyProperties) {
|
|
27672
|
+
if (keptOnPreviousSide.has(propertyName) && isDeepStrictEqual(cleanPreviousProperties[propertyName], cleanProperties[propertyName])) continue;
|
|
27673
|
+
delete previousWithoutWriteOnly[propertyName];
|
|
27674
|
+
}
|
|
27675
|
+
patch = this.patchGenerator.generatePatch(previousWithoutWriteOnly, cleanProperties);
|
|
27676
|
+
if (patch.length === 0) {
|
|
27677
|
+
this.logger.debug(`Only removed write-only properties detected for ${logicalId}, skipping update`);
|
|
27678
|
+
return {
|
|
27679
|
+
physicalId,
|
|
27680
|
+
wasReplaced: false,
|
|
27681
|
+
sentNothing: true
|
|
27682
|
+
};
|
|
27683
|
+
}
|
|
27684
|
+
}
|
|
27685
|
+
patch = withGuardDutyDetectorReadBackOps(resourceType, patch, cleanProperties, context?.desiredFromAwsReadback === true ? { previous: cleanPreviousProperties } : void 0);
|
|
27686
|
+
let reimported = false;
|
|
27687
|
+
if (isApiGatewayV2Import(resourceType, cleanProperties)) {
|
|
27688
|
+
const split = splitApiGatewayV2ImportPatch(patch, cleanPreviousProperties, cleanProperties);
|
|
27689
|
+
patch = split.rest;
|
|
27690
|
+
if (split.reimport !== void 0) {
|
|
27691
|
+
await this.reimportApiGatewayV2(logicalId, physicalId, resourceType, split.reimport);
|
|
27692
|
+
reimported = true;
|
|
27693
|
+
} else if (patch.length === 0) {
|
|
27694
|
+
this.logger.debug(`No property changes detected for ${logicalId}, skipping update`);
|
|
27695
|
+
return {
|
|
27696
|
+
physicalId,
|
|
27697
|
+
wasReplaced: false,
|
|
27698
|
+
sentNothing: true
|
|
27699
|
+
};
|
|
27700
|
+
}
|
|
27701
|
+
}
|
|
27702
|
+
this.logger.debug(`Generated ${patch.length} patch operations for ${logicalId}: ${JSON.stringify(maskDeep(patch.map((op) => {
|
|
27703
|
+
const anyOp = op;
|
|
27704
|
+
return {
|
|
27705
|
+
op: anyOp.op,
|
|
27706
|
+
path: anyOp.path
|
|
27707
|
+
};
|
|
27708
|
+
}), maskerOrIdentity(context?.maskSecrets)))}`);
|
|
27709
|
+
let progressEvent;
|
|
27710
|
+
if (!(reimported && patch.length === 0)) {
|
|
27711
|
+
const updateResponse = await this.cloudControlClient.send(new UpdateResourceCommand({
|
|
27712
|
+
TypeName: resourceType,
|
|
27713
|
+
Identifier: physicalId,
|
|
27714
|
+
PatchDocument: JSON.stringify(patch)
|
|
27715
|
+
}));
|
|
27716
|
+
if (!updateResponse.ProgressEvent?.RequestToken) throw new ProvisioningError(`Failed to update resource ${logicalId}: No request token received`, resourceType, logicalId, physicalId);
|
|
27717
|
+
this.logger.debug(`Update request submitted for ${logicalId}, token: ${updateResponse.ProgressEvent.RequestToken}`);
|
|
27718
|
+
progressEvent = await this.waitForOperation(updateResponse.ProgressEvent.RequestToken, logicalId, "UPDATE", resourceType);
|
|
27719
|
+
}
|
|
27720
|
+
this.logger.debug(`Updated resource ${logicalId}`);
|
|
27721
|
+
const result = {
|
|
27722
|
+
physicalId,
|
|
27723
|
+
wasReplaced: false
|
|
27724
|
+
};
|
|
27725
|
+
if (progressEvent?.ResourceModel) result.attributes = this.parseResourceModel(progressEvent.ResourceModel, idLog);
|
|
27726
|
+
result.attributes = await this.mergeSparseModelReadback(resourceType, physicalId, result.attributes || {}, idLog);
|
|
27727
|
+
const modelKeys = Object.keys(result.attributes);
|
|
27728
|
+
result.attributes = await this.enrichResourceAttributes(resourceType, physicalId, result.attributes, idLog);
|
|
27729
|
+
result.attributes = await this.maskDeployedNonAttributeKeys(result.attributes, modelKeys, resourceType, physicalId, attributeNamesLookup, properties, maskerOrIdentity(context?.maskSecrets), idLog);
|
|
27730
|
+
return result;
|
|
27731
|
+
} catch (error) {
|
|
27732
|
+
this.handleError(error, "UPDATE", resourceType, logicalId, physicalId);
|
|
27733
|
+
}
|
|
27734
|
+
}
|
|
27735
|
+
async function reimportApiGatewayV2(logicalId, physicalId, resourceType, reimport) {
|
|
27736
|
+
if (reimport.fromS3 && reimport.body !== void 0) throw markNonRetryable(new ProvisioningError(`Cannot update ${logicalId} (${resourceType}): it declares both Body and BodyS3Location. Declare the OpenAPI definition in one of them.`, resourceType, logicalId, physicalId));
|
|
27737
|
+
let region;
|
|
27738
|
+
try {
|
|
27739
|
+
region = canonicalizeRegion((await this.cloudControlClient.config.region())?.trim());
|
|
27740
|
+
} catch {
|
|
27741
|
+
region = void 0;
|
|
27742
|
+
}
|
|
27743
|
+
if (region === void 0 || region === "") throw markNonRetryable(new ProvisioningError(`Refusing to update ${logicalId} (${resourceType}, ${physicalId}): cdkd could not resolve the Cloud Control client's region, so it cannot show ReimportApi would reach this API. Re-run with --region set to the stack's region.`, resourceType, logicalId, physicalId));
|
|
27744
|
+
const body = reimport.fromS3 ? await this.readApiGatewayV2DefinitionObject(logicalId, physicalId, resourceType, reimport.bodyS3Location) : reimport.body;
|
|
27745
|
+
const { ApiGatewayV2Client, ReimportApiCommand } = await import("@aws-sdk/client-apigatewayv2");
|
|
27746
|
+
const client = new ApiGatewayV2Client({
|
|
27747
|
+
...ambientClientDefaults(),
|
|
27748
|
+
region
|
|
27749
|
+
});
|
|
27750
|
+
try {
|
|
27751
|
+
await client.send(new ReimportApiCommand({
|
|
27752
|
+
ApiId: physicalId,
|
|
27753
|
+
Body: body,
|
|
27754
|
+
...reimport.basePath !== void 0 ? { Basepath: reimport.basePath } : {},
|
|
27755
|
+
...reimport.failOnWarnings !== void 0 ? { FailOnWarnings: reimport.failOnWarnings } : {}
|
|
27756
|
+
}));
|
|
27757
|
+
} finally {
|
|
27758
|
+
client.destroy();
|
|
27759
|
+
}
|
|
27760
|
+
this.logger.debug(`Reimported the OpenAPI definition of ${logicalId}`);
|
|
27761
|
+
}
|
|
27762
|
+
async function readApiGatewayV2DefinitionObject(logicalId, physicalId, resourceType, location) {
|
|
27763
|
+
const object = apiGatewayV2DefinitionObject(location);
|
|
27764
|
+
if (object === void 0) throw markNonRetryable(new ProvisioningError(`Cannot update ${logicalId} (${resourceType}): its BodyS3Location is not an object with string Bucket and Key (and optional string Version / Etag), so cdkd cannot read the OpenAPI definition to reimport.`, resourceType, logicalId, physicalId));
|
|
27765
|
+
const shown = `s3://${displaySafe(object.bucket)}/${displaySafe(object.key)}`;
|
|
27766
|
+
const shared = getAwsClients().s3;
|
|
27767
|
+
const owned = [];
|
|
27768
|
+
const read = async (s3) => {
|
|
27769
|
+
const text = await (await s3.send(new GetObjectCommand({
|
|
27770
|
+
Bucket: object.bucket,
|
|
27771
|
+
Key: object.key,
|
|
27772
|
+
...object.version !== void 0 ? { VersionId: object.version } : {}
|
|
27773
|
+
}))).Body?.transformToString();
|
|
27774
|
+
if (text === void 0) throw markNonRetryable(new ProvisioningError(`Cannot update ${logicalId} (${resourceType}): S3 returned no body for its OpenAPI definition ${shown}.`, resourceType, logicalId, physicalId));
|
|
27775
|
+
return text;
|
|
27776
|
+
};
|
|
27777
|
+
let redirected = false;
|
|
27778
|
+
try {
|
|
27779
|
+
const rebuilt = await rebuildClientForBucketRegion(shared, object.bucket, {
|
|
27780
|
+
reuseClientCredentials: true,
|
|
27781
|
+
tolerateNonStandardClient: true
|
|
27782
|
+
});
|
|
27783
|
+
if (rebuilt) owned.push(rebuilt);
|
|
27784
|
+
const first = rebuilt ?? shared;
|
|
27785
|
+
try {
|
|
27786
|
+
return await read(first);
|
|
27787
|
+
} catch (error) {
|
|
27788
|
+
const redirectRegion = s3RedirectRegion(error);
|
|
27789
|
+
if (redirectRegion === void 0) throw error;
|
|
27790
|
+
redirected = true;
|
|
27791
|
+
const regional = new S3Client({
|
|
27792
|
+
...awsClientDefaults(),
|
|
27793
|
+
...s3ClientDefaults(),
|
|
27794
|
+
region: redirectRegion,
|
|
27795
|
+
credentials: first.config?.credentials,
|
|
27796
|
+
logger: quietS3Logger()
|
|
27797
|
+
});
|
|
27798
|
+
owned.push(regional);
|
|
27799
|
+
return await read(regional);
|
|
27800
|
+
}
|
|
27801
|
+
} catch (error) {
|
|
27802
|
+
if (error instanceof ProvisioningError) throw error;
|
|
27803
|
+
this.logger.debug(`Reading the OpenAPI definition ${shown} of ${logicalId} failed: ` + displaySafe(describeAwsFailure(error).detail));
|
|
27804
|
+
const name = error?.name;
|
|
27805
|
+
const errorClass = typeof name === "string" && name !== "" ? displaySafe(name) : "Error";
|
|
27806
|
+
const status = error?.$metadata?.httpStatusCode;
|
|
27807
|
+
let next;
|
|
27808
|
+
if (errorClass === "AccessDenied" || status === 403) next = ` The deploy identity needs s3:GetObject on it` + (object.version !== void 0 ? " (and s3:GetObjectVersion for the pinned Version)" : "") + ", and kms:Decrypt on its key if the object is SSE-KMS encrypted.";
|
|
27809
|
+
else if (errorClass === "NoSuchKey" || errorClass === "NoSuchBucket" || errorClass === "NoSuchVersion") next = " Upload the definition there, or point BodyS3Location at the right object.";
|
|
27810
|
+
else if (errorClass === "PermanentRedirect" || status === 301) next = (redirected ? ` S3 redirected the read twice.` : ` S3 named no region to redirect to.`) + " cdkd could not reach the bucket's region: grant the deploy identity s3:GetBucketLocation on the bucket, or keep the definition in a bucket of this region.";
|
|
27811
|
+
const wrapped = new ProvisioningError(`Cannot update ${logicalId} (${resourceType}): reading its OpenAPI definition ${shown} failed with ${errorClass}.${next ?? ""} ${VERBOSE_POINTER}`, resourceType, logicalId, physicalId, error instanceof Error ? error : void 0);
|
|
27812
|
+
throw next !== void 0 ? markNonRetryable(wrapped) : markRedactedCause(wrapped);
|
|
27813
|
+
} finally {
|
|
27814
|
+
for (const client of owned) client.destroy();
|
|
27815
|
+
}
|
|
27816
|
+
}
|
|
27817
|
+
|
|
26818
27818
|
// src/provisioning/ec2-termination-protection.ts
|
|
26819
27819
|
async function disableInstanceApiTermination(client, instanceId, logger) {
|
|
26820
27820
|
try {
|
|
@@ -26883,43 +27883,6 @@ function ec2InstanceProtectionSite(instanceId, region) {
|
|
|
26883
27883
|
};
|
|
26884
27884
|
}
|
|
26885
27885
|
|
|
26886
|
-
// src/provisioning/wait-abandoned.ts
|
|
26887
|
-
const WAIT_ABANDONED_MARKER = Symbol.for("cdkd.waitAbandoned");
|
|
26888
|
-
const ABANDONED_REQUEST = Symbol.for("cdkd.waitAbandoned.request");
|
|
26889
|
-
const MAX_CAUSE_CHAIN_DEPTH = 5;
|
|
26890
|
-
function markWaitAbandoned(error, request) {
|
|
26891
|
-
if (!Object.isExtensible(error)) return error;
|
|
26892
|
-
Object.defineProperty(error, WAIT_ABANDONED_MARKER, {
|
|
26893
|
-
value: true,
|
|
26894
|
-
enumerable: false,
|
|
26895
|
-
configurable: true,
|
|
26896
|
-
writable: false
|
|
26897
|
-
});
|
|
26898
|
-
if (request !== void 0) Object.defineProperty(error, ABANDONED_REQUEST, {
|
|
26899
|
-
value: Object.freeze({ ...request }),
|
|
26900
|
-
enumerable: false,
|
|
26901
|
-
configurable: true,
|
|
26902
|
-
writable: false
|
|
26903
|
-
});
|
|
26904
|
-
return error;
|
|
26905
|
-
}
|
|
26906
|
-
function isWaitAbandonedError(error) {
|
|
26907
|
-
let current = error;
|
|
26908
|
-
for (let depth = 0; depth < MAX_CAUSE_CHAIN_DEPTH && current != null; depth++) {
|
|
26909
|
-
if (current[WAIT_ABANDONED_MARKER] === true) return true;
|
|
26910
|
-
current = current.cause;
|
|
26911
|
-
}
|
|
26912
|
-
return false;
|
|
26913
|
-
}
|
|
26914
|
-
function abandonedRequestOf(error) {
|
|
26915
|
-
let current = error;
|
|
26916
|
-
for (let depth = 0; depth < MAX_CAUSE_CHAIN_DEPTH && current != null; depth++) {
|
|
26917
|
-
const request = current[ABANDONED_REQUEST];
|
|
26918
|
-
if (request !== void 0) return request;
|
|
26919
|
-
current = current.cause;
|
|
26920
|
-
}
|
|
26921
|
-
}
|
|
26922
|
-
|
|
26923
27886
|
// src/provisioning/ec2-volume-delete.ts
|
|
26924
27887
|
async function deleteEc2VolumeDirect(client, volumeId, logicalId, opts) {
|
|
26925
27888
|
const now = opts.now ?? Date.now;
|
|
@@ -27523,529 +28486,26 @@ function orderInlinePolicyReversals(replay, stateResources) {
|
|
|
27523
28486
|
const dependsOn = (a, b) => [current(a), a.previousState].some((r) => Array.isArray(r?.dependencies) && r.dependencies.includes(b.logicalId));
|
|
27524
28487
|
const order = [...replay];
|
|
27525
28488
|
for (const op of [...replay].reverse()) {
|
|
27526
|
-
if (!isStandalone(op)) continue;
|
|
27527
|
-
const mine = keysOf.get(op);
|
|
27528
|
-
if (mine === void 0) continue;
|
|
27529
|
-
const at = order.indexOf(op);
|
|
27530
|
-
let last = -1;
|
|
27531
|
-
for (let j = at + 1; j < order.length; j++) {
|
|
27532
|
-
const other = order[j];
|
|
27533
|
-
const theirs = keysOf.get(other);
|
|
27534
|
-
if (dependsOn(op, other) || dependsOn(other, op)) break;
|
|
27535
|
-
if (theirs === void 0 || isStandalone(other)) continue;
|
|
27536
|
-
if (collide(mine, theirs)) last = j;
|
|
27537
|
-
}
|
|
27538
|
-
if (last < 0) continue;
|
|
27539
|
-
order.splice(at, 1);
|
|
27540
|
-
order.splice(last, 0, op);
|
|
27541
|
-
}
|
|
27542
|
-
return order;
|
|
27543
|
-
}
|
|
27544
|
-
function ownPoliciesChange(change) {
|
|
27545
|
-
return (change?.propertyChanges ?? []).some((c) => c.path === "Policies" && c.inPlacePropagated !== true && c.replacementPropagated !== true);
|
|
27546
|
-
}
|
|
27547
|
-
|
|
27548
|
-
// src/provisioning/json-patch-generator.ts
|
|
27549
|
-
var JsonPatchGenerator = class {
|
|
27550
|
-
logger = getLogger().child("JsonPatchGenerator");
|
|
27551
|
-
generatePatch(previousProperties, desiredProperties) {
|
|
27552
|
-
const patches = [];
|
|
27553
|
-
for (const [key, value] of Object.entries(desiredProperties)) {
|
|
27554
|
-
const previousValue = Object.hasOwn(previousProperties, key) ? previousProperties[key] : void 0;
|
|
27555
|
-
if (previousValue === void 0) patches.push({
|
|
27556
|
-
op: "add",
|
|
27557
|
-
path: `/${this.escapeJsonPointer(key)}`,
|
|
27558
|
-
value
|
|
27559
|
-
});
|
|
27560
|
-
else if (!this.deepEqual(previousValue, value)) patches.push({
|
|
27561
|
-
op: "replace",
|
|
27562
|
-
path: `/${this.escapeJsonPointer(key)}`,
|
|
27563
|
-
value
|
|
27564
|
-
});
|
|
27565
|
-
}
|
|
27566
|
-
for (const key of Object.keys(previousProperties)) if (!Object.hasOwn(desiredProperties, key)) patches.push({
|
|
27567
|
-
op: "remove",
|
|
27568
|
-
path: `/${this.escapeJsonPointer(key)}`
|
|
27569
|
-
});
|
|
27570
|
-
this.logger.debug(`Generated ${patches.length} patch operations`);
|
|
27571
|
-
return patches;
|
|
27572
|
-
}
|
|
27573
|
-
generateFullReplacementPatch(properties) {
|
|
27574
|
-
return [{
|
|
27575
|
-
op: "replace",
|
|
27576
|
-
path: "/",
|
|
27577
|
-
value: properties
|
|
27578
|
-
}];
|
|
27579
|
-
}
|
|
27580
|
-
escapeJsonPointer(str) {
|
|
27581
|
-
return str.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
27582
|
-
}
|
|
27583
|
-
deepEqual(a, b) {
|
|
27584
|
-
if (a === b) return true;
|
|
27585
|
-
if (typeof a !== typeof b) return false;
|
|
27586
|
-
if (a === null || b === null) return false;
|
|
27587
|
-
if (Array.isArray(a) && Array.isArray(b)) {
|
|
27588
|
-
if (a.length !== b.length) return false;
|
|
27589
|
-
return a.every((item, index) => this.deepEqual(item, b[index]));
|
|
27590
|
-
}
|
|
27591
|
-
if (typeof a === "object" && typeof b === "object") {
|
|
27592
|
-
const aObj = a;
|
|
27593
|
-
const bObj = b;
|
|
27594
|
-
const aKeys = Object.keys(aObj);
|
|
27595
|
-
const bKeys = Object.keys(bObj);
|
|
27596
|
-
if (aKeys.length !== bKeys.length) return false;
|
|
27597
|
-
return aKeys.every((key) => Object.hasOwn(bObj, key) && this.deepEqual(aObj[key], bObj[key]));
|
|
27598
|
-
}
|
|
27599
|
-
return false;
|
|
27600
|
-
}
|
|
27601
|
-
};
|
|
27602
|
-
|
|
27603
|
-
// src/provisioning/guardduty-detector-patch.ts
|
|
27604
|
-
const DETECTOR_TYPE = "AWS::GuardDuty::Detector";
|
|
27605
|
-
const READ_BACK_KEYS = ["Features", "DataSources"];
|
|
27606
|
-
function withGuardDutyDetectorReadBackOps(resourceType, patch, desired, readback) {
|
|
27607
|
-
if (resourceType !== DETECTOR_TYPE || patch.length === 0) return patch;
|
|
27608
|
-
let out = patch;
|
|
27609
|
-
if (readback) {
|
|
27610
|
-
out = patch.map((op) => op.path === "/Features" ? narrowToChangedFeatures(op, readback.previous["Features"]) : op);
|
|
27611
|
-
if (out.some((op) => op.path === "/Features" && op.op !== "remove")) out = out.map((op) => op.path === "/DataSources" ? {
|
|
27612
|
-
op: "remove",
|
|
27613
|
-
path: "/DataSources"
|
|
27614
|
-
} : op);
|
|
27615
|
-
}
|
|
27616
|
-
const extra = [];
|
|
27617
|
-
for (const key of READ_BACK_KEYS) {
|
|
27618
|
-
if (out.some((op) => op.path === `/${key}`)) continue;
|
|
27619
|
-
if (readback) {
|
|
27620
|
-
if (Object.prototype.hasOwnProperty.call(readback.previous, key)) extra.push({
|
|
27621
|
-
op: "remove",
|
|
27622
|
-
path: `/${key}`
|
|
27623
|
-
});
|
|
27624
|
-
continue;
|
|
27625
|
-
}
|
|
27626
|
-
extra.push(Object.prototype.hasOwnProperty.call(desired, key) ? {
|
|
27627
|
-
op: "add",
|
|
27628
|
-
path: `/${key}`,
|
|
27629
|
-
value: desired[key]
|
|
27630
|
-
} : {
|
|
27631
|
-
op: "remove",
|
|
27632
|
-
path: `/${key}`
|
|
27633
|
-
});
|
|
27634
|
-
}
|
|
27635
|
-
return extra.length === 0 && out === patch ? patch : [...out, ...extra];
|
|
27636
|
-
}
|
|
27637
|
-
function narrowToChangedFeatures(op, current) {
|
|
27638
|
-
if (!Array.isArray(op.value) || !Array.isArray(current)) return op;
|
|
27639
|
-
const byName = /* @__PURE__ */ new Map();
|
|
27640
|
-
for (const entry of current) byName.set(featureName(entry), entry);
|
|
27641
|
-
const changed = [];
|
|
27642
|
-
for (const entry of op.value) {
|
|
27643
|
-
const name = featureName(entry);
|
|
27644
|
-
if (name === void 0) return op;
|
|
27645
|
-
if (!isDeepStrictEqual(entry, byName.get(name))) changed.push(entry);
|
|
27646
|
-
}
|
|
27647
|
-
if (changed.length === 0) throw markNonRetryable(/* @__PURE__ */ new Error("cannot revert Features: the live list differs from the recorded baseline only in the order of its entries or in entries GuardDuty added, which UpdateDetector cannot undo, so nothing on this detector was reverted. cdkd drift --accept would record the live list, but it records the live value of EVERY drifted property of the stack, not only Features: revert any other drift on this detector first (for example with aws guardduty update-detector), then run it."));
|
|
27648
|
-
return {
|
|
27649
|
-
...op,
|
|
27650
|
-
value: changed
|
|
27651
|
-
};
|
|
27652
|
-
}
|
|
27653
|
-
function featureName(entry) {
|
|
27654
|
-
const name = entry?.["Name"];
|
|
27655
|
-
return typeof name === "string" ? name : void 0;
|
|
27656
|
-
}
|
|
27657
|
-
|
|
27658
|
-
// src/provisioning/apigwv2-body-import-patch.ts
|
|
27659
|
-
const API_TYPE = "AWS::ApiGatewayV2::Api";
|
|
27660
|
-
const DEFINITION_KEYS = ["Body", "BodyS3Location"];
|
|
27661
|
-
const IMPORT_KEYS = [
|
|
27662
|
-
...DEFINITION_KEYS,
|
|
27663
|
-
"BasePath",
|
|
27664
|
-
"FailOnWarnings"
|
|
27665
|
-
];
|
|
27666
|
-
function isApiGatewayV2Import(resourceType, desired) {
|
|
27667
|
-
return resourceType === API_TYPE && DEFINITION_KEYS.some((key) => Object.prototype.hasOwnProperty.call(desired, key));
|
|
27668
|
-
}
|
|
27669
|
-
function splitApiGatewayV2ImportPatch(patch, previous, desired) {
|
|
27670
|
-
const importPaths = new Set(IMPORT_KEYS.map((key) => `/${key}`));
|
|
27671
|
-
const rest = patch.filter((op) => !importPaths.has(op.path));
|
|
27672
|
-
if (!IMPORT_KEYS.some((key) => !isDeepStrictEqual(previous[key], desired[key]))) return {
|
|
27673
|
-
rest,
|
|
27674
|
-
reimport: void 0
|
|
27675
|
-
};
|
|
27676
|
-
if (Object.prototype.hasOwnProperty.call(desired, "Description") && !rest.some((op) => op.path === "/Description")) rest.push({
|
|
27677
|
-
op: "add",
|
|
27678
|
-
path: "/Description",
|
|
27679
|
-
value: desired["Description"]
|
|
27680
|
-
});
|
|
27681
|
-
const body = desired["Body"];
|
|
27682
|
-
const basePath = desired["BasePath"];
|
|
27683
|
-
const failOnWarnings = desired["FailOnWarnings"];
|
|
27684
|
-
return {
|
|
27685
|
-
rest,
|
|
27686
|
-
reimport: {
|
|
27687
|
-
body: body === void 0 ? void 0 : typeof body === "string" ? body : JSON.stringify(body),
|
|
27688
|
-
fromS3: Object.prototype.hasOwnProperty.call(desired, "BodyS3Location"),
|
|
27689
|
-
bodyS3Location: desired["BodyS3Location"],
|
|
27690
|
-
basePath: typeof basePath === "string" ? basePath : void 0,
|
|
27691
|
-
failOnWarnings: failOnWarnings === true || failOnWarnings === "true" ? true : failOnWarnings === false || failOnWarnings === "false" ? false : void 0
|
|
27692
|
-
}
|
|
27693
|
-
};
|
|
27694
|
-
}
|
|
27695
|
-
function apiGatewayV2DefinitionObject(location) {
|
|
27696
|
-
if (location === null || typeof location !== "object" || Array.isArray(location)) return;
|
|
27697
|
-
const { Bucket, Key, Version, Etag } = location;
|
|
27698
|
-
if (typeof Bucket !== "string" || Bucket === "" || typeof Key !== "string" || Key === "") return;
|
|
27699
|
-
if (Version !== void 0 && typeof Version !== "string") return void 0;
|
|
27700
|
-
if (Etag !== void 0 && typeof Etag !== "string") return void 0;
|
|
27701
|
-
return {
|
|
27702
|
-
bucket: Bucket,
|
|
27703
|
-
key: Key,
|
|
27704
|
-
version: Version === "" ? void 0 : Version,
|
|
27705
|
-
etag: Etag === "" ? void 0 : Etag
|
|
27706
|
-
};
|
|
27707
|
-
}
|
|
27708
|
-
|
|
27709
|
-
// src/provisioning/secret-reference-immutable.ts
|
|
27710
|
-
const IDENTITY = maskerOrIdentity(void 0);
|
|
27711
|
-
async function unchangedBehindSecretReference(evidence) {
|
|
27712
|
-
const { resourceType, key, desired, previous, physicalName, maskSecrets } = evidence;
|
|
27713
|
-
if (physicalName !== void 0 && physicalName !== "") return isSecretDerivedValue(previous, IDENTITY) && desired === physicalName;
|
|
27714
|
-
if (!onlySecretReferencesDiffer(desired, previous, maskSecrets)) return false;
|
|
27715
|
-
return await engineReplacesOnAnyChange(resourceType, key);
|
|
27716
|
-
}
|
|
27717
|
-
let registry;
|
|
27718
|
-
async function engineReplacesOnAnyChange(resourceType, key) {
|
|
27719
|
-
registry ??= new ReplacementRulesRegistry();
|
|
27720
|
-
if (registry.isClassified(resourceType, key)) return registry.conditionalReplacementVerdict(resourceType, key, void 0, void 0) === void 0 && registry.requiresReplacement(resourceType, key, void 0, void 0);
|
|
27721
|
-
return (await getCreateOnlyPropertyPaths(resourceType)).some((path) => path.length === 1 && path[0] === key);
|
|
27722
|
-
}
|
|
27723
|
-
function onlySecretReferencesDiffer(desired, previous, maskSecrets) {
|
|
27724
|
-
return compare(desired, previous, maskerOrIdentity(maskSecrets)) === "references-only";
|
|
27725
|
-
}
|
|
27726
|
-
function compare(desired, previous, mask) {
|
|
27727
|
-
if (typeof previous === "string") {
|
|
27728
|
-
if (desired === previous) return "equal";
|
|
27729
|
-
return resolvesReference(desired, previous, mask) ? "references-only" : "differs";
|
|
27730
|
-
}
|
|
27731
|
-
if (Array.isArray(previous)) {
|
|
27732
|
-
if (!Array.isArray(desired) || desired.length !== previous.length) return "differs";
|
|
27733
|
-
return combine(previous.map((item, i) => compare(desired[i], item, mask)));
|
|
27734
|
-
}
|
|
27735
|
-
if (isPlainObject$6(previous)) {
|
|
27736
|
-
if (!isPlainObject$6(desired)) return "differs";
|
|
27737
|
-
if (!Object.keys(desired).every((k) => Object.prototype.hasOwnProperty.call(previous, k))) return "differs";
|
|
27738
|
-
return combine(Object.keys(previous).map((k) => compare(desired[k], previous[k], mask)));
|
|
27739
|
-
}
|
|
27740
|
-
return JSON.stringify(desired) === JSON.stringify(previous) ? "equal" : "differs";
|
|
27741
|
-
}
|
|
27742
|
-
function combine(verdicts) {
|
|
27743
|
-
if (verdicts.includes("differs")) return "differs";
|
|
27744
|
-
return verdicts.includes("references-only") ? "references-only" : "equal";
|
|
27745
|
-
}
|
|
27746
|
-
function resolvesReference(desired, previous, mask) {
|
|
27747
|
-
if (typeof desired !== "string" || desired === "") return false;
|
|
27748
|
-
const tokens = dynamicReferenceTokens(previous);
|
|
27749
|
-
if (tokens.length === 0) return false;
|
|
27750
|
-
if (mask(desired) === desired) return false;
|
|
27751
|
-
const literals = [];
|
|
27752
|
-
let rest = previous;
|
|
27753
|
-
for (const token of tokens) {
|
|
27754
|
-
const at = rest.indexOf(token);
|
|
27755
|
-
literals.push(rest.slice(0, at));
|
|
27756
|
-
rest = rest.slice(at + token.length);
|
|
27757
|
-
}
|
|
27758
|
-
literals.push(rest);
|
|
27759
|
-
const pattern = literals.map(escapeRegExp$1).join("[\\s\\S]*");
|
|
27760
|
-
return new RegExp(`^${pattern}$`).test(desired);
|
|
27761
|
-
}
|
|
27762
|
-
function isPlainObject$6(value) {
|
|
27763
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
27764
|
-
}
|
|
27765
|
-
function escapeRegExp$1(text) {
|
|
27766
|
-
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
27767
|
-
}
|
|
27768
|
-
|
|
27769
|
-
// src/provisioning/getatt-attributes.generated.ts
|
|
27770
|
-
const WRITABLE_GETATT_ATTRIBUTES = {
|
|
27771
|
-
"AWS::Amplify::Branch": ["BranchName"],
|
|
27772
|
-
"AWS::Amplify::Domain": [
|
|
27773
|
-
"AutoSubDomainCreationPatterns",
|
|
27774
|
-
"AutoSubDomainIAMRole",
|
|
27775
|
-
"DomainName",
|
|
27776
|
-
"EnableAutoSubDomain"
|
|
27777
|
-
],
|
|
27778
|
-
"AWS::AppMesh::GatewayRoute": [
|
|
27779
|
-
"GatewayRouteName",
|
|
27780
|
-
"MeshName",
|
|
27781
|
-
"MeshOwner",
|
|
27782
|
-
"VirtualGatewayName"
|
|
27783
|
-
],
|
|
27784
|
-
"AWS::AppMesh::Mesh": ["MeshName"],
|
|
27785
|
-
"AWS::AppMesh::Route": [
|
|
27786
|
-
"MeshName",
|
|
27787
|
-
"MeshOwner",
|
|
27788
|
-
"RouteName",
|
|
27789
|
-
"VirtualRouterName"
|
|
27790
|
-
],
|
|
27791
|
-
"AWS::AppMesh::VirtualGateway": [
|
|
27792
|
-
"MeshName",
|
|
27793
|
-
"MeshOwner",
|
|
27794
|
-
"VirtualGatewayName"
|
|
27795
|
-
],
|
|
27796
|
-
"AWS::AppMesh::VirtualNode": [
|
|
27797
|
-
"MeshName",
|
|
27798
|
-
"MeshOwner",
|
|
27799
|
-
"VirtualNodeName"
|
|
27800
|
-
],
|
|
27801
|
-
"AWS::AppMesh::VirtualRouter": [
|
|
27802
|
-
"MeshName",
|
|
27803
|
-
"MeshOwner",
|
|
27804
|
-
"VirtualRouterName"
|
|
27805
|
-
],
|
|
27806
|
-
"AWS::AppMesh::VirtualService": [
|
|
27807
|
-
"MeshName",
|
|
27808
|
-
"MeshOwner",
|
|
27809
|
-
"VirtualServiceName"
|
|
27810
|
-
],
|
|
27811
|
-
"AWS::AppSync::DataSource": ["Name"],
|
|
27812
|
-
"AWS::AppSync::DomainName": ["DomainName"],
|
|
27813
|
-
"AWS::AppSync::FunctionConfiguration": ["DataSourceName", "Name"],
|
|
27814
|
-
"AWS::AppSync::Resolver": ["FieldName", "TypeName"],
|
|
27815
|
-
"AWS::Backup::BackupSelection": ["BackupPlanId"],
|
|
27816
|
-
"AWS::Backup::BackupVault": ["BackupVaultName"],
|
|
27817
|
-
"AWS::CleanRooms::AnalysisTemplate": ["Schema"],
|
|
27818
|
-
"AWS::Cloud9::EnvironmentEC2": ["Name"],
|
|
27819
|
-
"AWS::CloudWatch::InsightRule": ["RuleName"],
|
|
27820
|
-
"AWS::CodeArtifact::Domain": ["EncryptionKey"],
|
|
27821
|
-
"AWS::CodeArtifact::Repository": ["DomainName", "DomainOwner"],
|
|
27822
|
-
"AWS::EC2::CapacityReservation": [
|
|
27823
|
-
"AvailabilityZone",
|
|
27824
|
-
"InstanceType",
|
|
27825
|
-
"Tenancy"
|
|
27826
|
-
],
|
|
27827
|
-
"AWS::EC2::Instance": ["AvailabilityZone"],
|
|
27828
|
-
"AWS::EC2::SecurityGroup": ["VpcId"],
|
|
27829
|
-
"AWS::EC2::Subnet": [
|
|
27830
|
-
"AvailabilityZone",
|
|
27831
|
-
"AvailabilityZoneId",
|
|
27832
|
-
"CidrBlock",
|
|
27833
|
-
"OutpostArn",
|
|
27834
|
-
"VpcId"
|
|
27835
|
-
],
|
|
27836
|
-
"AWS::EC2::VPC": ["CidrBlock"],
|
|
27837
|
-
"AWS::EFS::MountTarget": ["IpAddress"],
|
|
27838
|
-
"AWS::EKS::Nodegroup": ["ClusterName", "NodegroupName"],
|
|
27839
|
-
"AWS::ElasticLoadBalancingV2::LoadBalancer": ["SecurityGroups"],
|
|
27840
|
-
"AWS::EventSchemas::Discoverer": ["CrossAccount"],
|
|
27841
|
-
"AWS::EventSchemas::Registry": ["RegistryName"],
|
|
27842
|
-
"AWS::EventSchemas::Schema": ["SchemaName"],
|
|
27843
|
-
"AWS::Events::EventBus": ["Name"],
|
|
27844
|
-
"AWS::GameLift::GameSessionQueue": ["Name"],
|
|
27845
|
-
"AWS::GameLift::MatchmakingConfiguration": ["Name"],
|
|
27846
|
-
"AWS::GameLift::MatchmakingRuleSet": ["Name"],
|
|
27847
|
-
"AWS::Grafana::Workspace": ["GrafanaVersion"],
|
|
27848
|
-
"AWS::Greengrass::ConnectorDefinition": ["Name"],
|
|
27849
|
-
"AWS::Greengrass::CoreDefinition": ["Name"],
|
|
27850
|
-
"AWS::Greengrass::DeviceDefinition": ["Name"],
|
|
27851
|
-
"AWS::Greengrass::FunctionDefinition": ["Name"],
|
|
27852
|
-
"AWS::Greengrass::Group": ["Name", "RoleArn"],
|
|
27853
|
-
"AWS::Greengrass::LoggerDefinition": ["Name"],
|
|
27854
|
-
"AWS::Greengrass::ResourceDefinition": ["Name"],
|
|
27855
|
-
"AWS::Greengrass::SubscriptionDefinition": ["Name"],
|
|
27856
|
-
"AWS::ImageBuilder::Component": ["Name"],
|
|
27857
|
-
"AWS::ImageBuilder::ContainerRecipe": ["Name"],
|
|
27858
|
-
"AWS::ImageBuilder::DistributionConfiguration": ["Name"],
|
|
27859
|
-
"AWS::ImageBuilder::ImagePipeline": ["Name"],
|
|
27860
|
-
"AWS::ImageBuilder::ImageRecipe": ["Name"],
|
|
27861
|
-
"AWS::ImageBuilder::InfrastructureConfiguration": ["Name"],
|
|
27862
|
-
"AWS::Kinesis::StreamConsumer": ["ConsumerName", "StreamARN"],
|
|
27863
|
-
"AWS::MSK::Cluster": ["CurrentVersion"],
|
|
27864
|
-
"AWS::ManagedBlockchain::Member": ["NetworkId"],
|
|
27865
|
-
"AWS::ManagedBlockchain::Node": ["MemberId", "NetworkId"],
|
|
27866
|
-
"AWS::MediaConvert::JobTemplate": ["Name"],
|
|
27867
|
-
"AWS::MediaConvert::Preset": ["Name"],
|
|
27868
|
-
"AWS::MediaConvert::Queue": ["Name"],
|
|
27869
|
-
"AWS::NetworkManager::ConnectAttachment": ["ProposedSegmentChange"],
|
|
27870
|
-
"AWS::NetworkManager::SiteToSiteVpnAttachment": ["ProposedSegmentChange"],
|
|
27871
|
-
"AWS::NetworkManager::TransitGatewayRouteTableAttachment": ["ProposedSegmentChange"],
|
|
27872
|
-
"AWS::NetworkManager::VpcAttachment": ["ProposedSegmentChange"],
|
|
27873
|
-
"AWS::OpsWorks::Instance": ["AvailabilityZone"],
|
|
27874
|
-
"AWS::OpsWorks::UserProfile": ["SshUsername"],
|
|
27875
|
-
"AWS::QuickSight::Analysis": ["Errors", "Sheets"],
|
|
27876
|
-
"AWS::RDS::DBInstance": ["DBSystemId"],
|
|
27877
|
-
"AWS::RDS::DBParameterGroup": ["DBParameterGroupName"],
|
|
27878
|
-
"AWS::RedshiftServerless::Workgroup": ["Workgroup"],
|
|
27879
|
-
"AWS::RoboMaker::RobotApplication": ["CurrentRevisionId"],
|
|
27880
|
-
"AWS::RoboMaker::SimulationApplication": ["CurrentRevisionId"],
|
|
27881
|
-
"AWS::Route53Resolver::ResolverEndpoint": [
|
|
27882
|
-
"Direction",
|
|
27883
|
-
"Name",
|
|
27884
|
-
"OutpostArn",
|
|
27885
|
-
"PreferredInstanceType",
|
|
27886
|
-
"ResolverEndpointType"
|
|
27887
|
-
],
|
|
27888
|
-
"AWS::Route53Resolver::ResolverRule": [
|
|
27889
|
-
"DomainName",
|
|
27890
|
-
"Name",
|
|
27891
|
-
"ResolverEndpointId",
|
|
27892
|
-
"TargetIps"
|
|
27893
|
-
],
|
|
27894
|
-
"AWS::Route53Resolver::ResolverRuleAssociation": [
|
|
27895
|
-
"Name",
|
|
27896
|
-
"ResolverRuleId",
|
|
27897
|
-
"VPCId"
|
|
27898
|
-
],
|
|
27899
|
-
"AWS::S3::AccessPoint": ["Name"],
|
|
27900
|
-
"AWS::SNS::Topic": ["TopicName"],
|
|
27901
|
-
"AWS::SQS::Queue": ["QueueName"],
|
|
27902
|
-
"AWS::SSM::Parameter": ["Type"],
|
|
27903
|
-
"AWS::SSM::ResourceDataSync": ["SyncName"],
|
|
27904
|
-
"AWS::SageMaker::CodeRepository": ["CodeRepositoryName"],
|
|
27905
|
-
"AWS::SageMaker::Endpoint": ["EndpointName"],
|
|
27906
|
-
"AWS::SageMaker::EndpointConfig": ["EndpointConfigName"],
|
|
27907
|
-
"AWS::SageMaker::Model": ["ModelName"],
|
|
27908
|
-
"AWS::SageMaker::ModelPackage": ["LastModifiedTime"],
|
|
27909
|
-
"AWS::SageMaker::NotebookInstance": ["NotebookInstanceName"],
|
|
27910
|
-
"AWS::SageMaker::NotebookInstanceLifecycleConfig": ["NotebookInstanceLifecycleConfigName"],
|
|
27911
|
-
"AWS::SageMaker::Workteam": ["WorkteamName"],
|
|
27912
|
-
"AWS::ServiceDiscovery::Service": ["Name"],
|
|
27913
|
-
"AWS::Signer::SigningProfile": ["ProfileName"],
|
|
27914
|
-
"AWS::StepFunctions::Activity": ["Name"],
|
|
27915
|
-
"AWS::Transfer::User": ["ServerId", "UserName"]
|
|
27916
|
-
};
|
|
27917
|
-
const SHAPE_MISMATCHED_GETATT_ATTRIBUTES = {
|
|
27918
|
-
"AWS::DocDB::DBCluster": ["Port"],
|
|
27919
|
-
"AWS::Events::EventBus": ["Policy"],
|
|
27920
|
-
"AWS::MediaLive::Input": ["Destinations", "Sources"]
|
|
27921
|
-
};
|
|
27922
|
-
|
|
27923
|
-
// src/provisioning/read-only-properties.ts
|
|
27924
|
-
function isDefinitiveRefusal(error) {
|
|
27925
|
-
if (isThrottlingError(error)) return false;
|
|
27926
|
-
let current = error;
|
|
27927
|
-
for (let depth = 0; depth < 5 && current != null; depth++) {
|
|
27928
|
-
const status = current.$metadata?.httpStatusCode;
|
|
27929
|
-
if (status !== void 0) return status >= 400 && status < 500;
|
|
27930
|
-
current = current.cause;
|
|
27931
|
-
}
|
|
27932
|
-
return false;
|
|
27933
|
-
}
|
|
27934
|
-
const readOnlyPropertiesCache = /* @__PURE__ */ new Map();
|
|
27935
|
-
const attributeNamesCache = /* @__PURE__ */ new Map();
|
|
27936
|
-
async function getTopLevelAttributeNames(resourceType) {
|
|
27937
|
-
const readOnly = await getTopLevelReadOnlyProperties(resourceType);
|
|
27938
|
-
if (readOnly === void 0) return void 0;
|
|
27939
|
-
const writable = Object.hasOwn(WRITABLE_GETATT_ATTRIBUTES, resourceType) ? WRITABLE_GETATT_ATTRIBUTES[resourceType] : void 0;
|
|
27940
|
-
if (!writable || writable.length === 0) return readOnly;
|
|
27941
|
-
const cached = attributeNamesCache.get(resourceType);
|
|
27942
|
-
if (cached) return cached;
|
|
27943
|
-
const names = /* @__PURE__ */ new Set([...readOnly, ...writable]);
|
|
27944
|
-
attributeNamesCache.set(resourceType, names);
|
|
27945
|
-
return names;
|
|
27946
|
-
}
|
|
27947
|
-
const deployAttributeNamesCache = /* @__PURE__ */ new Map();
|
|
27948
|
-
async function getTopLevelDeployAttributeNames(resourceType) {
|
|
27949
|
-
const certified = await getTopLevelAttributeNames(resourceType);
|
|
27950
|
-
if (certified === void 0) return void 0;
|
|
27951
|
-
const mismatched = Object.hasOwn(SHAPE_MISMATCHED_GETATT_ATTRIBUTES, resourceType) ? SHAPE_MISMATCHED_GETATT_ATTRIBUTES[resourceType] : void 0;
|
|
27952
|
-
if (!mismatched || mismatched.length === 0) return certified;
|
|
27953
|
-
const cached = deployAttributeNamesCache.get(resourceType);
|
|
27954
|
-
if (cached) return cached;
|
|
27955
|
-
const names = /* @__PURE__ */ new Set([...certified, ...mismatched]);
|
|
27956
|
-
deployAttributeNamesCache.set(resourceType, names);
|
|
27957
|
-
return names;
|
|
27958
|
-
}
|
|
27959
|
-
function getTopLevelReadOnlyProperties(resourceType) {
|
|
27960
|
-
if (hasNoRegistrySchema(resourceType)) return Promise.resolve(void 0);
|
|
27961
|
-
const cached = readOnlyPropertiesCache.get(resourceType);
|
|
27962
|
-
if (cached) return cached;
|
|
27963
|
-
const entry = fetchTopLevelReadOnlyProperties(resourceType).catch((error) => {
|
|
27964
|
-
if (!isDefinitiveRefusal(error)) readOnlyPropertiesCache.delete(resourceType);
|
|
27965
|
-
const message = describeAwsFailure(error).detail;
|
|
27966
|
-
getLogger().child("ReadOnlyProperties").debug(`Failed to resolve read-only properties for ${displaySafe(resourceType, { asciiOnly: true })} via cloudformation:DescribeType (${message}).`);
|
|
27967
|
-
});
|
|
27968
|
-
readOnlyPropertiesCache.set(resourceType, entry);
|
|
27969
|
-
return entry;
|
|
27970
|
-
}
|
|
27971
|
-
async function fetchTopLevelReadOnlyProperties(resourceType) {
|
|
27972
|
-
const logger = getLogger().child("ReadOnlyProperties");
|
|
27973
|
-
const response = await describeTypeWithThrottleRetry(resourceType);
|
|
27974
|
-
const result = /* @__PURE__ */ new Set();
|
|
27975
|
-
if (response.Schema) {
|
|
27976
|
-
const readOnly = JSON.parse(response.Schema).readOnlyProperties;
|
|
27977
|
-
if (Array.isArray(readOnly)) for (const path of readOnly) {
|
|
27978
|
-
if (typeof path !== "string") continue;
|
|
27979
|
-
const match = /^\/properties\/([^/]+)/.exec(path);
|
|
27980
|
-
if (match?.[1]) result.add(unescapeJsonPointerSegment(match[1]));
|
|
28489
|
+
if (!isStandalone(op)) continue;
|
|
28490
|
+
const mine = keysOf.get(op);
|
|
28491
|
+
if (mine === void 0) continue;
|
|
28492
|
+
const at = order.indexOf(op);
|
|
28493
|
+
let last = -1;
|
|
28494
|
+
for (let j = at + 1; j < order.length; j++) {
|
|
28495
|
+
const other = order[j];
|
|
28496
|
+
const theirs = keysOf.get(other);
|
|
28497
|
+
if (dependsOn(op, other) || dependsOn(other, op)) break;
|
|
28498
|
+
if (theirs === void 0 || isStandalone(other)) continue;
|
|
28499
|
+
if (collide(mine, theirs)) last = j;
|
|
27981
28500
|
}
|
|
28501
|
+
if (last < 0) continue;
|
|
28502
|
+
order.splice(at, 1);
|
|
28503
|
+
order.splice(last, 0, op);
|
|
27982
28504
|
}
|
|
27983
|
-
|
|
27984
|
-
return result;
|
|
27985
|
-
}
|
|
27986
|
-
function unescapeJsonPointerSegment(segment) {
|
|
27987
|
-
return segment.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
27988
|
-
}
|
|
27989
|
-
|
|
27990
|
-
// src/provisioning/cc-import-identifier.ts
|
|
27991
|
-
const primaryIdentifierCache = /* @__PURE__ */ new Map();
|
|
27992
|
-
function getPrimaryIdentifierFields(resourceType) {
|
|
27993
|
-
if (hasNoRegistrySchema(resourceType)) return Promise.resolve(void 0);
|
|
27994
|
-
const cached = primaryIdentifierCache.get(resourceType);
|
|
27995
|
-
if (cached) return cached;
|
|
27996
|
-
const entry = fetchPrimaryIdentifierFields(resourceType).catch((error) => {
|
|
27997
|
-
primaryIdentifierCache.delete(resourceType);
|
|
27998
|
-
getLogger().child("CcImportIdentifier").debug(`Failed to resolve the primary identifier for ${displaySafe(resourceType, { asciiOnly: true })} via cloudformation:DescribeType (${describeAwsFailure(error).detail}); the import id is passed to Cloud Control unchanged.`);
|
|
27999
|
-
});
|
|
28000
|
-
primaryIdentifierCache.set(resourceType, entry);
|
|
28001
|
-
return entry;
|
|
28002
|
-
}
|
|
28003
|
-
async function fetchPrimaryIdentifierFields(resourceType) {
|
|
28004
|
-
const response = await describeTypeWithThrottleRetry(resourceType);
|
|
28005
|
-
if (!response.Schema) return void 0;
|
|
28006
|
-
const primary = JSON.parse(response.Schema).primaryIdentifier;
|
|
28007
|
-
if (!Array.isArray(primary) || primary.length === 0) return void 0;
|
|
28008
|
-
const fields = [];
|
|
28009
|
-
for (const pointer of primary) {
|
|
28010
|
-
if (typeof pointer !== "string") return void 0;
|
|
28011
|
-
const match = /^\/properties\/([^/]+)$/.exec(pointer);
|
|
28012
|
-
if (!match?.[1]) return void 0;
|
|
28013
|
-
fields.push(match[1].replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
28014
|
-
}
|
|
28015
|
-
return fields;
|
|
28505
|
+
return order;
|
|
28016
28506
|
}
|
|
28017
|
-
function
|
|
28018
|
-
|
|
28019
|
-
if (fields === void 0 || fields.length < 2) return physicalId;
|
|
28020
|
-
if (physicalId.split("|").length === fields.length) return physicalId;
|
|
28021
|
-
if (physicalId.trimStart().startsWith("{")) return physicalId;
|
|
28022
|
-
const safeType = displayIdent(resourceType);
|
|
28023
|
-
const safeLogicalId = displayIdent(logicalId);
|
|
28024
|
-
const showId = (value) => displayIdent(value, { maxCodePoints: SECRET_REF_MAX_CODE_POINTS });
|
|
28025
|
-
const safeId = showId(physicalId);
|
|
28026
|
-
const shape = fields.map((field) => `<${field}>`).join("|");
|
|
28027
|
-
const remedy = `Pass the Cloud Control identifier instead: --resource '${quotedRemedyLogicalId(logicalId)}=${shape}'.`;
|
|
28028
|
-
const refusalHead = `${refusalTypeShown(resourceType)} ` + (isPasteableIdent(logicalId) ? logicalId : "(logical id not shown: it is not a plain identifier)");
|
|
28029
|
-
const refusalId = isQuotableImportValue(physicalId) ? safeId : "the supplied id (not shown: it is not a plain identifier)";
|
|
28030
|
-
if (physicalId.includes("|")) throw new Error(`${refusalHead}: ${refusalId} has ${physicalId.split("|").length} '${"|"}'-separated segments, but Cloud Control identifies this type by ${fields.length} (${shape}). ${remedy}`);
|
|
28031
|
-
const values = fields.map((field) => {
|
|
28032
|
-
const value = Object.hasOwn(properties, field) ? properties[field] : void 0;
|
|
28033
|
-
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
28034
|
-
return typeof value === "string" && value.trim() !== "" ? value : void 0;
|
|
28035
|
-
});
|
|
28036
|
-
const missing = fields.filter((_, index) => values[index] === void 0);
|
|
28037
|
-
if (missing.length > 1) throw new Error(`${refusalHead}: Cloud Control identifies this type by ${shape}, and the template supplies no literal value for ${missing.join(" or ")}, so ${refusalId} cannot be placed. ${remedy}`);
|
|
28038
|
-
if (missing.length === 1 && values.includes(physicalId)) throw new Error(`${refusalHead}: ${refusalId} equals a value the template already gives another field of the identifier ${shape}, so it cannot be told which field it is. ${remedy}`);
|
|
28039
|
-
const completed = values.map((value) => value ?? physicalId);
|
|
28040
|
-
const refusal = compositeIdSeparatorRefusal(resourceType, logicalId, fields.map((name, index) => ({
|
|
28041
|
-
name,
|
|
28042
|
-
value: completed[index]
|
|
28043
|
-
})));
|
|
28044
|
-
if (refusal !== void 0) throw new Error(refusal);
|
|
28045
|
-
const identifier = completed.join("|");
|
|
28046
|
-
if (missing.length === 0 && !values.includes(physicalId)) getLogger().child("CcImportIdentifier").debug(`${safeType} ${safeLogicalId}: the template supplies every field of the Cloud Control identifier ${shape}, so ${showId(identifier)} is looked up and the supplied id ${safeId} is not used.`);
|
|
28047
|
-
getLogger().child("CcImportIdentifier").debug(`${safeType} ${safeLogicalId}: completed ${safeId} to the Cloud Control identifier ${showId(identifier)} (${shape}) from the template.`);
|
|
28048
|
-
return identifier;
|
|
28507
|
+
function ownPoliciesChange(change) {
|
|
28508
|
+
return (change?.propertyChanges ?? []).some((c) => c.path === "Policies" && c.inPlacePropagated !== true && c.replacementPropagated !== true);
|
|
28049
28509
|
}
|
|
28050
28510
|
|
|
28051
28511
|
// src/provisioning/cc-protection-properties.ts
|
|
@@ -28174,205 +28634,7 @@ function slowCcOperationTimeoutMs(resourceType, operation) {
|
|
|
28174
28634
|
}
|
|
28175
28635
|
}
|
|
28176
28636
|
|
|
28177
|
-
// src/provisioning/cloud-control-
|
|
28178
|
-
const JSON_STRING_PROPERTIES = { "AWS::Events::Rule": /* @__PURE__ */ new Set(["EventPattern"]) };
|
|
28179
|
-
function stringifyJsonProperties(resourceType, properties) {
|
|
28180
|
-
const jsonProps = JSON_STRING_PROPERTIES[resourceType];
|
|
28181
|
-
if (!jsonProps) return properties;
|
|
28182
|
-
const result = { ...properties };
|
|
28183
|
-
for (const key of jsonProps) if (key in result && typeof result[key] === "object" && result[key] !== null) result[key] = JSON.stringify(result[key]);
|
|
28184
|
-
return result;
|
|
28185
|
-
}
|
|
28186
|
-
function stripNullValues(obj) {
|
|
28187
|
-
if (obj === null || obj === void 0) return;
|
|
28188
|
-
if (Array.isArray(obj)) return obj.map(stripNullValues).filter((v) => v !== void 0);
|
|
28189
|
-
if (typeof obj === "object") {
|
|
28190
|
-
const result = {};
|
|
28191
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
28192
|
-
const stripped = stripNullValues(value);
|
|
28193
|
-
if (stripped !== void 0) result[key] = stripped;
|
|
28194
|
-
}
|
|
28195
|
-
return result;
|
|
28196
|
-
}
|
|
28197
|
-
return obj;
|
|
28198
|
-
}
|
|
28199
|
-
function s3RedirectRegion(error) {
|
|
28200
|
-
const e = error;
|
|
28201
|
-
if (e?.name !== "PermanentRedirect" && e?.$metadata?.httpStatusCode !== 301) return void 0;
|
|
28202
|
-
for (const candidate of [
|
|
28203
|
-
e?.$response?.headers?.["x-amz-bucket-region"],
|
|
28204
|
-
e?.Region,
|
|
28205
|
-
e?.BucketRegion
|
|
28206
|
-
]) {
|
|
28207
|
-
if (typeof candidate !== "string") continue;
|
|
28208
|
-
const region = canonicalizeRegion(candidate.trim());
|
|
28209
|
-
if (region !== void 0 && /^[a-z]{2}(-[a-z]+)+-\d+$/.test(region)) return region;
|
|
28210
|
-
}
|
|
28211
|
-
}
|
|
28212
|
-
var CloudControlOperationFailedError = class CloudControlOperationFailedError extends ProvisioningError {
|
|
28213
|
-
ccErrorCode;
|
|
28214
|
-
ccOperation;
|
|
28215
|
-
constructor(message, resourceType, logicalId, physicalId, ccErrorCode, ccOperation) {
|
|
28216
|
-
super(message, resourceType, logicalId, physicalId);
|
|
28217
|
-
this.ccErrorCode = ccErrorCode;
|
|
28218
|
-
this.ccOperation = ccOperation;
|
|
28219
|
-
this.name = "CloudControlOperationFailedError";
|
|
28220
|
-
Object.setPrototypeOf(this, CloudControlOperationFailedError.prototype);
|
|
28221
|
-
}
|
|
28222
|
-
};
|
|
28223
|
-
var CloudControlWaitAbandonedError = class CloudControlWaitAbandonedError extends ProvisioningError {
|
|
28224
|
-
requestToken;
|
|
28225
|
-
ccOperation;
|
|
28226
|
-
lastSeenIdentifier;
|
|
28227
|
-
constructor(message, resourceType, logicalId, requestToken, ccOperation, lastSeenIdentifier, cause) {
|
|
28228
|
-
super(message, resourceType, logicalId, lastSeenIdentifier, cause);
|
|
28229
|
-
this.requestToken = requestToken;
|
|
28230
|
-
this.ccOperation = ccOperation;
|
|
28231
|
-
this.lastSeenIdentifier = lastSeenIdentifier;
|
|
28232
|
-
this.name = "CloudControlWaitAbandonedError";
|
|
28233
|
-
Object.setPrototypeOf(this, CloudControlWaitAbandonedError.prototype);
|
|
28234
|
-
markWaitAbandoned(this, {
|
|
28235
|
-
requestToken,
|
|
28236
|
-
operation: ccOperation
|
|
28237
|
-
});
|
|
28238
|
-
}
|
|
28239
|
-
};
|
|
28240
|
-
function failedOutcome$1(errorCode, identifier) {
|
|
28241
|
-
return identifier && errorCode !== "AlreadyExists" && errorCode !== "ResourceConflict" ? {
|
|
28242
|
-
status: "failed",
|
|
28243
|
-
remnant: identifier
|
|
28244
|
-
} : { status: "failed" };
|
|
28245
|
-
}
|
|
28246
|
-
const POLL_TRANSPORT_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
28247
|
-
"ECONNRESET",
|
|
28248
|
-
"ECONNREFUSED",
|
|
28249
|
-
"ECONNABORTED",
|
|
28250
|
-
"EPIPE",
|
|
28251
|
-
"ETIMEDOUT",
|
|
28252
|
-
"ENOTFOUND",
|
|
28253
|
-
"EAI_AGAIN",
|
|
28254
|
-
"EHOSTUNREACH",
|
|
28255
|
-
"ENETUNREACH",
|
|
28256
|
-
"ENETDOWN",
|
|
28257
|
-
"EPROTO",
|
|
28258
|
-
"EADDRNOTAVAIL"
|
|
28259
|
-
]);
|
|
28260
|
-
const POLL_TRANSPORT_ERROR_NAMES = /* @__PURE__ */ new Set([
|
|
28261
|
-
"TimeoutError",
|
|
28262
|
-
"RequestTimeout",
|
|
28263
|
-
"RequestTimeoutException",
|
|
28264
|
-
"RequestAbortedException"
|
|
28265
|
-
]);
|
|
28266
|
-
const POLL_TRANSPORT_CODE_IN_MESSAGE = new RegExp(`\\b(?:${[...POLL_TRANSPORT_ERROR_CODES].join("|")})\\b`);
|
|
28267
|
-
const POLL_CAUSE_CHAIN_DEPTH = 5;
|
|
28268
|
-
function describePollFailure(error) {
|
|
28269
|
-
if (error === void 0) return {
|
|
28270
|
-
display: "",
|
|
28271
|
-
detail: "",
|
|
28272
|
-
marker: false
|
|
28273
|
-
};
|
|
28274
|
-
if (!(error instanceof Error)) {
|
|
28275
|
-
const other = describeAwsFailure(error);
|
|
28276
|
-
return {
|
|
28277
|
-
display: other.summary,
|
|
28278
|
-
detail: other.detail,
|
|
28279
|
-
marker: false
|
|
28280
|
-
};
|
|
28281
|
-
}
|
|
28282
|
-
const described = describeAwsFailure(error);
|
|
28283
|
-
if (!described.redacted) return {
|
|
28284
|
-
display: error.message,
|
|
28285
|
-
detail: "",
|
|
28286
|
-
marker: false
|
|
28287
|
-
};
|
|
28288
|
-
if (error.message === "") return {
|
|
28289
|
-
display: "",
|
|
28290
|
-
detail: "",
|
|
28291
|
-
marker: false
|
|
28292
|
-
};
|
|
28293
|
-
return {
|
|
28294
|
-
display: described.summary,
|
|
28295
|
-
detail: described.detail,
|
|
28296
|
-
marker: true
|
|
28297
|
-
};
|
|
28298
|
-
}
|
|
28299
|
-
function isTransientPollFailure(error) {
|
|
28300
|
-
if (isThrottlingError(error) || isTransientServerError(error)) return true;
|
|
28301
|
-
let current = error;
|
|
28302
|
-
for (let depth = 0; depth < POLL_CAUSE_CHAIN_DEPTH && current != null; depth++) {
|
|
28303
|
-
const code = current.code;
|
|
28304
|
-
if (typeof code === "string" && POLL_TRANSPORT_ERROR_CODES.has(code)) return true;
|
|
28305
|
-
const name = current.name;
|
|
28306
|
-
if (typeof name === "string" && POLL_TRANSPORT_ERROR_NAMES.has(name)) return true;
|
|
28307
|
-
const message = current.message;
|
|
28308
|
-
if (typeof message === "string" && POLL_TRANSPORT_CODE_IN_MESSAGE.test(message)) return true;
|
|
28309
|
-
current = current.cause;
|
|
28310
|
-
}
|
|
28311
|
-
return false;
|
|
28312
|
-
}
|
|
28313
|
-
function isNotFoundMessage(message) {
|
|
28314
|
-
return /not\s*found|does\s*not\s*exist|no\s*such|non\s*existent|\bno\b[^.;:]{0,80}\bfound\b/i.test(message);
|
|
28315
|
-
}
|
|
28316
|
-
function isCcDeleteGoneError(error, volumePath) {
|
|
28317
|
-
if (isWaitAbandonedError(error)) return false;
|
|
28318
|
-
if (error instanceof CloudControlOperationFailedError) return error.ccOperation === "DELETE" && error.ccErrorCode === "NotFound";
|
|
28319
|
-
const name = error?.name;
|
|
28320
|
-
if (volumePath) return name === "InvalidVolume.NotFound";
|
|
28321
|
-
return name === "ResourceNotFoundException";
|
|
28322
|
-
}
|
|
28323
|
-
function markNotGoneOnNeedle(error) {
|
|
28324
|
-
if (!(error instanceof Error)) return error;
|
|
28325
|
-
const message = error.message;
|
|
28326
|
-
if (!isWaitAbandonedError(error) && (message.includes("does not exist") || message.includes("not found") || message.includes("NotFound") || message.includes("No policy found") || message.includes("NoSuchEntity"))) return markNotGone(error);
|
|
28327
|
-
return error;
|
|
28328
|
-
}
|
|
28329
|
-
const CALLER_PRINCIPAL_MASK = "<caller-principal>";
|
|
28330
|
-
const ACCOUNT_ID_MASK = "<account-id>";
|
|
28331
|
-
const NAME = String.raw`[\w+=,.@-]*[\w+=@-]`;
|
|
28332
|
-
const PARTITION = String.raw`aws[a-z-]*`;
|
|
28333
|
-
const STS_SESSION_PRINCIPAL = new RegExp(String.raw`\barn:${PARTITION}:sts::\d{12}:(?:assumed-role/${NAME}/${NAME}|federated-user/${NAME})`, "g");
|
|
28334
|
-
const IAM_PRINCIPAL = String.raw`arn:${PARTITION}:iam::\d{12}:(?:(?:user|role)/(?:[!-.0-~]+/)*${NAME}|root)`;
|
|
28335
|
-
const IAM_DENIED_AFTER_USER = new RegExp(String.raw`(\bUser:\s*)${IAM_PRINCIPAL}`, "g");
|
|
28336
|
-
const IAM_DENIED_AFTER_LEAD_IN = new RegExp(String.raw`(\b(?:Not authorized|Access denied|AccessDenied):\s*)${IAM_PRINCIPAL}`, "gi");
|
|
28337
|
-
const IAM_DENIED_BEFORE_VERB = new RegExp(String.raw`\b${IAM_PRINCIPAL}(?=\s+is not authorized)`, "g");
|
|
28338
|
-
const PRINCIPAL_UNIQUE_ID = new RegExp(String.raw`\b(?:AROA|AIDA|ASIA|AKIA)[A-Z0-9]{16,17}\b(?::${NAME})?`, "g");
|
|
28339
|
-
const ACCOUNT_IN_ARN = new RegExp(String.raw`(\barn:${PARTITION}:[^:\s]*:[^:\s]*:)\d{12}(?=:)`, "g");
|
|
28340
|
-
const ACCOUNT_AFTER_WORD = /((?:\b(?:account(?:[ _-]?(?:id|number))?s?|principal(?:[ _-]?id)?|owner(?:[ _-]?id)?)\b|"AWS")[\s:='"#([]*)\d{12}(?![0-9A-Za-z])/gi;
|
|
28341
|
-
const ACCOUNT_LIST_NEXT = new RegExp(String.raw`(${ACCOUNT_ID_MASK}['"]\s*,\s*['"])\d{12}(?![0-9A-Za-z])`, "g");
|
|
28342
|
-
const ACCOUNT_IN_NAME = /(?<![0-9A-Za-z])(?<![0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-)(?:(?<=[A-Za-z][-_]|\/)\d{12}(?![0-9A-Za-z])|\d{12}(?=[-_.:][A-Za-z]|\/))/g;
|
|
28343
|
-
function maskCallerIdentity(text) {
|
|
28344
|
-
let masked = text.replace(STS_SESSION_PRINCIPAL, CALLER_PRINCIPAL_MASK).replace(IAM_DENIED_AFTER_USER, `$1${CALLER_PRINCIPAL_MASK}`).replace(IAM_DENIED_AFTER_LEAD_IN, `$1${CALLER_PRINCIPAL_MASK}`).replace(IAM_DENIED_BEFORE_VERB, CALLER_PRINCIPAL_MASK).replace(PRINCIPAL_UNIQUE_ID, CALLER_PRINCIPAL_MASK).replace(ACCOUNT_IN_ARN, `$1${ACCOUNT_ID_MASK}`).replace(ACCOUNT_AFTER_WORD, `$1${ACCOUNT_ID_MASK}`).replace(ACCOUNT_IN_NAME, ACCOUNT_ID_MASK);
|
|
28345
|
-
let previous;
|
|
28346
|
-
do {
|
|
28347
|
-
previous = masked;
|
|
28348
|
-
masked = masked.replace(ACCOUNT_LIST_NEXT, `$1${ACCOUNT_ID_MASK}`);
|
|
28349
|
-
} while (masked !== previous);
|
|
28350
|
-
return masked;
|
|
28351
|
-
}
|
|
28352
|
-
function handlerAuthFailureHint(statusMessage) {
|
|
28353
|
-
const match = /\(Service:\s*([A-Za-z0-9._-]+)[,;]\s*Status Code:\s*403[,;)]/i.exec(statusMessage);
|
|
28354
|
-
if (!match) return "";
|
|
28355
|
-
const service = match[1] ?? "";
|
|
28356
|
-
if (/cloudcontrol/i.test(service)) return "";
|
|
28357
|
-
return ` [hint: this 403 was returned by ${service} to the AWS-managed resource handler running the operation, not to cdkd directly — these credentials already passed Cloud Control's own auth to start it. If the equivalent ${service} API call succeeds with the same credentials, the resource handler itself is failing (an upstream AWS issue worth retrying later), not your local credential setup.]`;
|
|
28358
|
-
}
|
|
28359
|
-
const MAX_LOGGED_MODEL_KEYS = 12;
|
|
28360
|
-
function describeJsonKeys(document) {
|
|
28361
|
-
const keys = [];
|
|
28362
|
-
const seen = /* @__PURE__ */ new Set();
|
|
28363
|
-
const pattern = /"([^"\\]{1,64})"\s*:/g;
|
|
28364
|
-
let match;
|
|
28365
|
-
while ((match = pattern.exec(document)) !== null) {
|
|
28366
|
-
const key = match[1];
|
|
28367
|
-
if (seen.has(key)) continue;
|
|
28368
|
-
seen.add(key);
|
|
28369
|
-
keys.push(key);
|
|
28370
|
-
if (keys.length >= MAX_LOGGED_MODEL_KEYS) break;
|
|
28371
|
-
}
|
|
28372
|
-
if (keys.length === 0) return "no readable key names";
|
|
28373
|
-
const suffix = pattern.lastIndex < document.length && keys.length >= MAX_LOGGED_MODEL_KEYS ? ", ..." : "";
|
|
28374
|
-
return `keys: ${keys.join(", ")}${suffix}`;
|
|
28375
|
-
}
|
|
28637
|
+
// src/provisioning/cloud-control/delete-guards.ts
|
|
28376
28638
|
const CC_DELETE_IDENTITY_CHECKED_TYPES = /* @__PURE__ */ new Set(["AWS::S3::Bucket"]);
|
|
28377
28639
|
function requiresCcDeleteIdentityCheck(resourceType) {
|
|
28378
28640
|
return CC_DELETE_IDENTITY_CHECKED_TYPES.has(resourceType);
|
|
@@ -28412,1114 +28674,1188 @@ function isCcConflict(error) {
|
|
|
28412
28674
|
if (error instanceof CloudControlOperationFailedError) return error.ccErrorCode === "ResourceConflict";
|
|
28413
28675
|
return typeof error === "object" && error !== null && error.name === "ResourceConflictException";
|
|
28414
28676
|
}
|
|
28415
|
-
|
|
28416
|
-
|
|
28417
|
-
|
|
28418
|
-
|
|
28419
|
-
|
|
28420
|
-
|
|
28421
|
-
|
|
28422
|
-
|
|
28423
|
-
|
|
28424
|
-
|
|
28425
|
-
|
|
28426
|
-
|
|
28427
|
-
|
|
28428
|
-
|
|
28429
|
-
|
|
28430
|
-
|
|
28431
|
-
|
|
28432
|
-
|
|
28433
|
-
|
|
28434
|
-
}
|
|
28435
|
-
|
|
28436
|
-
|
|
28437
|
-
|
|
28438
|
-
return
|
|
28439
|
-
}
|
|
28440
|
-
async createInIdLogScope(logicalId, resourceType, properties, idLog, mask) {
|
|
28441
|
-
this.logger.debug(`Creating resource ${logicalId} (${resourceType})`);
|
|
28442
|
-
const attributeNamesLookup = getTopLevelDeployAttributeNames(resourceType);
|
|
28443
|
-
try {
|
|
28444
|
-
const ccProperties = stringifyJsonProperties(resourceType, stripNullValues(properties));
|
|
28445
|
-
const desiredState = JSON.stringify(ccProperties);
|
|
28446
|
-
this.logger.debug(`DesiredState for ${logicalId}: keys=${JSON.stringify(Object.keys(ccProperties))}`);
|
|
28447
|
-
const createResponse = await this.cloudControlClient.send(new CreateResourceCommand({
|
|
28448
|
-
TypeName: resourceType,
|
|
28449
|
-
DesiredState: desiredState
|
|
28450
|
-
}));
|
|
28451
|
-
if (!createResponse.ProgressEvent?.RequestToken) throw new ProvisioningError(`Failed to create resource ${logicalId}: No request token received`, resourceType, logicalId);
|
|
28452
|
-
this.logger.debug(`Create request submitted for ${logicalId}, token: ${createResponse.ProgressEvent.RequestToken}`);
|
|
28453
|
-
const progressEvent = await this.waitForOperation(createResponse.ProgressEvent.RequestToken, logicalId, "CREATE", resourceType);
|
|
28454
|
-
if (!progressEvent.Identifier) throw new ProvisioningError(`Failed to create resource ${logicalId}: No physical ID returned`, resourceType, logicalId);
|
|
28455
|
-
idLog.addId(progressEvent.Identifier);
|
|
28456
|
-
this.logger.debug(`Created resource ${logicalId}, physical ID: ${progressEvent.Identifier}`);
|
|
28457
|
-
const result = { physicalId: progressEvent.Identifier };
|
|
28458
|
-
if (progressEvent.ResourceModel) result.attributes = this.parseResourceModel(progressEvent.ResourceModel);
|
|
28459
|
-
result.attributes = await this.mergeSparseModelReadback(resourceType, progressEvent.Identifier, result.attributes || {});
|
|
28460
|
-
const modelKeys = Object.keys(result.attributes);
|
|
28461
|
-
result.attributes = await this.enrichResourceAttributes(resourceType, progressEvent.Identifier, result.attributes);
|
|
28462
|
-
result.attributes = await this.maskDeployedNonAttributeKeys(result.attributes, modelKeys, resourceType, progressEvent.Identifier, attributeNamesLookup, properties, mask);
|
|
28463
|
-
return result;
|
|
28464
|
-
} catch (error) {
|
|
28465
|
-
idLog.addId(identifierCarriedBy(error));
|
|
28466
|
-
await this.cleanupFailedCreateRemnant(error, resourceType, logicalId, mask);
|
|
28467
|
-
this.handleError(error, "CREATE", resourceType, logicalId);
|
|
28468
|
-
}
|
|
28469
|
-
}
|
|
28470
|
-
async cleanupFailedCreateRemnant(error, resourceType, logicalId, mask) {
|
|
28471
|
-
if (!(error instanceof CloudControlOperationFailedError)) return;
|
|
28472
|
-
if (error.ccOperation !== "CREATE" || !error.physicalId) return;
|
|
28473
|
-
if (error.ccErrorCode === "AlreadyExists") return;
|
|
28474
|
-
if (error.ccErrorCode === "ResourceConflict") return;
|
|
28475
|
-
this.logger.info(`CREATE of ${logicalId} failed after materializing ${error.physicalId}; deleting the remnant so a retry can re-create it`);
|
|
28476
|
-
try {
|
|
28477
|
-
const cleanupResult = await this.delete(logicalId, error.physicalId, resourceType, void 0, { maskSecrets: mask });
|
|
28478
|
-
if (cleanupResult?.outcome === "skipped") {
|
|
28479
|
-
this.logger.warn(`Skipped deleting the remnant ${error.physicalId} left by the failed CREATE of ${logicalId} (a retry may fail with AlreadyExists until it is removed manually): ${displaySafe(cleanupResult.reason)}`);
|
|
28480
|
-
return;
|
|
28481
|
-
}
|
|
28482
|
-
this.logger.debug(`Removed failed-create remnant ${error.physicalId} for ${logicalId}`);
|
|
28483
|
-
} catch (cleanupError) {
|
|
28484
|
-
const message = describeAwsFailure(cleanupError).detail;
|
|
28485
|
-
if (isWaitAbandonedError(cleanupError)) {
|
|
28486
|
-
const line = `Could not confirm whether the remnant ${error.physicalId} left by the failed CREATE of ${logicalId} was removed (a retry may fail with AlreadyExists until it is removed manually): ${displaySafe(message)}`;
|
|
28487
|
-
const log = this.logger;
|
|
28488
|
-
if (log instanceof IdScrubLog) log.warnKeepingResume(line, abandonedRequestTokens(cleanupError));
|
|
28489
|
-
else log.warn(line);
|
|
28490
|
-
return;
|
|
28491
|
-
}
|
|
28492
|
-
if (isNotFoundMessage(message)) {
|
|
28493
|
-
this.logger.info(`The remnant ${error.physicalId} left by the failed CREATE of ${logicalId} was already gone (not found); nothing to clean up`);
|
|
28494
|
-
return;
|
|
28495
|
-
}
|
|
28496
|
-
this.logger.warn(`Failed to delete the remnant ${error.physicalId} left by the failed CREATE of ${logicalId} (a retry may fail with AlreadyExists until it is removed manually): ${displaySafe(message)}`);
|
|
28497
|
-
}
|
|
28498
|
-
}
|
|
28499
|
-
async update(logicalId, physicalId, resourceType, properties, previousProperties, context) {
|
|
28500
|
-
const mask = maskerOrIdentity(context?.maskSecrets);
|
|
28501
|
-
const idLog = new IdScrubLog(this.logger, mask, holdsSecretDerivedLeaf(properties, mask) || holdsSecretDerivedLeaf(previousProperties, mask));
|
|
28502
|
-
idLog.addId(physicalId);
|
|
28503
|
-
return inIdLogScope(idLog, () => this.updateInIdLogScope(logicalId, physicalId, resourceType, properties, previousProperties, context, idLog));
|
|
28677
|
+
|
|
28678
|
+
// src/provisioning/cloud-control/delete.ts
|
|
28679
|
+
async function deleteImpl$1(logicalId, physicalId, resourceType, properties, context) {
|
|
28680
|
+
const mask = maskerOrIdentity(context?.maskSecrets);
|
|
28681
|
+
const idLog = new IdScrubLog(this.logger, mask, holdsSecretDerivedLeaf(properties, mask));
|
|
28682
|
+
idLog.addId(physicalId);
|
|
28683
|
+
const result = await inIdLogScope(idLog, () => this.deleteInIdLogScope(logicalId, physicalId, resourceType, properties, context));
|
|
28684
|
+
if (!idLog.withheld || !result) return result;
|
|
28685
|
+
return {
|
|
28686
|
+
...result,
|
|
28687
|
+
...result.outcome === "skipped" && { reason: idLog.scrub(result.reason) },
|
|
28688
|
+
...Array.isArray(result.indeterminateGuards) && { indeterminateGuards: result.indeterminateGuards.map((guard) => ({
|
|
28689
|
+
...guard,
|
|
28690
|
+
reason: idLog.scrub(guard.reason)
|
|
28691
|
+
})) }
|
|
28692
|
+
};
|
|
28693
|
+
}
|
|
28694
|
+
async function deleteInIdLogScope(logicalId, physicalId, resourceType, properties, context) {
|
|
28695
|
+
this.logger.debug(`Deleting resource ${logicalId} (${resourceType}), physical ID: ${physicalId}`);
|
|
28696
|
+
if (context?.finalSnapshotIdentifier !== void 0) throw new ProvisioningError(`${logicalId} (${resourceType}) requires a final snapshot (DeletionPolicy: Snapshot), but the Cloud Control API delete route has no final-snapshot parameter. Re-run with --skip-final-snapshot after snapshotting manually, or retain the resource.`, resourceType, logicalId, physicalId);
|
|
28697
|
+
await this.assertRecordedRegionAgainstClient("pre-delete", context?.expectedRegion, resourceType, logicalId, physicalId);
|
|
28698
|
+
if (standaloneInlinePolicyHandedOff(resourceType, properties, context?.inlinePolicyClaimed, physicalId)) {
|
|
28699
|
+
this.logger.info(` ${logicalId}: not deleting its inline policy, which another resource of this deploy now holds under the same name`);
|
|
28700
|
+
return;
|
|
28504
28701
|
}
|
|
28505
|
-
|
|
28506
|
-
|
|
28507
|
-
|
|
28508
|
-
|
|
28509
|
-
|
|
28510
|
-
|
|
28511
|
-
|
|
28512
|
-
|
|
28513
|
-
|
|
28514
|
-
|
|
28515
|
-
|
|
28516
|
-
|
|
28517
|
-
|
|
28518
|
-
|
|
28519
|
-
|
|
28520
|
-
|
|
28521
|
-
|
|
28522
|
-
|
|
28523
|
-
|
|
28524
|
-
|
|
28525
|
-
|
|
28526
|
-
|
|
28527
|
-
|
|
28528
|
-
|
|
28529
|
-
|
|
28530
|
-
|
|
28531
|
-
|
|
28532
|
-
|
|
28533
|
-
|
|
28534
|
-
|
|
28535
|
-
|
|
28536
|
-
|
|
28537
|
-
|
|
28538
|
-
|
|
28539
|
-
if (keptOnPreviousSide.has(propertyName) && isDeepStrictEqual(cleanPreviousProperties[propertyName], cleanProperties[propertyName])) continue;
|
|
28540
|
-
delete previousWithoutWriteOnly[propertyName];
|
|
28541
|
-
}
|
|
28542
|
-
patch = this.patchGenerator.generatePatch(previousWithoutWriteOnly, cleanProperties);
|
|
28543
|
-
if (patch.length === 0) {
|
|
28544
|
-
this.logger.debug(`Only removed write-only properties detected for ${logicalId}, skipping update`);
|
|
28545
|
-
return {
|
|
28546
|
-
physicalId,
|
|
28547
|
-
wasReplaced: false,
|
|
28548
|
-
sentNothing: true
|
|
28549
|
-
};
|
|
28550
|
-
}
|
|
28551
|
-
}
|
|
28552
|
-
patch = withGuardDutyDetectorReadBackOps(resourceType, patch, cleanProperties, context?.desiredFromAwsReadback === true ? { previous: cleanPreviousProperties } : void 0);
|
|
28553
|
-
let reimported = false;
|
|
28554
|
-
if (isApiGatewayV2Import(resourceType, cleanProperties)) {
|
|
28555
|
-
const split = splitApiGatewayV2ImportPatch(patch, cleanPreviousProperties, cleanProperties);
|
|
28556
|
-
patch = split.rest;
|
|
28557
|
-
if (split.reimport !== void 0) {
|
|
28558
|
-
await this.reimportApiGatewayV2(logicalId, physicalId, resourceType, split.reimport);
|
|
28559
|
-
reimported = true;
|
|
28560
|
-
} else if (patch.length === 0) {
|
|
28561
|
-
this.logger.debug(`No property changes detected for ${logicalId}, skipping update`);
|
|
28562
|
-
return {
|
|
28563
|
-
physicalId,
|
|
28564
|
-
wasReplaced: false,
|
|
28565
|
-
sentNothing: true
|
|
28566
|
-
};
|
|
28567
|
-
}
|
|
28568
|
-
}
|
|
28569
|
-
this.logger.debug(`Generated ${patch.length} patch operations for ${logicalId}: ${JSON.stringify(patch.map((op) => {
|
|
28570
|
-
const anyOp = op;
|
|
28571
|
-
return {
|
|
28572
|
-
op: anyOp.op,
|
|
28573
|
-
path: anyOp.path
|
|
28574
|
-
};
|
|
28575
|
-
}))}`);
|
|
28576
|
-
let progressEvent;
|
|
28577
|
-
if (!(reimported && patch.length === 0)) {
|
|
28578
|
-
const updateResponse = await this.cloudControlClient.send(new UpdateResourceCommand({
|
|
28579
|
-
TypeName: resourceType,
|
|
28580
|
-
Identifier: physicalId,
|
|
28581
|
-
PatchDocument: JSON.stringify(patch)
|
|
28582
|
-
}));
|
|
28583
|
-
if (!updateResponse.ProgressEvent?.RequestToken) throw new ProvisioningError(`Failed to update resource ${logicalId}: No request token received`, resourceType, logicalId, physicalId);
|
|
28584
|
-
this.logger.debug(`Update request submitted for ${logicalId}, token: ${updateResponse.ProgressEvent.RequestToken}`);
|
|
28585
|
-
progressEvent = await this.waitForOperation(updateResponse.ProgressEvent.RequestToken, logicalId, "UPDATE", resourceType);
|
|
28586
|
-
}
|
|
28587
|
-
this.logger.debug(`Updated resource ${logicalId}`);
|
|
28588
|
-
const result = {
|
|
28589
|
-
physicalId,
|
|
28590
|
-
wasReplaced: false
|
|
28702
|
+
const indeterminateGuard = await this.confirmDeleteTargetIdentity(logicalId, resourceType, physicalId, context);
|
|
28703
|
+
if (context?.removeProtection === true && resourceType === "AWS::AutoScaling::AutoScalingGroup") {
|
|
28704
|
+
this.logger.debug(`Delegating protected AutoScalingGroup ${logicalId} delete to the SDK ASGProvider (Cloud Control cannot force-delete a protected ASG)`);
|
|
28705
|
+
const { ASGProvider } = await import("./asg-provider-DgbCqJIh.js");
|
|
28706
|
+
const delegateRegion = ambientRegion();
|
|
28707
|
+
let asgProvider = this.asgDeleteDelegates.get(delegateRegion);
|
|
28708
|
+
if (asgProvider === void 0) {
|
|
28709
|
+
asgProvider = new ASGProvider();
|
|
28710
|
+
this.asgDeleteDelegates.set(delegateRegion, asgProvider);
|
|
28711
|
+
}
|
|
28712
|
+
return withIndeterminateGuard(await asgProvider.delete(logicalId, physicalId, resourceType, properties, context), indeterminateGuard);
|
|
28713
|
+
}
|
|
28714
|
+
if ((context?.deletionPolicy === "Delete" || context?.skipFinalSnapshot === true) && SDK_DELETE_FAMILIES.has(resourceType)) {
|
|
28715
|
+
if (deletesThroughSdkProvider(resourceType, properties)) {
|
|
28716
|
+
const delegate = await this.sdkDeleteDelegateInCcRegion(resourceType, logicalId, physicalId);
|
|
28717
|
+
return withIndeterminateGuard(await delegate.delete(logicalId, physicalId, resourceType, properties, context), indeterminateGuard);
|
|
28718
|
+
}
|
|
28719
|
+
this.logger.warn(safeMsg`${logicalId} (${resourceType}) records a GlobalClusterIdentifier cdkd cannot detach it from, so it is deleted through ` + `Cloud Control, which handles the global-cluster membership. Its handler ` + safeMsg`can take a manual final snapshot of ${physicalId}, which cdkd does not record; ` + `delete it yourself if you do not want it.`);
|
|
28720
|
+
}
|
|
28721
|
+
const isProtectedEc2Instance = context?.removeProtection === true && resourceType === "AWS::EC2::Instance";
|
|
28722
|
+
const protectionEntry = context?.removeProtection === true ? ccProtectionProperty(resourceType) : void 0;
|
|
28723
|
+
if (!isProtectedEc2Instance && protectionEntry === void 0) return this.deleteThroughCloudControl(logicalId, physicalId, resourceType, context, indeterminateGuard, void 0, void 0);
|
|
28724
|
+
const ec2Client = isProtectedEc2Instance ? await this.ec2ClientInCcRegion(resourceType, logicalId, physicalId) : void 0;
|
|
28725
|
+
const commandRegion = context?.expectedRegion?.trim() || await this.ccClientRegion();
|
|
28726
|
+
const site = ec2Client !== void 0 ? ec2InstanceProtectionSite(physicalId, commandRegion) : ccProtectionSite(resourceType, physicalId, protectionEntry, commandRegion);
|
|
28727
|
+
let result = void 0;
|
|
28728
|
+
await deleteWithProtectionCompensation({
|
|
28729
|
+
registry: this.protectionFlips,
|
|
28730
|
+
key: protectionFlipKey(resourceType, physicalId, context?.expectedRegion),
|
|
28731
|
+
run: async (flip) => {
|
|
28732
|
+
let protectedEc2;
|
|
28733
|
+
if (ec2Client !== void 0) protectedEc2 = {
|
|
28734
|
+
client: ec2Client,
|
|
28735
|
+
observedOn: await observeThenDisableInstanceApiTermination(ec2Client, physicalId, flip, this.logger)
|
|
28591
28736
|
};
|
|
28592
|
-
|
|
28593
|
-
result.attributes = await this.mergeSparseModelReadback(resourceType, physicalId, result.attributes || {}, idLog);
|
|
28594
|
-
const modelKeys = Object.keys(result.attributes);
|
|
28595
|
-
result.attributes = await this.enrichResourceAttributes(resourceType, physicalId, result.attributes, idLog);
|
|
28596
|
-
result.attributes = await this.maskDeployedNonAttributeKeys(result.attributes, modelKeys, resourceType, physicalId, attributeNamesLookup, properties, maskerOrIdentity(context?.maskSecrets), idLog);
|
|
28597
|
-
return result;
|
|
28598
|
-
} catch (error) {
|
|
28599
|
-
this.handleError(error, "UPDATE", resourceType, logicalId, physicalId);
|
|
28600
|
-
}
|
|
28601
|
-
}
|
|
28602
|
-
async reimportApiGatewayV2(logicalId, physicalId, resourceType, reimport) {
|
|
28603
|
-
if (reimport.fromS3 && reimport.body !== void 0) throw markNonRetryable(new ProvisioningError(`Cannot update ${logicalId} (${resourceType}): it declares both Body and BodyS3Location. Declare the OpenAPI definition in one of them.`, resourceType, logicalId, physicalId));
|
|
28604
|
-
let region;
|
|
28605
|
-
try {
|
|
28606
|
-
region = canonicalizeRegion((await this.cloudControlClient.config.region())?.trim());
|
|
28607
|
-
} catch {
|
|
28608
|
-
region = void 0;
|
|
28609
|
-
}
|
|
28610
|
-
if (region === void 0 || region === "") throw markNonRetryable(new ProvisioningError(`Refusing to update ${logicalId} (${resourceType}, ${physicalId}): cdkd could not resolve the Cloud Control client's region, so it cannot show ReimportApi would reach this API. Re-run with --region set to the stack's region.`, resourceType, logicalId, physicalId));
|
|
28611
|
-
const body = reimport.fromS3 ? await this.readApiGatewayV2DefinitionObject(logicalId, physicalId, resourceType, reimport.bodyS3Location) : reimport.body;
|
|
28612
|
-
const { ApiGatewayV2Client, ReimportApiCommand } = await import("@aws-sdk/client-apigatewayv2");
|
|
28613
|
-
const client = new ApiGatewayV2Client({
|
|
28614
|
-
...ambientClientDefaults(),
|
|
28615
|
-
region
|
|
28616
|
-
});
|
|
28617
|
-
try {
|
|
28618
|
-
await client.send(new ReimportApiCommand({
|
|
28619
|
-
ApiId: physicalId,
|
|
28620
|
-
Body: body,
|
|
28621
|
-
...reimport.basePath !== void 0 ? { Basepath: reimport.basePath } : {},
|
|
28622
|
-
...reimport.failOnWarnings !== void 0 ? { FailOnWarnings: reimport.failOnWarnings } : {}
|
|
28623
|
-
}));
|
|
28624
|
-
} finally {
|
|
28625
|
-
client.destroy();
|
|
28626
|
-
}
|
|
28627
|
-
this.logger.debug(`Reimported the OpenAPI definition of ${logicalId}`);
|
|
28628
|
-
}
|
|
28629
|
-
async readApiGatewayV2DefinitionObject(logicalId, physicalId, resourceType, location) {
|
|
28630
|
-
const object = apiGatewayV2DefinitionObject(location);
|
|
28631
|
-
if (object === void 0) throw markNonRetryable(new ProvisioningError(`Cannot update ${logicalId} (${resourceType}): its BodyS3Location is not an object with string Bucket and Key (and optional string Version / Etag), so cdkd cannot read the OpenAPI definition to reimport.`, resourceType, logicalId, physicalId));
|
|
28632
|
-
const shown = `s3://${displaySafe(object.bucket)}/${displaySafe(object.key)}`;
|
|
28633
|
-
const shared = getAwsClients().s3;
|
|
28634
|
-
const owned = [];
|
|
28635
|
-
const read = async (s3) => {
|
|
28636
|
-
const text = await (await s3.send(new GetObjectCommand({
|
|
28637
|
-
Bucket: object.bucket,
|
|
28638
|
-
Key: object.key,
|
|
28639
|
-
...object.version !== void 0 ? { VersionId: object.version } : {}
|
|
28640
|
-
}))).Body?.transformToString();
|
|
28641
|
-
if (text === void 0) throw markNonRetryable(new ProvisioningError(`Cannot update ${logicalId} (${resourceType}): S3 returned no body for its OpenAPI definition ${shown}.`, resourceType, logicalId, physicalId));
|
|
28642
|
-
return text;
|
|
28643
|
-
};
|
|
28644
|
-
let redirected = false;
|
|
28645
|
-
try {
|
|
28646
|
-
const rebuilt = await rebuildClientForBucketRegion(shared, object.bucket, {
|
|
28647
|
-
reuseClientCredentials: true,
|
|
28648
|
-
tolerateNonStandardClient: true
|
|
28649
|
-
});
|
|
28650
|
-
if (rebuilt) owned.push(rebuilt);
|
|
28651
|
-
const first = rebuilt ?? shared;
|
|
28737
|
+
else await this.observeThenDisableCcProtection(logicalId, physicalId, resourceType, protectionEntry, flip, context?.maskSecrets);
|
|
28652
28738
|
try {
|
|
28653
|
-
|
|
28739
|
+
result = await this.deleteThroughCloudControl(logicalId, physicalId, resourceType, context, indeterminateGuard, flip, protectedEc2);
|
|
28654
28740
|
} catch (error) {
|
|
28655
|
-
|
|
28656
|
-
|
|
28657
|
-
redirected = true;
|
|
28658
|
-
const regional = new S3Client({
|
|
28659
|
-
...awsClientDefaults(),
|
|
28660
|
-
...s3ClientDefaults(),
|
|
28661
|
-
region: redirectRegion,
|
|
28662
|
-
credentials: first.config?.credentials,
|
|
28663
|
-
logger: quietS3Logger()
|
|
28664
|
-
});
|
|
28665
|
-
owned.push(regional);
|
|
28666
|
-
return await read(regional);
|
|
28741
|
+
this.warnGuardLeftOff(flip, error, site, logicalId, physicalId);
|
|
28742
|
+
throw error;
|
|
28667
28743
|
}
|
|
28668
|
-
}
|
|
28669
|
-
|
|
28670
|
-
|
|
28671
|
-
|
|
28672
|
-
|
|
28673
|
-
|
|
28674
|
-
|
|
28675
|
-
if (errorClass === "AccessDenied" || status === 403) next = ` The deploy identity needs s3:GetObject on it` + (object.version !== void 0 ? " (and s3:GetObjectVersion for the pinned Version)" : "") + ", and kms:Decrypt on its key if the object is SSE-KMS encrypted.";
|
|
28676
|
-
else if (errorClass === "NoSuchKey" || errorClass === "NoSuchBucket" || errorClass === "NoSuchVersion") next = " Upload the definition there, or point BodyS3Location at the right object.";
|
|
28677
|
-
else if (errorClass === "PermanentRedirect" || status === 301) next = (redirected ? ` S3 redirected the read twice.` : ` S3 named no region to redirect to.`) + " cdkd could not reach the bucket's region: grant the deploy identity s3:GetBucketLocation on the bucket, or keep the definition in a bucket of this region.";
|
|
28678
|
-
const wrapped = new ProvisioningError(`Cannot update ${logicalId} (${resourceType}): reading its OpenAPI definition ${shown} failed with ${errorClass}.${next ?? ""} ${VERBOSE_POINTER}`, resourceType, logicalId, physicalId, error instanceof Error ? error : void 0);
|
|
28679
|
-
throw next !== void 0 ? markNonRetryable(wrapped) : markRedactedCause(wrapped);
|
|
28680
|
-
} finally {
|
|
28681
|
-
for (const client of owned) client.destroy();
|
|
28682
|
-
}
|
|
28683
|
-
}
|
|
28684
|
-
async delete(logicalId, physicalId, resourceType, properties, context) {
|
|
28685
|
-
const mask = maskerOrIdentity(context?.maskSecrets);
|
|
28686
|
-
const idLog = new IdScrubLog(this.logger, mask, holdsSecretDerivedLeaf(properties, mask));
|
|
28687
|
-
idLog.addId(physicalId);
|
|
28688
|
-
const result = await inIdLogScope(idLog, () => this.deleteInIdLogScope(logicalId, physicalId, resourceType, properties, context));
|
|
28689
|
-
if (!idLog.withheld || !result) return result;
|
|
28690
|
-
return {
|
|
28691
|
-
...result,
|
|
28692
|
-
...result.outcome === "skipped" && { reason: idLog.scrub(result.reason) },
|
|
28693
|
-
...Array.isArray(result.indeterminateGuards) && { indeterminateGuards: result.indeterminateGuards.map((guard) => ({
|
|
28694
|
-
...guard,
|
|
28695
|
-
reason: idLog.scrub(guard.reason)
|
|
28696
|
-
})) }
|
|
28697
|
-
};
|
|
28698
|
-
}
|
|
28699
|
-
async deleteInIdLogScope(logicalId, physicalId, resourceType, properties, context) {
|
|
28700
|
-
this.logger.debug(`Deleting resource ${logicalId} (${resourceType}), physical ID: ${physicalId}`);
|
|
28701
|
-
if (context?.finalSnapshotIdentifier !== void 0) throw new ProvisioningError(`${logicalId} (${resourceType}) requires a final snapshot (DeletionPolicy: Snapshot), but the Cloud Control API delete route has no final-snapshot parameter. Re-run with --skip-final-snapshot after snapshotting manually, or retain the resource.`, resourceType, logicalId, physicalId);
|
|
28702
|
-
await this.assertRecordedRegionAgainstClient("pre-delete", context?.expectedRegion, resourceType, logicalId, physicalId);
|
|
28703
|
-
if (standaloneInlinePolicyHandedOff(resourceType, properties, context?.inlinePolicyClaimed, physicalId)) {
|
|
28704
|
-
this.logger.info(` ${logicalId}: not deleting its inline policy, which another resource of this deploy now holds under the same name`);
|
|
28705
|
-
return;
|
|
28744
|
+
},
|
|
28745
|
+
compensation: {
|
|
28746
|
+
logicalId,
|
|
28747
|
+
physicalId,
|
|
28748
|
+
logger: this.logger,
|
|
28749
|
+
site,
|
|
28750
|
+
reEnable: () => ec2Client !== void 0 ? reEnableInstanceApiTermination(ec2Client, physicalId) : this.reEnableCcProtection(logicalId, physicalId, resourceType, protectionEntry)
|
|
28706
28751
|
}
|
|
28707
|
-
|
|
28708
|
-
|
|
28709
|
-
|
|
28710
|
-
|
|
28711
|
-
|
|
28712
|
-
|
|
28713
|
-
|
|
28714
|
-
|
|
28715
|
-
|
|
28716
|
-
|
|
28717
|
-
return withIndeterminateGuard(await asgProvider.delete(logicalId, physicalId, resourceType, properties, context), indeterminateGuard);
|
|
28718
|
-
}
|
|
28719
|
-
if ((context?.deletionPolicy === "Delete" || context?.skipFinalSnapshot === true) && SDK_DELETE_FAMILIES.has(resourceType)) {
|
|
28720
|
-
if (deletesThroughSdkProvider(resourceType, properties)) {
|
|
28721
|
-
const delegate = await this.sdkDeleteDelegateInCcRegion(resourceType, logicalId, physicalId);
|
|
28722
|
-
return withIndeterminateGuard(await delegate.delete(logicalId, physicalId, resourceType, properties, context), indeterminateGuard);
|
|
28723
|
-
}
|
|
28724
|
-
this.logger.warn(safeMsg`${logicalId} (${resourceType}) records a GlobalClusterIdentifier cdkd cannot detach it from, so it is deleted through ` + `Cloud Control, which handles the global-cluster membership. Its handler ` + safeMsg`can take a manual final snapshot of ${physicalId}, which cdkd does not record; ` + `delete it yourself if you do not want it.`);
|
|
28725
|
-
}
|
|
28726
|
-
const isProtectedEc2Instance = context?.removeProtection === true && resourceType === "AWS::EC2::Instance";
|
|
28727
|
-
const protectionEntry = context?.removeProtection === true ? ccProtectionProperty(resourceType) : void 0;
|
|
28728
|
-
if (!isProtectedEc2Instance && protectionEntry === void 0) return this.deleteThroughCloudControl(logicalId, physicalId, resourceType, context, indeterminateGuard, void 0, void 0);
|
|
28729
|
-
const ec2Client = isProtectedEc2Instance ? await this.ec2ClientInCcRegion(resourceType, logicalId, physicalId) : void 0;
|
|
28730
|
-
const commandRegion = context?.expectedRegion?.trim() || await this.ccClientRegion();
|
|
28731
|
-
const site = ec2Client !== void 0 ? ec2InstanceProtectionSite(physicalId, commandRegion) : ccProtectionSite(resourceType, physicalId, protectionEntry, commandRegion);
|
|
28732
|
-
let result = void 0;
|
|
28733
|
-
await deleteWithProtectionCompensation({
|
|
28734
|
-
registry: this.protectionFlips,
|
|
28735
|
-
key: protectionFlipKey(resourceType, physicalId, context?.expectedRegion),
|
|
28736
|
-
run: async (flip) => {
|
|
28737
|
-
let protectedEc2;
|
|
28738
|
-
if (ec2Client !== void 0) protectedEc2 = {
|
|
28739
|
-
client: ec2Client,
|
|
28740
|
-
observedOn: await observeThenDisableInstanceApiTermination(ec2Client, physicalId, flip, this.logger)
|
|
28741
|
-
};
|
|
28742
|
-
else await this.observeThenDisableCcProtection(logicalId, physicalId, resourceType, protectionEntry, flip, context?.maskSecrets);
|
|
28743
|
-
try {
|
|
28744
|
-
result = await this.deleteThroughCloudControl(logicalId, physicalId, resourceType, context, indeterminateGuard, flip, protectedEc2);
|
|
28745
|
-
} catch (error) {
|
|
28746
|
-
this.warnGuardLeftOff(flip, error, site, logicalId, physicalId);
|
|
28747
|
-
throw error;
|
|
28748
|
-
}
|
|
28749
|
-
},
|
|
28750
|
-
compensation: {
|
|
28751
|
-
logicalId,
|
|
28752
|
-
physicalId,
|
|
28752
|
+
});
|
|
28753
|
+
return result;
|
|
28754
|
+
}
|
|
28755
|
+
async function deleteThroughCloudControl(logicalId, physicalId, resourceType, context, indeterminateGuard, flip, protectedEc2) {
|
|
28756
|
+
const volumeEc2Client = resourceType === "AWS::EC2::Volume" ? await this.ec2ClientInCcRegion(resourceType, logicalId, physicalId) : void 0;
|
|
28757
|
+
const maxAttempts = protectedEc2 !== void 0 ? 5 : 1;
|
|
28758
|
+
let priorMayBeDeleting = false;
|
|
28759
|
+
for (let attempt = 1;; attempt++) try {
|
|
28760
|
+
if (volumeEc2Client !== void 0) {
|
|
28761
|
+
await deleteEc2VolumeDirect(volumeEc2Client, physicalId, logicalId, {
|
|
28753
28762
|
logger: this.logger,
|
|
28754
|
-
|
|
28755
|
-
|
|
28756
|
-
|
|
28757
|
-
|
|
28758
|
-
|
|
28759
|
-
}
|
|
28760
|
-
async deleteThroughCloudControl(logicalId, physicalId, resourceType, context, indeterminateGuard, flip, protectedEc2) {
|
|
28761
|
-
const volumeEc2Client = resourceType === "AWS::EC2::Volume" ? await this.ec2ClientInCcRegion(resourceType, logicalId, physicalId) : void 0;
|
|
28762
|
-
const maxAttempts = protectedEc2 !== void 0 ? 5 : 1;
|
|
28763
|
-
let priorMayBeDeleting = false;
|
|
28764
|
-
for (let attempt = 1;; attempt++) try {
|
|
28765
|
-
if (volumeEc2Client !== void 0) {
|
|
28766
|
-
await deleteEc2VolumeDirect(volumeEc2Client, physicalId, logicalId, {
|
|
28767
|
-
logger: this.logger,
|
|
28768
|
-
sleep: (ms) => this.sleep(ms),
|
|
28769
|
-
maxWaitMs: Math.max(this.MAX_WAIT_TIME_MS, slowCcOperationTimeoutMs(resourceType, "DELETE")),
|
|
28770
|
-
transientGraceMs: this.POLL_TRANSIENT_GRACE_MS,
|
|
28771
|
-
isTransientFailure: isTransientPollFailure
|
|
28772
|
-
});
|
|
28773
|
-
this.logger.debug(`Deleted resource ${logicalId}`);
|
|
28774
|
-
return withIndeterminateGuard(void 0, indeterminateGuard);
|
|
28775
|
-
}
|
|
28776
|
-
if (flip !== void 0) priorMayBeDeleting ||= flip.deleteAccepted;
|
|
28777
|
-
const deleteResponse = await this.cloudControlClient.send(new DeleteResourceCommand({
|
|
28778
|
-
TypeName: resourceType,
|
|
28779
|
-
Identifier: physicalId
|
|
28780
|
-
}));
|
|
28781
|
-
if (!deleteResponse.ProgressEvent?.RequestToken) throw new ProvisioningError(`Failed to delete resource ${logicalId}: No request token received`, resourceType, logicalId, physicalId);
|
|
28782
|
-
if (flip !== void 0) flip.deleteAccepted = false;
|
|
28783
|
-
this.logger.debug(`Delete request submitted for ${logicalId}, token: ${deleteResponse.ProgressEvent.RequestToken}`);
|
|
28784
|
-
await this.waitForOperation(deleteResponse.ProgressEvent.RequestToken, logicalId, "DELETE", resourceType);
|
|
28763
|
+
sleep: (ms) => this.sleep(ms),
|
|
28764
|
+
maxWaitMs: Math.max(this.MAX_WAIT_TIME_MS, slowCcOperationTimeoutMs(resourceType, "DELETE")),
|
|
28765
|
+
transientGraceMs: this.POLL_TRANSIENT_GRACE_MS,
|
|
28766
|
+
isTransientFailure: isTransientPollFailure
|
|
28767
|
+
});
|
|
28785
28768
|
this.logger.debug(`Deleted resource ${logicalId}`);
|
|
28786
28769
|
return withIndeterminateGuard(void 0, indeterminateGuard);
|
|
28787
|
-
} catch (error) {
|
|
28788
|
-
if (flip !== void 0 && ccDeleteMayHaveActed(error, protectedEc2 !== void 0, priorMayBeDeleting)) flip.deleteAccepted = true;
|
|
28789
|
-
const err = error;
|
|
28790
|
-
if (isCcDeleteGoneError(error, volumeEc2Client !== void 0)) {
|
|
28791
|
-
await this.assertRecordedRegionAgainstClient("not-found", context?.expectedRegion, resourceType, logicalId, physicalId);
|
|
28792
|
-
this.logger.debug(`Resource ${logicalId} already deleted (not found), treating as success`);
|
|
28793
|
-
return withIndeterminateGuard(void 0, indeterminateGuard);
|
|
28794
|
-
}
|
|
28795
|
-
if (protectedEc2 !== void 0 && isTerminationProtectionPropagationError(err.message ?? "") && attempt < maxAttempts) {
|
|
28796
|
-
this.logger.debug(`Cloud Control delete of ${logicalId} raced the DisableApiTermination flip-off (attempt ${attempt}/${maxAttempts}); re-flipping and retrying`);
|
|
28797
|
-
await reDisableInstanceApiTermination(protectedEc2.client, physicalId, flip, protectedEc2.observedOn, this.logger);
|
|
28798
|
-
await this.sleep(3e3 * attempt);
|
|
28799
|
-
continue;
|
|
28800
|
-
}
|
|
28801
|
-
try {
|
|
28802
|
-
this.handleError(error, "DELETE", resourceType, logicalId, physicalId);
|
|
28803
|
-
} catch (wrapped) {
|
|
28804
|
-
throw markNotGoneOnNeedle(wrapped);
|
|
28805
|
-
}
|
|
28806
28770
|
}
|
|
28807
|
-
|
|
28808
|
-
|
|
28809
|
-
|
|
28810
|
-
|
|
28811
|
-
|
|
28812
|
-
}
|
|
28813
|
-
|
|
28814
|
-
}
|
|
28815
|
-
|
|
28816
|
-
|
|
28817
|
-
|
|
28818
|
-
|
|
28819
|
-
|
|
28820
|
-
|
|
28821
|
-
|
|
28822
|
-
|
|
28823
|
-
|
|
28824
|
-
|
|
28825
|
-
|
|
28826
|
-
|
|
28827
|
-
|
|
28828
|
-
|
|
28829
|
-
|
|
28830
|
-
|
|
28831
|
-
} catch {
|
|
28832
|
-
return;
|
|
28833
|
-
}
|
|
28834
|
-
};
|
|
28835
|
-
const ccRegion = await resolve(this.cloudControlClient);
|
|
28836
|
-
const ec2Region = await resolve(ec2);
|
|
28837
|
-
if (ccRegion === void 0 || ccRegion === "" || ccRegion !== ec2Region) throw markNonRetryable(new ProvisioningError(`Refusing to delete ${logicalId} (${resourceType}, ${physicalId}): the EC2 client targets region '${ec2Region ?? "unknown"}' but the Cloud Control client targets '${ccRegion ?? "unknown"}', so cdkd cannot show ` + (resourceType === "AWS::EC2::Instance" ? `its DisableApiTermination flip would reach this instance. ` : `the delete would reach this volume. `) + `Re-run with --region set to the stack's region.`, resourceType, logicalId, physicalId));
|
|
28838
|
-
return ec2;
|
|
28839
|
-
}
|
|
28840
|
-
async assertRecordedRegionAgainstClient(phase, expectedRegion, resourceType, logicalId, physicalId) {
|
|
28841
|
-
const recordedRegion = canonicalizeRegion(expectedRegion?.trim());
|
|
28842
|
-
if (recordedRegion === void 0 || recordedRegion === "") return;
|
|
28843
|
-
let clientRegion;
|
|
28844
|
-
try {
|
|
28845
|
-
clientRegion = canonicalizeRegion((await this.cloudControlClient.config.region())?.trim());
|
|
28846
|
-
} catch (error) {
|
|
28847
|
-
this.logger.debug(`Could not resolve the Cloud Control client region before the ${phase} region check for ${logicalId} (${resourceType}): ${displaySafe(describeAwsFailure(error).detail)}`);
|
|
28848
|
-
clientRegion = void 0;
|
|
28771
|
+
if (flip !== void 0) priorMayBeDeleting ||= flip.deleteAccepted;
|
|
28772
|
+
const deleteResponse = await this.cloudControlClient.send(new DeleteResourceCommand({
|
|
28773
|
+
TypeName: resourceType,
|
|
28774
|
+
Identifier: physicalId
|
|
28775
|
+
}));
|
|
28776
|
+
if (!deleteResponse.ProgressEvent?.RequestToken) throw new ProvisioningError(`Failed to delete resource ${logicalId}: No request token received`, resourceType, logicalId, physicalId);
|
|
28777
|
+
if (flip !== void 0) flip.deleteAccepted = false;
|
|
28778
|
+
this.logger.debug(`Delete request submitted for ${logicalId}, token: ${deleteResponse.ProgressEvent.RequestToken}`);
|
|
28779
|
+
await this.waitForOperation(deleteResponse.ProgressEvent.RequestToken, logicalId, "DELETE", resourceType);
|
|
28780
|
+
this.logger.debug(`Deleted resource ${logicalId}`);
|
|
28781
|
+
return withIndeterminateGuard(void 0, indeterminateGuard);
|
|
28782
|
+
} catch (error) {
|
|
28783
|
+
if (flip !== void 0 && ccDeleteMayHaveActed(error, protectedEc2 !== void 0, priorMayBeDeleting)) flip.deleteAccepted = true;
|
|
28784
|
+
const err = error;
|
|
28785
|
+
if (isCcDeleteGoneError(error, volumeEc2Client !== void 0)) {
|
|
28786
|
+
await this.assertRecordedRegionAgainstClient("not-found", context?.expectedRegion, resourceType, logicalId, physicalId);
|
|
28787
|
+
this.logger.debug(`Resource ${logicalId} already deleted (not found), treating as success`);
|
|
28788
|
+
return withIndeterminateGuard(void 0, indeterminateGuard);
|
|
28789
|
+
}
|
|
28790
|
+
if (protectedEc2 !== void 0 && isTerminationProtectionPropagationError(err.message ?? "") && attempt < maxAttempts) {
|
|
28791
|
+
this.logger.debug(`Cloud Control delete of ${logicalId} raced the DisableApiTermination flip-off (attempt ${attempt}/${maxAttempts}); re-flipping and retrying`);
|
|
28792
|
+
await reDisableInstanceApiTermination(protectedEc2.client, physicalId, flip, protectedEc2.observedOn, this.logger);
|
|
28793
|
+
await this.sleep(3e3 * attempt);
|
|
28794
|
+
continue;
|
|
28849
28795
|
}
|
|
28850
28796
|
try {
|
|
28851
|
-
|
|
28852
|
-
} catch (
|
|
28853
|
-
throw
|
|
28797
|
+
this.handleError(error, "DELETE", resourceType, logicalId, physicalId);
|
|
28798
|
+
} catch (wrapped) {
|
|
28799
|
+
throw markNotGoneOnNeedle(wrapped);
|
|
28854
28800
|
}
|
|
28855
28801
|
}
|
|
28856
|
-
|
|
28857
|
-
|
|
28858
|
-
|
|
28859
|
-
|
|
28860
|
-
|
|
28861
|
-
|
|
28862
|
-
|
|
28863
|
-
|
|
28864
|
-
|
|
28865
|
-
|
|
28866
|
-
|
|
28867
|
-
|
|
28868
|
-
|
|
28869
|
-
|
|
28870
|
-
|
|
28871
|
-
|
|
28872
|
-
|
|
28873
|
-
|
|
28874
|
-
|
|
28875
|
-
|
|
28876
|
-
|
|
28877
|
-
|
|
28878
|
-
const wantRegion = canonicalizeRegion(expectedRegion);
|
|
28879
|
-
let actualRegion;
|
|
28802
|
+
}
|
|
28803
|
+
async function sdkDeleteDelegateInCcRegion(resourceType, logicalId, physicalId) {
|
|
28804
|
+
let ccRegion;
|
|
28805
|
+
try {
|
|
28806
|
+
ccRegion = canonicalizeRegion((await this.cloudControlClient.config.region())?.trim());
|
|
28807
|
+
} catch {
|
|
28808
|
+
ccRegion = void 0;
|
|
28809
|
+
}
|
|
28810
|
+
if (ccRegion === void 0 || ccRegion === "") throw markNonRetryable(new ProvisioningError(`Refusing to delete ${logicalId} (${resourceType}, ${physicalId}): cdkd could not resolve the Cloud Control client's region, so it cannot show the SDK delete would reach this resource. Re-run with --region set to the stack's region.`, resourceType, logicalId, physicalId));
|
|
28811
|
+
const family = SDK_DELETE_FAMILIES.get(resourceType);
|
|
28812
|
+
const cached = this.sdkDeleteDelegates.get(family);
|
|
28813
|
+
if (cached !== void 0 && cached.region === ccRegion) return cached.provider;
|
|
28814
|
+
const provider = family === "rds" ? new (await (import("./rds-provider-CpoJl-ki.js"))).RDSProvider({ region: ccRegion }) : new (await (import("./neptune-provider-B1o5gxWk.js"))).NeptuneProvider({ region: ccRegion });
|
|
28815
|
+
this.sdkDeleteDelegates.set(family, {
|
|
28816
|
+
region: ccRegion,
|
|
28817
|
+
provider
|
|
28818
|
+
});
|
|
28819
|
+
return provider;
|
|
28820
|
+
}
|
|
28821
|
+
async function ec2ClientInCcRegion(resourceType, logicalId, physicalId) {
|
|
28822
|
+
const ec2 = getAwsClients().ec2;
|
|
28823
|
+
const resolve = async (client) => {
|
|
28880
28824
|
try {
|
|
28881
|
-
|
|
28882
|
-
} catch
|
|
28883
|
-
|
|
28884
|
-
this.logger.debug(`Bucket ${physicalId} (${logicalId}) is already absent; leaving the delete to the Cloud Control idempotency path`);
|
|
28885
|
-
return;
|
|
28886
|
-
}
|
|
28887
|
-
const failure = describeAwsFailure(error);
|
|
28888
|
-
this.logger.debug(`s3:GetBucketLocation on ${physicalId} (${logicalId}) failed: ${failure.detail}`);
|
|
28889
|
-
const summarySentence = failure.summary.replace(/[.\s]+$/, "");
|
|
28890
|
-
this.logger.warn(`Could not confirm which region S3 bucket ${physicalId} (${logicalId}) lives in before deleting it: ${summarySentence}. S3 bucket names are globally unique, so cdkd cannot rule out that this name denotes a bucket in another region. Grant s3:GetBucketLocation on the bucket to enable the check. Proceeding with the delete.`);
|
|
28891
|
-
return {
|
|
28892
|
-
guard: CC_DELETE_REGION_IDENTITY_GUARD,
|
|
28893
|
-
reason: `s3:GetBucketLocation on ${physicalId} could not be answered: ${failure.summary}`
|
|
28894
|
-
};
|
|
28825
|
+
return canonicalizeRegion((await client.config.region())?.trim());
|
|
28826
|
+
} catch {
|
|
28827
|
+
return;
|
|
28895
28828
|
}
|
|
28896
|
-
|
|
28897
|
-
|
|
28829
|
+
};
|
|
28830
|
+
const ccRegion = await resolve(this.cloudControlClient);
|
|
28831
|
+
const ec2Region = await resolve(ec2);
|
|
28832
|
+
if (ccRegion === void 0 || ccRegion === "" || ccRegion !== ec2Region) throw markNonRetryable(new ProvisioningError(`Refusing to delete ${logicalId} (${resourceType}, ${physicalId}): the EC2 client targets region '${ec2Region ?? "unknown"}' but the Cloud Control client targets '${ccRegion ?? "unknown"}', so cdkd cannot show ` + (resourceType === "AWS::EC2::Instance" ? `its DisableApiTermination flip would reach this instance. ` : `the delete would reach this volume. `) + `Re-run with --region set to the stack's region.`, resourceType, logicalId, physicalId));
|
|
28833
|
+
return ec2;
|
|
28834
|
+
}
|
|
28835
|
+
|
|
28836
|
+
// src/provisioning/cloud-control/delete-identity.ts
|
|
28837
|
+
async function assertRecordedRegionAgainstClient(phase, expectedRegion, resourceType, logicalId, physicalId) {
|
|
28838
|
+
const recordedRegion = canonicalizeRegion(expectedRegion?.trim());
|
|
28839
|
+
if (recordedRegion === void 0 || recordedRegion === "") return;
|
|
28840
|
+
let clientRegion;
|
|
28841
|
+
try {
|
|
28842
|
+
clientRegion = canonicalizeRegion((await this.cloudControlClient.config.region())?.trim());
|
|
28843
|
+
} catch (error) {
|
|
28844
|
+
this.logger.debug(`Could not resolve the Cloud Control client region before the ${phase} region check for ${logicalId} (${resourceType}): ${displaySafe(describeAwsFailure(error).detail)}`);
|
|
28845
|
+
clientRegion = void 0;
|
|
28846
|
+
}
|
|
28847
|
+
try {
|
|
28848
|
+
assertRegionMatch(clientRegion, recordedRegion, resourceType, logicalId, physicalId, phase);
|
|
28849
|
+
} catch (error) {
|
|
28850
|
+
throw markNonRetryable(error);
|
|
28851
|
+
}
|
|
28852
|
+
}
|
|
28853
|
+
async function confirmDeleteTargetIdentity(logicalId, resourceType, physicalId, context) {
|
|
28854
|
+
if (!requiresCcDeleteIdentityCheck(resourceType)) return void 0;
|
|
28855
|
+
const recordedRegion = context?.expectedRegion?.trim();
|
|
28856
|
+
let expectedRegion = recordedRegion === void 0 || recordedRegion === "" ? void 0 : recordedRegion;
|
|
28857
|
+
let clientRegionError;
|
|
28858
|
+
if (expectedRegion === void 0) try {
|
|
28859
|
+
const clientRegion = (await this.cloudControlClient.config.region())?.trim();
|
|
28860
|
+
expectedRegion = clientRegion === void 0 || clientRegion === "" ? void 0 : clientRegion;
|
|
28861
|
+
} catch (error) {
|
|
28862
|
+
const clientRegionFailure = describeAwsFailure(error);
|
|
28863
|
+
clientRegionError = clientRegionFailure.summary;
|
|
28864
|
+
this.logger.debug(`Could not resolve the Cloud Control client region while confirming ${physicalId}: ${clientRegionFailure.detail}`);
|
|
28865
|
+
expectedRegion = void 0;
|
|
28866
|
+
}
|
|
28867
|
+
if (expectedRegion === void 0) {
|
|
28868
|
+
const reason = clientRegionError === void 0 ? `neither the stack state nor the AWS client reports a region` : `the stack state records no region and the AWS client's region could not be resolved: ${clientRegionError}`;
|
|
28869
|
+
this.logger.warn(`Could not confirm that ${resourceType} ${physicalId} (${logicalId}) is the resource this destroy targets: ${reason.replace(/[.\s]+$/, "")}. Proceeding with the delete.`);
|
|
28870
|
+
return {
|
|
28871
|
+
guard: CC_DELETE_REGION_IDENTITY_GUARD,
|
|
28872
|
+
reason
|
|
28873
|
+
};
|
|
28874
|
+
}
|
|
28875
|
+
const wantRegion = canonicalizeRegion(expectedRegion);
|
|
28876
|
+
let actualRegion;
|
|
28877
|
+
try {
|
|
28878
|
+
const location = await getAwsClients().s3.send(new GetBucketLocationCommand({ Bucket: physicalId }));
|
|
28879
|
+
actualRegion = bucketLocationToRegion(location.LocationConstraint);
|
|
28880
|
+
} catch (error) {
|
|
28881
|
+
if (isNoSuchBucketError(error)) {
|
|
28882
|
+
this.logger.debug(`Bucket ${physicalId} (${logicalId}) is already absent; leaving the delete to the Cloud Control idempotency path`);
|
|
28898
28883
|
return;
|
|
28899
28884
|
}
|
|
28900
|
-
|
|
28885
|
+
const failure = describeAwsFailure(error);
|
|
28886
|
+
this.logger.debug(`s3:GetBucketLocation on ${physicalId} (${logicalId}) failed: ${failure.detail}`);
|
|
28887
|
+
const summarySentence = failure.summary.replace(/[.\s]+$/, "");
|
|
28888
|
+
this.logger.warn(`Could not confirm which region S3 bucket ${physicalId} (${logicalId}) lives in before deleting it: ${summarySentence}. S3 bucket names are globally unique, so cdkd cannot rule out that this name denotes a bucket in another region. Grant s3:GetBucketLocation on the bucket to enable the check. Proceeding with the delete.`);
|
|
28889
|
+
return {
|
|
28890
|
+
guard: CC_DELETE_REGION_IDENTITY_GUARD,
|
|
28891
|
+
reason: `s3:GetBucketLocation on ${physicalId} could not be answered: ${failure.summary}`
|
|
28892
|
+
};
|
|
28901
28893
|
}
|
|
28902
|
-
|
|
28903
|
-
|
|
28904
|
-
|
|
28905
|
-
|
|
28906
|
-
|
|
28907
|
-
|
|
28908
|
-
|
|
28909
|
-
|
|
28910
|
-
|
|
28911
|
-
|
|
28912
|
-
|
|
28913
|
-
|
|
28914
|
-
|
|
28915
|
-
|
|
28916
|
-
|
|
28917
|
-
|
|
28918
|
-
|
|
28919
|
-
|
|
28920
|
-
|
|
28921
|
-
|
|
28922
|
-
|
|
28923
|
-
}
|
|
28924
|
-
|
|
28925
|
-
|
|
28926
|
-
|
|
28927
|
-
const detail = described.detail;
|
|
28928
|
-
if (detail !== "") this.logger.debug(`Could not disable ${protectionProperty} on ${logicalId}, underlying failure: ${displaySafe(detail)}`);
|
|
28929
|
-
return isWaitAbandonedError(error) || error instanceof CloudControlOperationFailedError && error.ccOperation === "UPDATE" && isAmbiguousCcHandlerErrorCode(error.ccErrorCode);
|
|
28894
|
+
if (actualRegion === wantRegion) {
|
|
28895
|
+
this.logger.debug(`Confirmed S3 bucket ${physicalId} (${logicalId}) lives in ${wantRegion} before deleting it`);
|
|
28896
|
+
return;
|
|
28897
|
+
}
|
|
28898
|
+
throw markNonRetryable(new ProvisioningError(`Refusing to delete S3 bucket ${physicalId} for ${logicalId} (${resourceType}): the bucket carrying that name lives in ${actualRegion}, while this destroy targets ${wantRegion}. S3 bucket names are globally unique, so a physical id recorded in cdkd state can denote a bucket in a different region. S3 follows the region redirect for a body-bearing operation, so issuing this delete risks destroying the live bucket in ${actualRegion} instead, unrecoverably, rather than reporting the bucket absent. Confirm the physical id recorded in cdkd state (cdkd state show) and correct the record: --region does not change this comparison, which reads the region stored in the state file, so re-running the destroy with a different flag value will not resolve it.`, resourceType, logicalId, physicalId));
|
|
28899
|
+
}
|
|
28900
|
+
|
|
28901
|
+
// src/provisioning/cloud-control/protection.ts
|
|
28902
|
+
async function disableCcProtection(logicalId, physicalId, resourceType, entry) {
|
|
28903
|
+
const protectionProperty = entry.property;
|
|
28904
|
+
this.logger.debug(`Disabling ${protectionProperty} on ${logicalId} (${resourceType}) before delete (--remove-protection)`);
|
|
28905
|
+
try {
|
|
28906
|
+
const patch = [{
|
|
28907
|
+
op: "add",
|
|
28908
|
+
path: `/${protectionProperty}`,
|
|
28909
|
+
value: entry.offValue
|
|
28910
|
+
}];
|
|
28911
|
+
const response = await this.cloudControlClient.send(new UpdateResourceCommand({
|
|
28912
|
+
TypeName: resourceType,
|
|
28913
|
+
Identifier: physicalId,
|
|
28914
|
+
PatchDocument: JSON.stringify(patch)
|
|
28915
|
+
}));
|
|
28916
|
+
if (!response.ProgressEvent?.RequestToken) {
|
|
28917
|
+
this.logger.warn(`Could not disable ${protectionProperty} on ${logicalId}: no request token received; proceeding with delete`);
|
|
28918
|
+
return false;
|
|
28930
28919
|
}
|
|
28920
|
+
await this.waitForOperation(response.ProgressEvent.RequestToken, logicalId, "UPDATE", resourceType, this.PROTECTION_FLIP_TRANSIENT_GRACE_MS);
|
|
28921
|
+
this.logger.debug(`Disabled ${protectionProperty} on ${logicalId}`);
|
|
28922
|
+
return true;
|
|
28923
|
+
} catch (error) {
|
|
28924
|
+
const described = describePollFailure(error);
|
|
28925
|
+
const safeMessage = displaySafe(described.display);
|
|
28926
|
+
this.logger.warn(`Could not disable ${protectionProperty} on ${logicalId} (${resourceType}), proceeding with delete${safeMessage === "" ? "" : `: ${safeMessage}`}`);
|
|
28927
|
+
const detail = described.detail;
|
|
28928
|
+
if (detail !== "") this.logger.debug(`Could not disable ${protectionProperty} on ${logicalId}, underlying failure: ${displaySafe(detail)}`);
|
|
28929
|
+
return isWaitAbandonedError(error) || error instanceof CloudControlOperationFailedError && error.ccOperation === "UPDATE" && isAmbiguousCcHandlerErrorCode(error.ccErrorCode);
|
|
28931
28930
|
}
|
|
28932
|
-
|
|
28933
|
-
|
|
28934
|
-
|
|
28935
|
-
|
|
28936
|
-
|
|
28937
|
-
|
|
28938
|
-
|
|
28939
|
-
|
|
28940
|
-
|
|
28941
|
-
|
|
28942
|
-
|
|
28943
|
-
|
|
28944
|
-
|
|
28945
|
-
|
|
28946
|
-
}
|
|
28947
|
-
}
|
|
28948
|
-
}
|
|
28931
|
+
}
|
|
28932
|
+
async function observeThenDisableCcProtection(logicalId, physicalId, resourceType, entry, flip, mask) {
|
|
28933
|
+
try {
|
|
28934
|
+
await observeThenDisableProtection({
|
|
28935
|
+
flip,
|
|
28936
|
+
logger: this.logger,
|
|
28937
|
+
physicalId,
|
|
28938
|
+
mask,
|
|
28939
|
+
guardName: entry.property,
|
|
28940
|
+
observe: async () => {
|
|
28941
|
+
const model = await this.getResourceState(resourceType, physicalId);
|
|
28942
|
+
return model !== null && isDeepStrictEqual(model[entry.property], entry.onValue);
|
|
28943
|
+
},
|
|
28944
|
+
disable: async () => {
|
|
28945
|
+
if (!await this.disableCcProtection(logicalId, physicalId, resourceType, entry)) throw new Error(`the ${entry.property} flip-off did not land`);
|
|
28946
|
+
}
|
|
28947
|
+
});
|
|
28948
|
+
} catch {}
|
|
28949
|
+
}
|
|
28950
|
+
async function reEnableCcProtection(logicalId, physicalId, resourceType, entry) {
|
|
28951
|
+
const patch = [{
|
|
28952
|
+
op: "add",
|
|
28953
|
+
path: `/${entry.property}`,
|
|
28954
|
+
value: entry.onValue
|
|
28955
|
+
}];
|
|
28956
|
+
const token = (await this.cloudControlClient.send(new UpdateResourceCommand({
|
|
28957
|
+
TypeName: resourceType,
|
|
28958
|
+
Identifier: physicalId,
|
|
28959
|
+
PatchDocument: JSON.stringify(patch)
|
|
28960
|
+
}))).ProgressEvent?.RequestToken;
|
|
28961
|
+
if (!token) throw new Error(`Cloud Control returned no request token for the ${entry.property} patch`);
|
|
28962
|
+
await this.waitForOperation(token, logicalId, "UPDATE", resourceType, this.PROTECTION_FLIP_TRANSIENT_GRACE_MS);
|
|
28963
|
+
}
|
|
28964
|
+
function warnGuardLeftOff(flip, error, site, logicalId, physicalId) {
|
|
28965
|
+
try {
|
|
28966
|
+
if (!flip.flippedOffByThisRun || !flip.deleteAccepted || !isTerminalDeleteFailure(error)) return;
|
|
28967
|
+
const commands = site.commands();
|
|
28968
|
+
this.logger.warn(safeMsg`${site.subject} ${logicalId}: the delete failed after --remove-protection had ` + safeMsg`turned ${site.guardName} off, and cdkd cannot tell whether AWS had started ` + safeMsg`deleting ${physicalId}, so it did not turn the guard back on. If it still ` + safeMsg`exists, its ${site.guardName} may be off. Check with: ${commands.check} and if ` + safeMsg`it is there, restore it with: ${commands.restoreLive}. The delete failure below ` + safeMsg`is the outcome.`);
|
|
28969
|
+
} catch {}
|
|
28970
|
+
}
|
|
28971
|
+
async function ccClientRegion() {
|
|
28972
|
+
try {
|
|
28973
|
+
return canonicalizeRegion((await this.cloudControlClient.config.region())?.trim()) || void 0;
|
|
28974
|
+
} catch {
|
|
28975
|
+
return;
|
|
28949
28976
|
}
|
|
28950
|
-
|
|
28951
|
-
|
|
28952
|
-
|
|
28953
|
-
|
|
28954
|
-
value: entry.onValue
|
|
28955
|
-
}];
|
|
28956
|
-
const token = (await this.cloudControlClient.send(new UpdateResourceCommand({
|
|
28977
|
+
}
|
|
28978
|
+
async function getResourceState(resourceType, physicalId) {
|
|
28979
|
+
try {
|
|
28980
|
+
const response = await this.cloudControlClient.send(new GetResourceCommand({
|
|
28957
28981
|
TypeName: resourceType,
|
|
28958
|
-
Identifier: physicalId
|
|
28959
|
-
|
|
28960
|
-
|
|
28961
|
-
|
|
28962
|
-
|
|
28963
|
-
|
|
28964
|
-
|
|
28965
|
-
try {
|
|
28966
|
-
if (!flip.flippedOffByThisRun || !flip.deleteAccepted || !isTerminalDeleteFailure(error)) return;
|
|
28967
|
-
const commands = site.commands();
|
|
28968
|
-
this.logger.warn(safeMsg`${site.subject} ${logicalId}: the delete failed after --remove-protection had ` + safeMsg`turned ${site.guardName} off, and cdkd cannot tell whether AWS had started ` + safeMsg`deleting ${physicalId}, so it did not turn the guard back on. If it still ` + safeMsg`exists, its ${site.guardName} may be off. Check with: ${commands.check} and if ` + safeMsg`it is there, restore it with: ${commands.restoreLive}. The delete failure below ` + safeMsg`is the outcome.`);
|
|
28969
|
-
} catch {}
|
|
28982
|
+
Identifier: physicalId
|
|
28983
|
+
}));
|
|
28984
|
+
if (!response.ResourceDescription?.Properties) return null;
|
|
28985
|
+
return this.parseResourceModel(response.ResourceDescription.Properties);
|
|
28986
|
+
} catch (error) {
|
|
28987
|
+
if (error.name === "ResourceNotFoundException") return null;
|
|
28988
|
+
throw error;
|
|
28970
28989
|
}
|
|
28971
|
-
|
|
28972
|
-
|
|
28973
|
-
|
|
28974
|
-
|
|
28975
|
-
|
|
28976
|
-
|
|
28990
|
+
}
|
|
28991
|
+
|
|
28992
|
+
// src/provisioning/cloud-control/caller-identity.ts
|
|
28993
|
+
const CALLER_PRINCIPAL_MASK = "<caller-principal>";
|
|
28994
|
+
const ACCOUNT_ID_MASK = "<account-id>";
|
|
28995
|
+
const NAME = String.raw`[\w+=,.@-]*[\w+=@-]`;
|
|
28996
|
+
const PARTITION = String.raw`aws[a-z-]*`;
|
|
28997
|
+
const STS_SESSION_PRINCIPAL = new RegExp(String.raw`\barn:${PARTITION}:sts::\d{12}:(?:assumed-role/${NAME}/${NAME}|federated-user/${NAME})`, "g");
|
|
28998
|
+
const IAM_PRINCIPAL = String.raw`arn:${PARTITION}:iam::\d{12}:(?:(?:user|role)/(?:[!-.0-~]+/)*${NAME}|root)`;
|
|
28999
|
+
const IAM_DENIED_AFTER_USER = new RegExp(String.raw`(\bUser:\s*)${IAM_PRINCIPAL}`, "g");
|
|
29000
|
+
const IAM_DENIED_AFTER_LEAD_IN = new RegExp(String.raw`(\b(?:Not authorized|Access denied|AccessDenied):\s*)${IAM_PRINCIPAL}`, "gi");
|
|
29001
|
+
const IAM_DENIED_BEFORE_VERB = new RegExp(String.raw`\b${IAM_PRINCIPAL}(?=\s+is not authorized)`, "g");
|
|
29002
|
+
const PRINCIPAL_UNIQUE_ID = new RegExp(String.raw`\b(?:AROA|AIDA|ASIA|AKIA)[A-Z0-9]{16,17}\b(?::${NAME})?`, "g");
|
|
29003
|
+
const ACCOUNT_IN_ARN = new RegExp(String.raw`(\barn:${PARTITION}:[^:\s]*:[^:\s]*:)\d{12}(?=:)`, "g");
|
|
29004
|
+
const ACCOUNT_AFTER_WORD = /((?:\b(?:account(?:[ _-]?(?:id|number))?s?|principal(?:[ _-]?id)?|owner(?:[ _-]?id)?)\b|"AWS")[\s:='"#([]*)\d{12}(?![0-9A-Za-z])/gi;
|
|
29005
|
+
const ACCOUNT_LIST_NEXT = new RegExp(String.raw`(${ACCOUNT_ID_MASK}['"]\s*,\s*['"])\d{12}(?![0-9A-Za-z])`, "g");
|
|
29006
|
+
const ACCOUNT_IN_NAME = /(?<![0-9A-Za-z])(?<![0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-)(?:(?<=[A-Za-z][-_]|\/)\d{12}(?![0-9A-Za-z])|\d{12}(?=[-_.:][A-Za-z]|\/))/g;
|
|
29007
|
+
function maskCallerIdentity(text) {
|
|
29008
|
+
let masked = text.replace(STS_SESSION_PRINCIPAL, CALLER_PRINCIPAL_MASK).replace(IAM_DENIED_AFTER_USER, `$1${CALLER_PRINCIPAL_MASK}`).replace(IAM_DENIED_AFTER_LEAD_IN, `$1${CALLER_PRINCIPAL_MASK}`).replace(IAM_DENIED_BEFORE_VERB, CALLER_PRINCIPAL_MASK).replace(PRINCIPAL_UNIQUE_ID, CALLER_PRINCIPAL_MASK).replace(ACCOUNT_IN_ARN, `$1${ACCOUNT_ID_MASK}`).replace(ACCOUNT_AFTER_WORD, `$1${ACCOUNT_ID_MASK}`).replace(ACCOUNT_IN_NAME, ACCOUNT_ID_MASK);
|
|
29009
|
+
let previous;
|
|
29010
|
+
do {
|
|
29011
|
+
previous = masked;
|
|
29012
|
+
masked = masked.replace(ACCOUNT_LIST_NEXT, `$1${ACCOUNT_ID_MASK}`);
|
|
29013
|
+
} while (masked !== previous);
|
|
29014
|
+
return masked;
|
|
29015
|
+
}
|
|
29016
|
+
function handlerAuthFailureHint(statusMessage) {
|
|
29017
|
+
const match = /\(Service:\s*([A-Za-z0-9._-]+)[,;]\s*Status Code:\s*403[,;)]/i.exec(statusMessage);
|
|
29018
|
+
if (!match) return "";
|
|
29019
|
+
const service = match[1] ?? "";
|
|
29020
|
+
if (/cloudcontrol/i.test(service)) return "";
|
|
29021
|
+
return ` [hint: this 403 was returned by ${service} to the AWS-managed resource handler running the operation, not to cdkd directly — these credentials already passed Cloud Control's own auth to start it. If the equivalent ${service} API call succeeds with the same credentials, the resource handler itself is failing (an upstream AWS issue worth retrying later), not your local credential setup.]`;
|
|
29022
|
+
}
|
|
29023
|
+
const MAX_LOGGED_MODEL_KEYS = 12;
|
|
29024
|
+
function describeJsonKeys(document) {
|
|
29025
|
+
const keys = [];
|
|
29026
|
+
const seen = /* @__PURE__ */ new Set();
|
|
29027
|
+
const pattern = /"([^"\\]{1,64})"\s*:/g;
|
|
29028
|
+
let match;
|
|
29029
|
+
while ((match = pattern.exec(document)) !== null) {
|
|
29030
|
+
const key = match[1];
|
|
29031
|
+
if (seen.has(key)) continue;
|
|
29032
|
+
seen.add(key);
|
|
29033
|
+
keys.push(key);
|
|
29034
|
+
if (keys.length >= 12) break;
|
|
28977
29035
|
}
|
|
28978
|
-
|
|
29036
|
+
if (keys.length === 0) return "no readable key names";
|
|
29037
|
+
const suffix = pattern.lastIndex < document.length && keys.length >= 12 ? ", ..." : "";
|
|
29038
|
+
return `keys: ${keys.join(", ")}${suffix}`;
|
|
29039
|
+
}
|
|
29040
|
+
|
|
29041
|
+
// src/provisioning/cloud-control/wait.ts
|
|
29042
|
+
async function waitForOperation(requestToken, logicalId, operation, resourceType, transientGraceMs = this.POLL_TRANSIENT_GRACE_MS) {
|
|
29043
|
+
const startTime = Date.now();
|
|
29044
|
+
let attempts = 0;
|
|
29045
|
+
let pollInterval = this.INITIAL_POLL_INTERVAL_MS;
|
|
29046
|
+
let lastSleepMs = 0;
|
|
29047
|
+
let lastSeenIdentifier;
|
|
29048
|
+
let transientOutageStartedAt;
|
|
29049
|
+
let lastTransientError;
|
|
29050
|
+
const maxWaitMs = Math.max(this.MAX_WAIT_TIME_MS, slowCcOperationTimeoutMs(resourceType, operation));
|
|
29051
|
+
while (Date.now() - startTime < maxWaitMs) {
|
|
29052
|
+
attempts++;
|
|
29053
|
+
let statusResponse;
|
|
28979
29054
|
try {
|
|
28980
|
-
|
|
28981
|
-
TypeName: resourceType,
|
|
28982
|
-
Identifier: physicalId
|
|
28983
|
-
}));
|
|
28984
|
-
if (!response.ResourceDescription?.Properties) return null;
|
|
28985
|
-
return this.parseResourceModel(response.ResourceDescription.Properties);
|
|
29055
|
+
statusResponse = await this.cloudControlClient.send(new GetResourceRequestStatusCommand({ RequestToken: requestToken }));
|
|
28986
29056
|
} catch (error) {
|
|
28987
|
-
if (error.
|
|
28988
|
-
|
|
29057
|
+
if (!isTransientPollFailure(error)) throw await this.abandonWait(requestToken, logicalId, operation, resourceType, lastSeenIdentifier, "cdkd could not read the operation status and the failure is not retryable", error);
|
|
29058
|
+
transientOutageStartedAt ??= Date.now();
|
|
29059
|
+
lastTransientError = error;
|
|
29060
|
+
const outageMs = Date.now() - transientOutageStartedAt;
|
|
29061
|
+
if (outageMs >= transientGraceMs) throw await this.abandonWait(requestToken, logicalId, operation, resourceType, lastSeenIdentifier, `cdkd could not reach Cloud Control API for ${Math.round(outageMs / 1e3)}s`, error);
|
|
29062
|
+
const safePollText = displaySafe(describePollFailure(error).display);
|
|
29063
|
+
this.logger.warn(`${operation} ${logicalId}: could not read the Cloud Control operation status (attempt ${attempts})${safePollText === "" ? "" : `: ${safePollText}`} — the operation may still be running in AWS; re-polling the same request token in ${pollInterval}ms`);
|
|
29064
|
+
await this.sleep(pollInterval);
|
|
29065
|
+
pollInterval = Math.min(Math.ceil(pollInterval * 1.5), this.MAX_POLL_INTERVAL_MS);
|
|
29066
|
+
continue;
|
|
28989
29067
|
}
|
|
28990
|
-
|
|
28991
|
-
|
|
28992
|
-
const
|
|
28993
|
-
|
|
28994
|
-
|
|
28995
|
-
|
|
28996
|
-
|
|
28997
|
-
|
|
28998
|
-
|
|
28999
|
-
|
|
29000
|
-
|
|
29001
|
-
|
|
29002
|
-
|
|
29003
|
-
|
|
29004
|
-
|
|
29005
|
-
}
|
|
29006
|
-
|
|
29007
|
-
|
|
29008
|
-
|
|
29009
|
-
|
|
29010
|
-
if (
|
|
29011
|
-
|
|
29012
|
-
this.
|
|
29068
|
+
transientOutageStartedAt = void 0;
|
|
29069
|
+
lastTransientError = void 0;
|
|
29070
|
+
const progressEvent = statusResponse.ProgressEvent;
|
|
29071
|
+
if (!progressEvent) throw new ProvisioningError(`Failed to get status for ${logicalId}: No progress event`, "Unknown", logicalId);
|
|
29072
|
+
if (progressEvent.Identifier) lastSeenIdentifier = progressEvent.Identifier;
|
|
29073
|
+
this.logger.debug(`${operation} ${logicalId}: ${progressEvent.OperationStatus} (attempt ${attempts}, next poll ${pollInterval}ms)`);
|
|
29074
|
+
switch (progressEvent.OperationStatus) {
|
|
29075
|
+
case "SUCCESS":
|
|
29076
|
+
recordPhase("cloud control polls", `${operation.toLowerCase()}: last poll gap`, attempts > 1 ? lastSleepMs : 0, `${logicalId} after ${attempts} poll(s)`);
|
|
29077
|
+
return progressEvent;
|
|
29078
|
+
case "FAILED": {
|
|
29079
|
+
const rawFailureMessage = progressEvent.StatusMessage || "Unknown error";
|
|
29080
|
+
const failureMessage = maskCallerIdentity(rawFailureMessage);
|
|
29081
|
+
if (failureMessage !== rawFailureMessage) this.logger.debug(`${operation} ${logicalId}: handler StatusMessage before caller-identity masking: ` + displaySafe(rawFailureMessage));
|
|
29082
|
+
throw new CloudControlOperationFailedError(`${operation} failed for ${logicalId}: ${failureMessage}${handlerAuthFailureHint(failureMessage)}`, progressEvent.TypeName || "Unknown", logicalId, progressEvent.Identifier, progressEvent.ErrorCode, operation);
|
|
29083
|
+
}
|
|
29084
|
+
case "CANCEL_COMPLETE": throw Object.assign(new ProvisioningError(`${operation} cancelled for ${logicalId}`, progressEvent.TypeName || "Unknown", logicalId, progressEvent.Identifier), { ccOperationCancelled: true });
|
|
29085
|
+
case "IN_PROGRESS":
|
|
29086
|
+
case "PENDING":
|
|
29087
|
+
case "CANCEL_IN_PROGRESS":
|
|
29088
|
+
if (progressEvent.RetryAfter instanceof Date) recordPhase("cloud control polls", "RetryAfter hint, ahead of now", Math.max(0, progressEvent.RetryAfter.getTime() - Date.now()), `next sleep ${pollInterval}ms`);
|
|
29089
|
+
lastSleepMs = pollInterval;
|
|
29090
|
+
await this.sleep(pollInterval);
|
|
29091
|
+
pollInterval = Math.min(Math.ceil(pollInterval * 1.5), this.MAX_POLL_INTERVAL_MS);
|
|
29092
|
+
break;
|
|
29093
|
+
default:
|
|
29094
|
+
this.logger.warn(`Unknown operation status for ${logicalId}: ${progressEvent.OperationStatus}`);
|
|
29013
29095
|
await this.sleep(pollInterval);
|
|
29014
29096
|
pollInterval = Math.min(Math.ceil(pollInterval * 1.5), this.MAX_POLL_INTERVAL_MS);
|
|
29015
|
-
continue;
|
|
29016
|
-
}
|
|
29017
|
-
transientOutageStartedAt = void 0;
|
|
29018
|
-
lastTransientError = void 0;
|
|
29019
|
-
const progressEvent = statusResponse.ProgressEvent;
|
|
29020
|
-
if (!progressEvent) throw new ProvisioningError(`Failed to get status for ${logicalId}: No progress event`, "Unknown", logicalId);
|
|
29021
|
-
if (progressEvent.Identifier) lastSeenIdentifier = progressEvent.Identifier;
|
|
29022
|
-
this.logger.debug(`${operation} ${logicalId}: ${progressEvent.OperationStatus} (attempt ${attempts}, next poll ${pollInterval}ms)`);
|
|
29023
|
-
switch (progressEvent.OperationStatus) {
|
|
29024
|
-
case "SUCCESS":
|
|
29025
|
-
recordPhase("cloud control polls", `${operation.toLowerCase()}: last poll gap`, attempts > 1 ? lastSleepMs : 0, `${logicalId} after ${attempts} poll(s)`);
|
|
29026
|
-
return progressEvent;
|
|
29027
|
-
case "FAILED": {
|
|
29028
|
-
const rawFailureMessage = progressEvent.StatusMessage || "Unknown error";
|
|
29029
|
-
const failureMessage = maskCallerIdentity(rawFailureMessage);
|
|
29030
|
-
if (failureMessage !== rawFailureMessage) this.logger.debug(`${operation} ${logicalId}: handler StatusMessage before caller-identity masking: ` + displaySafe(rawFailureMessage));
|
|
29031
|
-
throw new CloudControlOperationFailedError(`${operation} failed for ${logicalId}: ${failureMessage}${handlerAuthFailureHint(failureMessage)}`, progressEvent.TypeName || "Unknown", logicalId, progressEvent.Identifier, progressEvent.ErrorCode, operation);
|
|
29032
|
-
}
|
|
29033
|
-
case "CANCEL_COMPLETE": throw Object.assign(new ProvisioningError(`${operation} cancelled for ${logicalId}`, progressEvent.TypeName || "Unknown", logicalId, progressEvent.Identifier), { ccOperationCancelled: true });
|
|
29034
|
-
case "IN_PROGRESS":
|
|
29035
|
-
case "PENDING":
|
|
29036
|
-
case "CANCEL_IN_PROGRESS":
|
|
29037
|
-
if (progressEvent.RetryAfter instanceof Date) recordPhase("cloud control polls", "RetryAfter hint, ahead of now", Math.max(0, progressEvent.RetryAfter.getTime() - Date.now()), `next sleep ${pollInterval}ms`);
|
|
29038
|
-
lastSleepMs = pollInterval;
|
|
29039
|
-
await this.sleep(pollInterval);
|
|
29040
|
-
pollInterval = Math.min(Math.ceil(pollInterval * 1.5), this.MAX_POLL_INTERVAL_MS);
|
|
29041
|
-
break;
|
|
29042
|
-
default:
|
|
29043
|
-
this.logger.warn(`Unknown operation status for ${logicalId}: ${progressEvent.OperationStatus}`);
|
|
29044
|
-
await this.sleep(pollInterval);
|
|
29045
|
-
pollInterval = Math.min(Math.ceil(pollInterval * 1.5), this.MAX_POLL_INTERVAL_MS);
|
|
29046
|
-
}
|
|
29047
29097
|
}
|
|
29048
|
-
throw await this.abandonWait(requestToken, logicalId, operation, resourceType, lastSeenIdentifier, `${operation} timeout for ${logicalId} after ${maxWaitMs / 1e3}s`, lastTransientError);
|
|
29049
29098
|
}
|
|
29050
|
-
|
|
29051
|
-
|
|
29052
|
-
|
|
29053
|
-
|
|
29054
|
-
|
|
29055
|
-
|
|
29056
|
-
|
|
29057
|
-
|
|
29058
|
-
|
|
29059
|
-
|
|
29060
|
-
|
|
29061
|
-
|
|
29062
|
-
}
|
|
29063
|
-
|
|
29064
|
-
const modelKeys = Object.keys(model);
|
|
29065
|
-
const enriched = await this.enrichResourceAttributes(resourceType, identifier, model);
|
|
29066
|
-
return {
|
|
29067
|
-
physicalId: identifier,
|
|
29068
|
-
attributes: await this.maskDeployedNonAttributeKeys(enriched, modelKeys, resourceType, identifier, attributeNamesLookup, properties, mask)
|
|
29069
|
-
};
|
|
29099
|
+
throw await this.abandonWait(requestToken, logicalId, operation, resourceType, lastSeenIdentifier, `${operation} timeout for ${logicalId} after ${maxWaitMs / 1e3}s`, lastTransientError);
|
|
29100
|
+
}
|
|
29101
|
+
async function resumeCreatedResource(logicalId, resourceType, identifier, properties, context) {
|
|
29102
|
+
const mask = maskerOrIdentity(context?.maskSecrets);
|
|
29103
|
+
const attributeNamesLookup = getTopLevelDeployAttributeNames(resourceType);
|
|
29104
|
+
let raw;
|
|
29105
|
+
try {
|
|
29106
|
+
raw = (await this.cloudControlClient.send(new GetResourceCommand({
|
|
29107
|
+
TypeName: resourceType,
|
|
29108
|
+
Identifier: identifier
|
|
29109
|
+
}))).ResourceDescription?.Properties;
|
|
29110
|
+
} catch (error) {
|
|
29111
|
+
if (error.name === "ResourceNotFoundException") throw Object.assign(new ProvisioningError(`${logicalId}'s resource that an earlier CREATE made no longer exists`, resourceType, logicalId, identifier, error instanceof Error ? error : void 0), { resumedResourceGone: true });
|
|
29112
|
+
throw error;
|
|
29070
29113
|
}
|
|
29071
|
-
|
|
29072
|
-
|
|
29073
|
-
|
|
29074
|
-
|
|
29075
|
-
|
|
29076
|
-
|
|
29077
|
-
|
|
29078
|
-
|
|
29079
|
-
|
|
29080
|
-
|
|
29081
|
-
|
|
29082
|
-
|
|
29083
|
-
|
|
29114
|
+
const model = typeof raw === "string" && raw !== "" ? this.parseResourceModel(raw) : {};
|
|
29115
|
+
const modelKeys = Object.keys(model);
|
|
29116
|
+
const enriched = await this.enrichResourceAttributes(resourceType, identifier, model);
|
|
29117
|
+
return {
|
|
29118
|
+
physicalId: identifier,
|
|
29119
|
+
attributes: await this.maskDeployedNonAttributeKeys(enriched, modelKeys, resourceType, identifier, attributeNamesLookup, properties, mask)
|
|
29120
|
+
};
|
|
29121
|
+
}
|
|
29122
|
+
async function resumeAbandonedRequest(requestToken, logicalId, resourceType) {
|
|
29123
|
+
let first;
|
|
29124
|
+
try {
|
|
29125
|
+
first = await this.cloudControlClient.send(new GetResourceRequestStatusCommand({ RequestToken: requestToken }));
|
|
29126
|
+
} catch (error) {
|
|
29127
|
+
if (error.name === "RequestTokenNotFoundException") return { status: "not-found" };
|
|
29128
|
+
return {
|
|
29084
29129
|
status: "unresolved",
|
|
29085
|
-
error
|
|
29130
|
+
error
|
|
29086
29131
|
};
|
|
29087
|
-
|
|
29088
|
-
|
|
29089
|
-
|
|
29090
|
-
|
|
29091
|
-
|
|
29092
|
-
|
|
29093
|
-
|
|
29094
|
-
|
|
29095
|
-
|
|
29096
|
-
|
|
29097
|
-
|
|
29098
|
-
|
|
29099
|
-
|
|
29100
|
-
|
|
29101
|
-
|
|
29102
|
-
|
|
29103
|
-
return {
|
|
29104
|
-
status: "unresolved",
|
|
29105
|
-
error
|
|
29106
|
-
};
|
|
29107
|
-
}
|
|
29108
|
-
switch (event?.OperationStatus) {
|
|
29109
|
-
case "SUCCESS": return event.Identifier ? {
|
|
29110
|
-
status: "succeeded",
|
|
29111
|
-
identifier: event.Identifier
|
|
29112
|
-
} : {
|
|
29113
|
-
status: "unresolved",
|
|
29114
|
-
error: /* @__PURE__ */ new Error("the SUCCESS event named no Identifier")
|
|
29115
|
-
};
|
|
29116
|
-
case "FAILED": return failedOutcome$1(event.ErrorCode, event.Identifier);
|
|
29117
|
-
case "CANCEL_COMPLETE": return event.Identifier ? {
|
|
29132
|
+
}
|
|
29133
|
+
let event = first.ProgressEvent;
|
|
29134
|
+
if (event?.TypeName !== void 0 && event.TypeName !== resourceType || event?.Operation !== void 0 && event.Operation !== "CREATE") return {
|
|
29135
|
+
status: "unresolved",
|
|
29136
|
+
error: /* @__PURE__ */ new Error("the request is not a CREATE of the type the journal records")
|
|
29137
|
+
};
|
|
29138
|
+
if (event !== void 0 && ![
|
|
29139
|
+
"SUCCESS",
|
|
29140
|
+
"FAILED",
|
|
29141
|
+
"CANCEL_COMPLETE"
|
|
29142
|
+
].includes(String(event.OperationStatus))) try {
|
|
29143
|
+
event = await this.waitForOperation(requestToken, logicalId, "CREATE", resourceType);
|
|
29144
|
+
} catch (error) {
|
|
29145
|
+
if (error instanceof CloudControlOperationFailedError) return failedOutcome$1(error.ccErrorCode, error.physicalId);
|
|
29146
|
+
if (error.ccOperationCancelled === true) {
|
|
29147
|
+
const made = error.physicalId;
|
|
29148
|
+
return made ? {
|
|
29118
29149
|
status: "cancelled",
|
|
29119
|
-
remnant:
|
|
29150
|
+
remnant: made
|
|
29120
29151
|
} : { status: "cancelled" };
|
|
29121
|
-
default: return {
|
|
29122
|
-
status: "unresolved",
|
|
29123
|
-
error: /* @__PURE__ */ new Error(`unexpected operation status ${String(event?.OperationStatus)}`)
|
|
29124
|
-
};
|
|
29125
29152
|
}
|
|
29153
|
+
if (isInterruptedWaitError(error)) throw error;
|
|
29154
|
+
return {
|
|
29155
|
+
status: "unresolved",
|
|
29156
|
+
error
|
|
29157
|
+
};
|
|
29126
29158
|
}
|
|
29127
|
-
|
|
29128
|
-
|
|
29129
|
-
|
|
29130
|
-
|
|
29131
|
-
|
|
29132
|
-
|
|
29133
|
-
|
|
29134
|
-
|
|
29135
|
-
|
|
29136
|
-
|
|
29137
|
-
|
|
29138
|
-
|
|
29139
|
-
|
|
29140
|
-
|
|
29141
|
-
|
|
29142
|
-
|
|
29143
|
-
|
|
29144
|
-
} catch {
|
|
29145
|
-
region = void 0;
|
|
29146
|
-
}
|
|
29147
|
-
const safeRegion = region === void 0 || region === "" || displaySafe(region, { asciiOnly: true }) !== region ? void 0 : region;
|
|
29148
|
-
const regionFlag = safeRegion === void 0 ? "" : ` --region ${shellQuote(safeRegion)}`;
|
|
29149
|
-
return `${withPasteableAwsProfile("aws cloudcontrol get-resource-request-status")} --request-token ${shellQuote(safeToken)}${regionFlag}`;
|
|
29159
|
+
switch (event?.OperationStatus) {
|
|
29160
|
+
case "SUCCESS": return event.Identifier ? {
|
|
29161
|
+
status: "succeeded",
|
|
29162
|
+
identifier: event.Identifier
|
|
29163
|
+
} : {
|
|
29164
|
+
status: "unresolved",
|
|
29165
|
+
error: /* @__PURE__ */ new Error("the SUCCESS event named no Identifier")
|
|
29166
|
+
};
|
|
29167
|
+
case "FAILED": return failedOutcome$1(event.ErrorCode, event.Identifier);
|
|
29168
|
+
case "CANCEL_COMPLETE": return event.Identifier ? {
|
|
29169
|
+
status: "cancelled",
|
|
29170
|
+
remnant: event.Identifier
|
|
29171
|
+
} : { status: "cancelled" };
|
|
29172
|
+
default: return {
|
|
29173
|
+
status: "unresolved",
|
|
29174
|
+
error: /* @__PURE__ */ new Error(`unexpected operation status ${String(event?.OperationStatus)}`)
|
|
29175
|
+
};
|
|
29150
29176
|
}
|
|
29151
|
-
|
|
29177
|
+
}
|
|
29178
|
+
async function abandonWait(requestToken, logicalId, operation, resourceType, lastSeenIdentifier, reason, cause) {
|
|
29179
|
+
const described = describePollFailure(cause);
|
|
29180
|
+
const safeDisplay = displaySafe(described.display);
|
|
29181
|
+
const causeText = safeDisplay === "" ? "" : `: ${safeDisplay}`;
|
|
29182
|
+
if (described.detail !== "") this.logger.debug(`${operation} ${logicalId}: the abandoned operation's underlying failure was: ${displaySafe(described.detail)}`);
|
|
29183
|
+
const identifierClause = lastSeenIdentifier === void 0 ? "" : ` The last status cdkd read named the resource ${displaySafe(lastSeenIdentifier, { asciiOnly: true })}.`;
|
|
29184
|
+
const consequence = operation === "CREATE" ? "cdkd has NO state record for it: when the failed deploy records the request in the stack's rollback journal, the next cdkd deploy, destroy or rollback checks how it ended, and otherwise any resource it creates is untracked" : operation === "DELETE" ? "the resource may or may not have been removed; its state record is kept so a re-run can finish the delete" : "its state record still holds the PREVIOUS properties, so the record may no longer describe the live resource";
|
|
29185
|
+
const error = new CloudControlWaitAbandonedError(safeMsg`${operation} of ${logicalId} was accepted by Cloud Control API, but cdkd stopped waiting for it ` + safeMsg`(${reason}${causeText}). The operation may still be running in AWS, and ${consequence}.` + `${identifierClause} Check what it did with:\n ${await this.buildResumeCommand(requestToken)}`, resourceType, logicalId, requestToken, operation, lastSeenIdentifier, cause instanceof Error ? cause : void 0);
|
|
29186
|
+
if (described.marker) markRedactedCause(error);
|
|
29187
|
+
return operation === "CREATE" ? markNonRetryable(error) : error;
|
|
29188
|
+
}
|
|
29189
|
+
async function buildResumeCommand(requestToken) {
|
|
29190
|
+
const safeToken = displaySafe(requestToken, { asciiOnly: true });
|
|
29191
|
+
if (!safeToken || safeToken !== requestToken) return "(cdkd cannot render a safe resume command for this request token — see the Cloud Control console)";
|
|
29192
|
+
let region;
|
|
29193
|
+
try {
|
|
29194
|
+
region = (await this.cloudControlClient.config.region())?.trim();
|
|
29195
|
+
} catch {
|
|
29196
|
+
region = void 0;
|
|
29197
|
+
}
|
|
29198
|
+
const safeRegion = region === void 0 || region === "" || displaySafe(region, { asciiOnly: true }) !== region ? void 0 : region;
|
|
29199
|
+
const regionFlag = safeRegion === void 0 ? "" : ` --region ${shellQuote(safeRegion)}`;
|
|
29200
|
+
return `${withPasteableAwsProfile("aws cloudcontrol get-resource-request-status")} --request-token ${shellQuote(safeToken)}${regionFlag}`;
|
|
29201
|
+
}
|
|
29202
|
+
|
|
29203
|
+
// src/provisioning/cloud-control/read.ts
|
|
29204
|
+
function parseResourceModel(resourceModel, log = this.logger) {
|
|
29205
|
+
try {
|
|
29206
|
+
return JSON.parse(resourceModel);
|
|
29207
|
+
} catch (error) {
|
|
29208
|
+
const described = describeAwsFailure(error);
|
|
29209
|
+
log.warn(`Failed to parse resource model: ${described.redacted ? described.summary : error instanceof Error ? error.name : "Error"}\nModel shape: ${resourceModel.length} chars, ${describeJsonKeys(resourceModel)}`);
|
|
29210
|
+
if (log.withheld !== true) log.debug(`Resource model parse failure detail: ${displaySafe(described.detail)}`);
|
|
29211
|
+
return {};
|
|
29212
|
+
}
|
|
29213
|
+
}
|
|
29214
|
+
async function accountInfoForSynthesizedArn(resourceType, attributeName, physicalId, log = this.logger) {
|
|
29215
|
+
const region = await this.cloudControlClient.config.region();
|
|
29216
|
+
try {
|
|
29217
|
+
return await getAccountInfo(region);
|
|
29218
|
+
} catch (error) {
|
|
29219
|
+
if (!(error instanceof AccountIdUnavailableError)) throw error;
|
|
29220
|
+
log.warn(`Not enriching ${resourceType} ${attributeName} for ${physicalId}: ${error.message} The resource itself is unaffected; the record heals on its next update.`);
|
|
29221
|
+
return;
|
|
29222
|
+
}
|
|
29223
|
+
}
|
|
29224
|
+
async function mergeSparseModelReadback(resourceType, physicalId, attributes, log = this.logger) {
|
|
29225
|
+
if (!this.isSparseAttributeMap(attributes, physicalId)) return attributes;
|
|
29226
|
+
const model = await this.readCcResourceModel(resourceType, physicalId, log);
|
|
29227
|
+
if (!model) return attributes;
|
|
29228
|
+
log.debug(`Merged CC GetResource read-back over sparse ${resourceType} attributes for ${physicalId}`);
|
|
29229
|
+
return {
|
|
29230
|
+
...attributes,
|
|
29231
|
+
...model
|
|
29232
|
+
};
|
|
29233
|
+
}
|
|
29234
|
+
function isSparseAttributeMap(attributes, physicalId) {
|
|
29235
|
+
const values = Object.values(attributes);
|
|
29236
|
+
if (values.length === 0) return true;
|
|
29237
|
+
const identifierEchoes = new Set(physicalId.split("|"));
|
|
29238
|
+
identifierEchoes.add(physicalId);
|
|
29239
|
+
return values.every((value) => typeof value === "string" && identifierEchoes.has(value));
|
|
29240
|
+
}
|
|
29241
|
+
async function readCcResourceModel(resourceType, physicalId, log = this.logger) {
|
|
29242
|
+
try {
|
|
29243
|
+
const raw = (await this.cloudControlClient.send(new GetResourceCommand({
|
|
29244
|
+
TypeName: resourceType,
|
|
29245
|
+
Identifier: physicalId
|
|
29246
|
+
}))).ResourceDescription?.Properties;
|
|
29247
|
+
if (typeof raw !== "string" || raw.length === 0) return;
|
|
29248
|
+
let parsed;
|
|
29152
29249
|
try {
|
|
29153
|
-
|
|
29154
|
-
} catch (
|
|
29155
|
-
const
|
|
29156
|
-
log.
|
|
29157
|
-
|
|
29158
|
-
return {};
|
|
29250
|
+
parsed = JSON.parse(raw);
|
|
29251
|
+
} catch (parseError) {
|
|
29252
|
+
const detail = log.withheld === true ? describeJsonParseFailure(parseError, utf8ByteLength(raw)) : displaySafe(describeAwsFailure(parseError).detail);
|
|
29253
|
+
log.debug(`Failed to read CC model for ${resourceType} ${physicalId}: ${detail}`);
|
|
29254
|
+
return;
|
|
29159
29255
|
}
|
|
29256
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return;
|
|
29257
|
+
return parsed;
|
|
29258
|
+
} catch (error) {
|
|
29259
|
+
log.debug(`Failed to read CC model for ${resourceType} ${physicalId}: ${describeAwsFailure(error).detail}`);
|
|
29260
|
+
return;
|
|
29160
29261
|
}
|
|
29161
|
-
|
|
29162
|
-
|
|
29262
|
+
}
|
|
29263
|
+
function handleError(error, operation, resourceType, logicalId, physicalId) {
|
|
29264
|
+
const err = error;
|
|
29265
|
+
const rawMessage = err.message || "Unknown error";
|
|
29266
|
+
const awsMessage = maskCallerIdentity(rawMessage);
|
|
29267
|
+
if (!(error instanceof ProvisioningError) && awsMessage !== rawMessage) this.logger.debug(`${operation} ${logicalId}: AWS error before caller-identity masking: ${displaySafe(rawMessage)}`);
|
|
29268
|
+
if (err.name === "UnsupportedActionException" || err.name === "TypeNotFoundException") throw new ProvisioningError(`Resource type ${resourceType} is not supported by Cloud Control API and no SDK provider is registered.\nPlease report this issue at https://github.com/go-to-k/cdkd/issues so we can add SDK provider support.\nError: ${awsMessage}`, resourceType, logicalId, physicalId, error instanceof Error ? error : void 0);
|
|
29269
|
+
if (error instanceof ProvisioningError) throw error;
|
|
29270
|
+
throw new ProvisioningError(`${operation} failed for ${logicalId}: ${awsMessage}`, resourceType, logicalId, physicalId, error instanceof Error ? error : void 0);
|
|
29271
|
+
}
|
|
29272
|
+
function sleep$1(ms) {
|
|
29273
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
29274
|
+
}
|
|
29275
|
+
async function readCurrentState$1(physicalId, _logicalId, resourceType, _properties) {
|
|
29276
|
+
try {
|
|
29277
|
+
const raw = (await this.cloudControlClient.send(new GetResourceCommand({
|
|
29278
|
+
TypeName: resourceType,
|
|
29279
|
+
Identifier: physicalId
|
|
29280
|
+
}))).ResourceDescription?.Properties;
|
|
29281
|
+
if (typeof raw !== "string" || raw.length === 0) return;
|
|
29282
|
+
let parsed;
|
|
29163
29283
|
try {
|
|
29164
|
-
|
|
29165
|
-
} catch (
|
|
29166
|
-
|
|
29167
|
-
|
|
29168
|
-
return;
|
|
29284
|
+
parsed = JSON.parse(raw);
|
|
29285
|
+
} catch (parseError) {
|
|
29286
|
+
this.logger.debug(safeMsg`Cloud Control resource model for ${displayIdent(resourceType)} failed to parse: ${parseFailureDebugDetail(parseError)}`);
|
|
29287
|
+
throw new SyntaxError(`Cloud Control returned a resource model for ${displayIdent(resourceType)} that is not valid JSON: ${describeJsonParseFailure(parseError, utf8ByteLength(raw))}`);
|
|
29169
29288
|
}
|
|
29289
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return;
|
|
29290
|
+
return parsed;
|
|
29291
|
+
} catch (error) {
|
|
29292
|
+
if (error.name === "ResourceNotFoundException") return RESOURCE_NOT_FOUND;
|
|
29293
|
+
throw error;
|
|
29170
29294
|
}
|
|
29171
|
-
|
|
29172
|
-
|
|
29173
|
-
|
|
29174
|
-
|
|
29175
|
-
|
|
29176
|
-
|
|
29177
|
-
|
|
29178
|
-
|
|
29179
|
-
|
|
29180
|
-
|
|
29181
|
-
|
|
29182
|
-
|
|
29183
|
-
|
|
29184
|
-
|
|
29185
|
-
|
|
29186
|
-
|
|
29187
|
-
|
|
29188
|
-
|
|
29189
|
-
|
|
29190
|
-
|
|
29191
|
-
|
|
29192
|
-
|
|
29193
|
-
|
|
29194
|
-
|
|
29195
|
-
|
|
29196
|
-
|
|
29197
|
-
|
|
29198
|
-
|
|
29199
|
-
|
|
29200
|
-
|
|
29201
|
-
|
|
29202
|
-
|
|
29203
|
-
|
|
29204
|
-
|
|
29205
|
-
|
|
29206
|
-
|
|
29207
|
-
|
|
29208
|
-
|
|
29209
|
-
|
|
29210
|
-
|
|
29211
|
-
|
|
29212
|
-
|
|
29213
|
-
if (latestStreamArn) {
|
|
29214
|
-
enriched["StreamArn"] = latestStreamArn;
|
|
29215
|
-
log.debug(`Enriched DynamoDB StreamArn for ${physicalId}: ${latestStreamArn}`);
|
|
29216
|
-
}
|
|
29217
|
-
} catch (error) {
|
|
29218
|
-
log.debug(`Failed to get DynamoDB StreamArn for ${physicalId}: ${describeAwsFailure(error).detail}`);
|
|
29295
|
+
}
|
|
29296
|
+
async function maskDeployedNonAttributeKeys(attributes, modelKeys, resourceType, physicalId, attributeNamesLookup, desired, mask, log = this.logger) {
|
|
29297
|
+
const safeType = displaySafe(resourceType, { asciiOnly: true });
|
|
29298
|
+
const attributeNames = await attributeNamesLookup;
|
|
29299
|
+
if (attributeNames === void 0) {
|
|
29300
|
+
log.debug(`Could not resolve the CloudFormation schema for ${safeType}; recording its Cloud Control model unnarrowed for ${displaySafe(physicalId, { asciiOnly: true })}.`);
|
|
29301
|
+
return attributes;
|
|
29302
|
+
}
|
|
29303
|
+
const narrowed = new Set(modelKeys.filter((key) => !attributeNames.has(key) && !isLiteralDeployOnlyKey(resourceType, key, desired, mask)));
|
|
29304
|
+
if (narrowed.size === 0) return attributes;
|
|
29305
|
+
const out = Object.create(null);
|
|
29306
|
+
for (const [key, value] of Object.entries(attributes)) Object.defineProperty(out, key, {
|
|
29307
|
+
value: narrowed.has(key) ? maskLeavesDeep(value) : value,
|
|
29308
|
+
enumerable: true,
|
|
29309
|
+
writable: true,
|
|
29310
|
+
configurable: true
|
|
29311
|
+
});
|
|
29312
|
+
log.debug(`Masked ${narrowed.size} non-attribute key(s) of the ${safeType} Cloud Control model for ${displaySafe(physicalId, { asciiOnly: true })}: they are not Fn::GetAtt attributes of the type.`);
|
|
29313
|
+
return out;
|
|
29314
|
+
}
|
|
29315
|
+
|
|
29316
|
+
// src/provisioning/cloud-control/enrich.ts
|
|
29317
|
+
async function enrichResourceAttributes(resourceType, physicalId, attributes, log = this.logger) {
|
|
29318
|
+
const enriched = { ...attributes };
|
|
29319
|
+
switch (resourceType) {
|
|
29320
|
+
case "AWS::S3::Bucket":
|
|
29321
|
+
if (!enriched["Arn"]) try {
|
|
29322
|
+
enriched["Arn"] = s3BucketArn(physicalId, await this.cloudControlClient.config.region());
|
|
29323
|
+
} catch (error) {
|
|
29324
|
+
log.debug(`Failed to construct S3 Bucket Arn for ${physicalId}: ${describeAwsFailure(error).detail}`);
|
|
29325
|
+
}
|
|
29326
|
+
break;
|
|
29327
|
+
case "AWS::RDS::DBCluster":
|
|
29328
|
+
try {
|
|
29329
|
+
const cluster = (await new RDSClient({ ...ambientClientDefaults() }).send(new DescribeDBClustersCommand({ DBClusterIdentifier: physicalId }))).DBClusters?.[0];
|
|
29330
|
+
if (cluster) {
|
|
29331
|
+
if (cluster.Endpoint) enriched["Endpoint.Address"] = cluster.Endpoint;
|
|
29332
|
+
if (cluster.Port !== void 0) enriched["Endpoint.Port"] = String(cluster.Port);
|
|
29333
|
+
if (cluster.ReaderEndpoint) enriched["ReadEndpoint.Address"] = cluster.ReaderEndpoint;
|
|
29334
|
+
if (cluster.DBClusterArn) enriched["Arn"] = cluster.DBClusterArn;
|
|
29335
|
+
if (cluster.DbClusterResourceId) enriched["DBClusterResourceId"] = cluster.DbClusterResourceId;
|
|
29336
|
+
log.debug(`Enriched RDS DBCluster ${physicalId} with Endpoint/Port/Arn from DescribeDBClusters`);
|
|
29219
29337
|
}
|
|
29220
|
-
|
|
29221
|
-
|
|
29222
|
-
|
|
29223
|
-
|
|
29224
|
-
|
|
29225
|
-
|
|
29226
|
-
|
|
29227
|
-
|
|
29228
|
-
|
|
29229
|
-
|
|
29338
|
+
} catch (error) {
|
|
29339
|
+
log.debug(`Failed to enrich RDS DBCluster ${physicalId}: ${describeAwsFailure(error).detail}`);
|
|
29340
|
+
}
|
|
29341
|
+
break;
|
|
29342
|
+
case "AWS::RDS::DBInstance":
|
|
29343
|
+
try {
|
|
29344
|
+
const inst = (await new RDSClient({ ...ambientClientDefaults() }).send(new DescribeDBInstancesCommand({ DBInstanceIdentifier: physicalId }))).DBInstances?.[0];
|
|
29345
|
+
if (inst) {
|
|
29346
|
+
if (inst.Endpoint?.Address) enriched["Endpoint.Address"] = inst.Endpoint.Address;
|
|
29347
|
+
if (inst.Endpoint?.Port !== void 0) enriched["Endpoint.Port"] = String(inst.Endpoint.Port);
|
|
29348
|
+
if (inst.Endpoint?.HostedZoneId) enriched["Endpoint.HostedZoneId"] = inst.Endpoint.HostedZoneId;
|
|
29349
|
+
if (inst.DBInstanceArn) enriched["Arn"] = inst.DBInstanceArn;
|
|
29350
|
+
log.debug(`Enriched RDS DBInstance ${physicalId} with Endpoint/Port/Arn from DescribeDBInstances`);
|
|
29230
29351
|
}
|
|
29231
|
-
|
|
29232
|
-
|
|
29233
|
-
|
|
29234
|
-
|
|
29235
|
-
|
|
29236
|
-
|
|
29237
|
-
|
|
29238
|
-
|
|
29239
|
-
|
|
29240
|
-
|
|
29241
|
-
log.debug(`Failed to get CloudFront OAI S3CanonicalUserId for ${physicalId}: ${describeAwsFailure(error).detail}`);
|
|
29352
|
+
} catch (error) {
|
|
29353
|
+
log.debug(`Failed to enrich RDS DBInstance ${physicalId}: ${describeAwsFailure(error).detail}`);
|
|
29354
|
+
}
|
|
29355
|
+
break;
|
|
29356
|
+
case "AWS::DynamoDB::Table":
|
|
29357
|
+
if (!enriched["StreamArn"]) try {
|
|
29358
|
+
const latestStreamArn = (await getAwsClients().dynamoDB.send(new DescribeTableCommand({ TableName: physicalId }))).Table?.LatestStreamArn;
|
|
29359
|
+
if (latestStreamArn) {
|
|
29360
|
+
enriched["StreamArn"] = latestStreamArn;
|
|
29361
|
+
log.debug(`Enriched DynamoDB StreamArn for ${physicalId}: ${latestStreamArn}`);
|
|
29242
29362
|
}
|
|
29243
|
-
|
|
29244
|
-
|
|
29245
|
-
|
|
29246
|
-
|
|
29247
|
-
|
|
29248
|
-
|
|
29249
|
-
|
|
29250
|
-
|
|
29251
|
-
|
|
29252
|
-
log.debug(`
|
|
29363
|
+
} catch (error) {
|
|
29364
|
+
log.debug(`Failed to get DynamoDB StreamArn for ${physicalId}: ${describeAwsFailure(error).detail}`);
|
|
29365
|
+
}
|
|
29366
|
+
break;
|
|
29367
|
+
case "AWS::ApiGateway::RestApi":
|
|
29368
|
+
if (!enriched["RootResourceId"]) try {
|
|
29369
|
+
const getRestApiResponse = await getAwsClients().apiGateway.send(new GetRestApiCommand({ restApiId: physicalId }));
|
|
29370
|
+
if (getRestApiResponse.rootResourceId) {
|
|
29371
|
+
enriched["RootResourceId"] = getRestApiResponse.rootResourceId;
|
|
29372
|
+
log.debug(`Enriched RestApi RootResourceId for ${physicalId}: ${getRestApiResponse.rootResourceId}`);
|
|
29253
29373
|
}
|
|
29254
|
-
|
|
29255
|
-
|
|
29256
|
-
|
|
29257
|
-
|
|
29258
|
-
|
|
29259
|
-
|
|
29260
|
-
|
|
29261
|
-
|
|
29262
|
-
|
|
29263
|
-
|
|
29264
|
-
|
|
29265
|
-
if (ecrAccountInfo) {
|
|
29266
|
-
enriched["Arn"] = `arn:${ecrAccountInfo.partition}:ecr:${canonicalizeRegion(ecrAccountInfo.region)}:${ecrAccountInfo.accountId}:repository/${physicalId}`;
|
|
29267
|
-
log.debug(`Enriched ECR Repository Arn for ${physicalId}: ${String(enriched["Arn"])}`);
|
|
29268
|
-
}
|
|
29269
|
-
} catch (error) {
|
|
29270
|
-
log.debug(`Failed to construct ECR Repository Arn: ${describeAwsFailure(error).detail}`);
|
|
29374
|
+
} catch (error) {
|
|
29375
|
+
log.debug(`Failed to get RestApi RootResourceId for ${physicalId}: ${describeAwsFailure(error).detail}`);
|
|
29376
|
+
}
|
|
29377
|
+
if (!enriched["RestApiId"]) enriched["RestApiId"] = physicalId;
|
|
29378
|
+
break;
|
|
29379
|
+
case "AWS::CloudFront::CloudFrontOriginAccessIdentity":
|
|
29380
|
+
if (!enriched["S3CanonicalUserId"]) try {
|
|
29381
|
+
const s3CanonicalUserId = (await getAwsClients().cloudFront.send(new GetCloudFrontOriginAccessIdentityCommand({ Id: physicalId }))).CloudFrontOriginAccessIdentity?.S3CanonicalUserId;
|
|
29382
|
+
if (s3CanonicalUserId) {
|
|
29383
|
+
enriched["S3CanonicalUserId"] = s3CanonicalUserId;
|
|
29384
|
+
log.debug(`Enriched CloudFront OAI S3CanonicalUserId for ${physicalId}: ${s3CanonicalUserId}`);
|
|
29271
29385
|
}
|
|
29272
|
-
|
|
29273
|
-
|
|
29274
|
-
|
|
29275
|
-
|
|
29276
|
-
|
|
29277
|
-
|
|
29278
|
-
|
|
29279
|
-
|
|
29280
|
-
|
|
29281
|
-
|
|
29282
|
-
const [publicIp, allocationId] = physicalId.split("|");
|
|
29283
|
-
if (!enriched["AllocationId"]) enriched["AllocationId"] = allocationId;
|
|
29284
|
-
if (!enriched["PublicIp"]) enriched["PublicIp"] = publicIp;
|
|
29285
|
-
log.debug(`Enriched EIP attributes: AllocationId=${allocationId}, PublicIp=${publicIp}`);
|
|
29386
|
+
} catch (error) {
|
|
29387
|
+
log.debug(`Failed to get CloudFront OAI S3CanonicalUserId for ${physicalId}: ${describeAwsFailure(error).detail}`);
|
|
29388
|
+
}
|
|
29389
|
+
break;
|
|
29390
|
+
case "AWS::KMS::Key":
|
|
29391
|
+
if (!enriched["Arn"]) try {
|
|
29392
|
+
const kmsAccountInfo = await this.accountInfoForSynthesizedArn(resourceType, "Arn", physicalId, log);
|
|
29393
|
+
if (kmsAccountInfo) {
|
|
29394
|
+
enriched["Arn"] = `arn:${kmsAccountInfo.partition}:kms:${canonicalizeRegion(kmsAccountInfo.region)}:${kmsAccountInfo.accountId}:key/${physicalId}`;
|
|
29395
|
+
log.debug(`Enriched KMS Key Arn for ${physicalId}: ${String(enriched["Arn"])}`);
|
|
29286
29396
|
}
|
|
29287
|
-
|
|
29288
|
-
|
|
29289
|
-
|
|
29290
|
-
|
|
29291
|
-
|
|
29292
|
-
|
|
29293
|
-
|
|
29397
|
+
} catch (error) {
|
|
29398
|
+
log.debug(`Failed to construct KMS Key Arn for ${physicalId}: ${describeAwsFailure(error).detail}`);
|
|
29399
|
+
}
|
|
29400
|
+
if (!enriched["KeyId"]) enriched["KeyId"] = physicalId;
|
|
29401
|
+
break;
|
|
29402
|
+
case "AWS::CloudFront::OriginAccessControl":
|
|
29403
|
+
if (!enriched["Id"]) enriched["Id"] = physicalId;
|
|
29404
|
+
break;
|
|
29405
|
+
case "AWS::Route53::HealthCheck":
|
|
29406
|
+
if (!enriched["HealthCheckId"]) enriched["HealthCheckId"] = physicalId;
|
|
29407
|
+
break;
|
|
29408
|
+
case "AWS::ECR::Repository":
|
|
29409
|
+
if (!enriched["Arn"]) try {
|
|
29410
|
+
const ecrAccountInfo = await this.accountInfoForSynthesizedArn(resourceType, "Arn", physicalId, log);
|
|
29411
|
+
if (ecrAccountInfo) {
|
|
29412
|
+
enriched["Arn"] = `arn:${ecrAccountInfo.partition}:ecr:${canonicalizeRegion(ecrAccountInfo.region)}:${ecrAccountInfo.accountId}:repository/${physicalId}`;
|
|
29413
|
+
log.debug(`Enriched ECR Repository Arn for ${physicalId}: ${String(enriched["Arn"])}`);
|
|
29294
29414
|
}
|
|
29295
|
-
|
|
29296
|
-
|
|
29297
|
-
|
|
29298
|
-
|
|
29299
|
-
|
|
29300
|
-
|
|
29301
|
-
|
|
29302
|
-
}
|
|
29303
|
-
} catch (error) {
|
|
29304
|
-
log.debug(`Failed to construct Kinesis Stream Arn for ${physicalId}: ${describeAwsFailure(error).detail}`);
|
|
29415
|
+
} catch (error) {
|
|
29416
|
+
log.debug(`Failed to construct ECR Repository Arn: ${describeAwsFailure(error).detail}`);
|
|
29417
|
+
}
|
|
29418
|
+
if (!enriched["RepositoryUri"]) try {
|
|
29419
|
+
const ecrAccountInfo = await this.accountInfoForSynthesizedArn(resourceType, "RepositoryUri", physicalId, log);
|
|
29420
|
+
if (ecrAccountInfo) {
|
|
29421
|
+
const { urlSuffix } = derivePartitionAndUrlSuffix(ecrAccountInfo.region);
|
|
29422
|
+
enriched["RepositoryUri"] = `${ecrAccountInfo.accountId}.dkr.ecr.${canonicalizeRegion(ecrAccountInfo.region)}.${urlSuffix}/${physicalId}`;
|
|
29305
29423
|
}
|
|
29306
|
-
|
|
29307
|
-
|
|
29308
|
-
|
|
29309
|
-
|
|
29310
|
-
|
|
29311
|
-
|
|
29312
|
-
|
|
29313
|
-
|
|
29314
|
-
|
|
29315
|
-
|
|
29316
|
-
|
|
29424
|
+
} catch {}
|
|
29425
|
+
break;
|
|
29426
|
+
case "AWS::EC2::EIP":
|
|
29427
|
+
if (physicalId.includes("|")) {
|
|
29428
|
+
const [publicIp, allocationId] = physicalId.split("|");
|
|
29429
|
+
if (!enriched["AllocationId"]) enriched["AllocationId"] = allocationId;
|
|
29430
|
+
if (!enriched["PublicIp"]) enriched["PublicIp"] = publicIp;
|
|
29431
|
+
log.debug(`Enriched EIP attributes: AllocationId=${allocationId}, PublicIp=${publicIp}`);
|
|
29432
|
+
}
|
|
29433
|
+
break;
|
|
29434
|
+
case "AWS::Lambda::Version":
|
|
29435
|
+
if (!enriched["Version"]) {
|
|
29436
|
+
const versionSegments = physicalId.split(":");
|
|
29437
|
+
const versionNumber = versionSegments[versionSegments.length - 1];
|
|
29438
|
+
enriched["Version"] = versionNumber;
|
|
29439
|
+
log.debug(`Enriched Lambda Version for ${physicalId}: ${versionNumber}`);
|
|
29440
|
+
}
|
|
29441
|
+
break;
|
|
29442
|
+
case "AWS::Kinesis::Stream":
|
|
29443
|
+
if (!enriched["Arn"]) try {
|
|
29444
|
+
const kinesisAccountInfo = await this.accountInfoForSynthesizedArn(resourceType, "Arn", physicalId, log);
|
|
29445
|
+
if (kinesisAccountInfo) {
|
|
29446
|
+
enriched["Arn"] = `arn:${kinesisAccountInfo.partition}:kinesis:${canonicalizeRegion(kinesisAccountInfo.region)}:${kinesisAccountInfo.accountId}:stream/${physicalId}`;
|
|
29447
|
+
log.debug(`Enriched Kinesis Stream Arn for ${physicalId}: ${String(enriched["Arn"])}`);
|
|
29317
29448
|
}
|
|
29318
|
-
|
|
29319
|
-
|
|
29320
|
-
|
|
29321
|
-
|
|
29322
|
-
|
|
29323
|
-
|
|
29324
|
-
|
|
29325
|
-
|
|
29326
|
-
|
|
29327
|
-
|
|
29328
|
-
}
|
|
29329
|
-
if (conn.SecretArn && !enriched["SecretArn"]) enriched["SecretArn"] = conn.SecretArn;
|
|
29330
|
-
log.debug(`Enriched Events Connection ${physicalId} with Arn/SecretArn/ArnForPolicy from DescribeConnection`);
|
|
29331
|
-
} catch (error) {
|
|
29332
|
-
log.debug(`Failed to enrich Events Connection ${physicalId}: ${describeAwsFailure(error).detail}`);
|
|
29449
|
+
} catch (error) {
|
|
29450
|
+
log.debug(`Failed to construct Kinesis Stream Arn for ${physicalId}: ${describeAwsFailure(error).detail}`);
|
|
29451
|
+
}
|
|
29452
|
+
break;
|
|
29453
|
+
case "AWS::Lambda::Url":
|
|
29454
|
+
if (!enriched["FunctionUrl"]) try {
|
|
29455
|
+
const urlConfig = await getAwsClients().lambda.send(new GetFunctionUrlConfigCommand({ FunctionName: physicalId }));
|
|
29456
|
+
if (urlConfig.FunctionUrl) {
|
|
29457
|
+
enriched["FunctionUrl"] = urlConfig.FunctionUrl;
|
|
29458
|
+
log.debug(`Enriched Lambda URL FunctionUrl for ${physicalId}: ${urlConfig.FunctionUrl}`);
|
|
29333
29459
|
}
|
|
29334
|
-
|
|
29335
|
-
|
|
29336
|
-
|
|
29337
|
-
|
|
29338
|
-
|
|
29339
|
-
|
|
29340
|
-
|
|
29341
|
-
|
|
29342
|
-
|
|
29343
|
-
|
|
29460
|
+
if (urlConfig.FunctionArn) enriched["FunctionArn"] = urlConfig.FunctionArn;
|
|
29461
|
+
} catch (error) {
|
|
29462
|
+
log.debug(`Failed to get Lambda URL config for ${physicalId}: ${describeAwsFailure(error).detail}`);
|
|
29463
|
+
}
|
|
29464
|
+
break;
|
|
29465
|
+
case "AWS::Events::Connection":
|
|
29466
|
+
if (!enriched["Arn"] || !enriched["SecretArn"] || !enriched["ArnForPolicy"]) try {
|
|
29467
|
+
const conn = await getAwsClients().eventBridge.send(new DescribeConnectionCommand({ Name: physicalId }));
|
|
29468
|
+
if (conn.ConnectionArn) {
|
|
29469
|
+
if (!enriched["Arn"]) enriched["Arn"] = conn.ConnectionArn;
|
|
29470
|
+
if (!enriched["ArnForPolicy"]) {
|
|
29471
|
+
const lastSlash = conn.ConnectionArn.lastIndexOf("/");
|
|
29472
|
+
if (lastSlash > 0) enriched["ArnForPolicy"] = conn.ConnectionArn.slice(0, lastSlash);
|
|
29344
29473
|
}
|
|
29345
|
-
log.debug(`Enriched Events ApiDestination ${physicalId} with Arn/ArnForPolicy from DescribeApiDestination`);
|
|
29346
|
-
} catch (error) {
|
|
29347
|
-
log.debug(`Failed to enrich Events ApiDestination ${physicalId}: ${describeAwsFailure(error).detail}`);
|
|
29348
29474
|
}
|
|
29349
|
-
|
|
29350
|
-
|
|
29351
|
-
|
|
29352
|
-
|
|
29353
|
-
|
|
29354
|
-
|
|
29355
|
-
|
|
29356
|
-
|
|
29357
|
-
|
|
29358
|
-
|
|
29359
|
-
|
|
29360
|
-
|
|
29361
|
-
const
|
|
29362
|
-
|
|
29363
|
-
const readPorts = readEndpoints.map((ep) => ep?.Port).filter((p) => p !== void 0);
|
|
29364
|
-
if (readAddrs.length > 0) enriched["ReadEndPoint.Addresses"] = readAddrs.join(",");
|
|
29365
|
-
if (readPorts.length > 0) enriched["ReadEndPoint.Ports"] = readPorts.map(String).join(",");
|
|
29366
|
-
log.debug(`Enriched ElastiCache ReplicationGroup ${physicalId} with endpoint attributes from DescribeReplicationGroups`);
|
|
29475
|
+
if (conn.SecretArn && !enriched["SecretArn"]) enriched["SecretArn"] = conn.SecretArn;
|
|
29476
|
+
log.debug(`Enriched Events Connection ${physicalId} with Arn/SecretArn/ArnForPolicy from DescribeConnection`);
|
|
29477
|
+
} catch (error) {
|
|
29478
|
+
log.debug(`Failed to enrich Events Connection ${physicalId}: ${describeAwsFailure(error).detail}`);
|
|
29479
|
+
}
|
|
29480
|
+
break;
|
|
29481
|
+
case "AWS::Events::ApiDestination":
|
|
29482
|
+
if (!enriched["Arn"] || !enriched["ArnForPolicy"]) try {
|
|
29483
|
+
const dest = await getAwsClients().eventBridge.send(new DescribeApiDestinationCommand({ Name: physicalId }));
|
|
29484
|
+
if (dest.ApiDestinationArn) {
|
|
29485
|
+
if (!enriched["Arn"]) enriched["Arn"] = dest.ApiDestinationArn;
|
|
29486
|
+
if (!enriched["ArnForPolicy"]) {
|
|
29487
|
+
const lastSlash = dest.ApiDestinationArn.lastIndexOf("/");
|
|
29488
|
+
if (lastSlash > 0) enriched["ArnForPolicy"] = dest.ApiDestinationArn.slice(0, lastSlash);
|
|
29367
29489
|
}
|
|
29368
|
-
} catch (error) {
|
|
29369
|
-
log.debug(`Failed to enrich ElastiCache ReplicationGroup ${physicalId}: ${describeAwsFailure(error).detail}`);
|
|
29370
29490
|
}
|
|
29371
|
-
|
|
29372
|
-
|
|
29373
|
-
|
|
29374
|
-
|
|
29375
|
-
|
|
29376
|
-
|
|
29377
|
-
|
|
29378
|
-
|
|
29379
|
-
|
|
29380
|
-
|
|
29381
|
-
|
|
29491
|
+
log.debug(`Enriched Events ApiDestination ${physicalId} with Arn/ArnForPolicy from DescribeApiDestination`);
|
|
29492
|
+
} catch (error) {
|
|
29493
|
+
log.debug(`Failed to enrich Events ApiDestination ${physicalId}: ${describeAwsFailure(error).detail}`);
|
|
29494
|
+
}
|
|
29495
|
+
break;
|
|
29496
|
+
case "AWS::ElastiCache::ReplicationGroup":
|
|
29497
|
+
try {
|
|
29498
|
+
const rg = (await new ElastiCacheClient({ ...ambientClientDefaults() }).send(new DescribeReplicationGroupsCommand({ ReplicationGroupId: physicalId }))).ReplicationGroups?.[0];
|
|
29499
|
+
if (rg) {
|
|
29500
|
+
const primaryNode = rg.NodeGroups?.[0];
|
|
29501
|
+
if (primaryNode?.PrimaryEndpoint?.Address) enriched["PrimaryEndPoint.Address"] = primaryNode.PrimaryEndpoint.Address;
|
|
29502
|
+
if (primaryNode?.PrimaryEndpoint?.Port !== void 0) enriched["PrimaryEndPoint.Port"] = String(primaryNode.PrimaryEndpoint.Port);
|
|
29503
|
+
if (primaryNode?.ReaderEndpoint?.Address) enriched["ReaderEndPoint.Address"] = primaryNode.ReaderEndpoint.Address;
|
|
29504
|
+
if (primaryNode?.ReaderEndpoint?.Port !== void 0) enriched["ReaderEndPoint.Port"] = String(primaryNode.ReaderEndpoint.Port);
|
|
29505
|
+
if (rg.ConfigurationEndpoint?.Address) enriched["ConfigurationEndPoint.Address"] = rg.ConfigurationEndpoint.Address;
|
|
29506
|
+
if (rg.ConfigurationEndpoint?.Port !== void 0) enriched["ConfigurationEndPoint.Port"] = String(rg.ConfigurationEndpoint.Port);
|
|
29507
|
+
const readEndpoints = (rg.NodeGroups ?? []).flatMap((ng) => [ng.PrimaryEndpoint, ng.ReaderEndpoint]);
|
|
29508
|
+
const readAddrs = readEndpoints.map((ep) => ep?.Address).filter((a) => typeof a === "string" && a.length > 0);
|
|
29509
|
+
const readPorts = readEndpoints.map((ep) => ep?.Port).filter((p) => p !== void 0);
|
|
29510
|
+
if (readAddrs.length > 0) enriched["ReadEndPoint.Addresses"] = readAddrs.join(",");
|
|
29511
|
+
if (readPorts.length > 0) enriched["ReadEndPoint.Ports"] = readPorts.map(String).join(",");
|
|
29512
|
+
log.debug(`Enriched ElastiCache ReplicationGroup ${physicalId} with endpoint attributes from DescribeReplicationGroups`);
|
|
29382
29513
|
}
|
|
29383
|
-
|
|
29384
|
-
|
|
29385
|
-
|
|
29386
|
-
|
|
29387
|
-
|
|
29388
|
-
|
|
29389
|
-
|
|
29390
|
-
|
|
29391
|
-
|
|
29392
|
-
|
|
29393
|
-
|
|
29394
|
-
if (domain.DomainId) enriched["Id"] = domain.DomainId;
|
|
29395
|
-
log.debug(`Enriched OpenSearch Domain ${physicalId} with DomainEndpoint/Arn from DescribeDomain`);
|
|
29396
|
-
}
|
|
29397
|
-
} catch (error) {
|
|
29398
|
-
log.debug(`Failed to enrich OpenSearch Domain ${physicalId}: ${describeAwsFailure(error).detail}`);
|
|
29514
|
+
} catch (error) {
|
|
29515
|
+
log.debug(`Failed to enrich ElastiCache ReplicationGroup ${physicalId}: ${describeAwsFailure(error).detail}`);
|
|
29516
|
+
}
|
|
29517
|
+
break;
|
|
29518
|
+
case "AWS::Redshift::Cluster":
|
|
29519
|
+
try {
|
|
29520
|
+
const cluster = (await new RedshiftClient({ ...ambientClientDefaults() }).send(new DescribeClustersCommand({ ClusterIdentifier: physicalId }))).Clusters?.[0];
|
|
29521
|
+
if (cluster?.Endpoint) {
|
|
29522
|
+
if (cluster.Endpoint.Address) enriched["Endpoint.Address"] = cluster.Endpoint.Address;
|
|
29523
|
+
if (cluster.Endpoint.Port !== void 0) enriched["Endpoint.Port"] = String(cluster.Endpoint.Port);
|
|
29524
|
+
log.debug(`Enriched Redshift Cluster ${physicalId} with Endpoint.Address/Port from DescribeClusters`);
|
|
29399
29525
|
}
|
|
29400
|
-
|
|
29401
|
-
|
|
29402
|
-
|
|
29403
|
-
|
|
29404
|
-
|
|
29405
|
-
|
|
29406
|
-
|
|
29407
|
-
|
|
29526
|
+
} catch (error) {
|
|
29527
|
+
log.debug(`Failed to enrich Redshift Cluster ${physicalId}: ${describeAwsFailure(error).detail}`);
|
|
29528
|
+
}
|
|
29529
|
+
break;
|
|
29530
|
+
case "AWS::OpenSearchService::Domain":
|
|
29531
|
+
try {
|
|
29532
|
+
const domain = (await new OpenSearchClient({ ...ambientClientDefaults() }).send(new DescribeDomainCommand({ DomainName: physicalId }))).DomainStatus;
|
|
29533
|
+
if (domain) {
|
|
29534
|
+
const endpoint = domain.Endpoint ?? domain.Endpoints?.["vpc"];
|
|
29535
|
+
if (endpoint) enriched["DomainEndpoint"] = endpoint;
|
|
29536
|
+
if (domain.ARN) {
|
|
29537
|
+
enriched["Arn"] = domain.ARN;
|
|
29538
|
+
enriched["DomainArn"] = domain.ARN;
|
|
29408
29539
|
}
|
|
29540
|
+
if (domain.DomainId) enriched["Id"] = domain.DomainId;
|
|
29541
|
+
log.debug(`Enriched OpenSearch Domain ${physicalId} with DomainEndpoint/Arn from DescribeDomain`);
|
|
29409
29542
|
}
|
|
29410
|
-
|
|
29411
|
-
|
|
29412
|
-
|
|
29413
|
-
|
|
29414
|
-
|
|
29415
|
-
|
|
29416
|
-
|
|
29417
|
-
|
|
29418
|
-
|
|
29419
|
-
|
|
29420
|
-
}
|
|
29543
|
+
} catch (error) {
|
|
29544
|
+
log.debug(`Failed to enrich OpenSearch Domain ${physicalId}: ${describeAwsFailure(error).detail}`);
|
|
29545
|
+
}
|
|
29546
|
+
break;
|
|
29547
|
+
case "AWS::Backup::BackupVault":
|
|
29548
|
+
if (!enriched["BackupVaultArn"]) {
|
|
29549
|
+
const model = await this.readCcResourceModel(resourceType, physicalId, log);
|
|
29550
|
+
if (model) {
|
|
29551
|
+
if (typeof model["BackupVaultArn"] === "string") enriched["BackupVaultArn"] = model["BackupVaultArn"];
|
|
29552
|
+
if (!enriched["BackupVaultName"] && typeof model["BackupVaultName"] === "string") enriched["BackupVaultName"] = model["BackupVaultName"];
|
|
29553
|
+
log.debug(`Enriched Backup BackupVault ${physicalId} with BackupVaultArn from CC GetResource`);
|
|
29421
29554
|
}
|
|
29422
|
-
|
|
29423
|
-
|
|
29424
|
-
|
|
29425
|
-
|
|
29426
|
-
|
|
29427
|
-
|
|
29428
|
-
|
|
29429
|
-
|
|
29430
|
-
|
|
29431
|
-
|
|
29432
|
-
|
|
29433
|
-
if (typeof model["SelectionId"] === "string") enriched["SelectionId"] = model["SelectionId"];
|
|
29434
|
-
if (typeof model["BackupPlanId"] === "string") enriched["BackupPlanId"] = model["BackupPlanId"];
|
|
29435
|
-
log.debug(`Enriched Backup BackupSelection ${physicalId} with SelectionId from CC GetResource`);
|
|
29436
|
-
}
|
|
29555
|
+
}
|
|
29556
|
+
if (!enriched["BackupVaultName"]) enriched["BackupVaultName"] = physicalId;
|
|
29557
|
+
break;
|
|
29558
|
+
case "AWS::Backup::BackupPlan":
|
|
29559
|
+
if (!enriched["BackupPlanArn"] || !enriched["VersionId"]) {
|
|
29560
|
+
const model = await this.readCcResourceModel(resourceType, physicalId, log);
|
|
29561
|
+
if (model) {
|
|
29562
|
+
if (!enriched["BackupPlanArn"] && typeof model["BackupPlanArn"] === "string") enriched["BackupPlanArn"] = model["BackupPlanArn"];
|
|
29563
|
+
if (!enriched["VersionId"] && typeof model["VersionId"] === "string") enriched["VersionId"] = model["VersionId"];
|
|
29564
|
+
if (!enriched["BackupPlanId"] && typeof model["BackupPlanId"] === "string") enriched["BackupPlanId"] = model["BackupPlanId"];
|
|
29565
|
+
log.debug(`Enriched Backup BackupPlan ${physicalId} with BackupPlanArn/VersionId from CC GetResource`);
|
|
29437
29566
|
}
|
|
29438
|
-
|
|
29439
|
-
|
|
29440
|
-
|
|
29441
|
-
|
|
29442
|
-
|
|
29443
|
-
|
|
29444
|
-
|
|
29445
|
-
|
|
29446
|
-
|
|
29447
|
-
if (!enriched["LastModifiedTime"] && typeof model["LastModifiedTime"] === "string") enriched["LastModifiedTime"] = model["LastModifiedTime"];
|
|
29448
|
-
log.debug(`Enriched Pipes Pipe ${physicalId} with Arn from CC GetResource`);
|
|
29449
|
-
}
|
|
29567
|
+
}
|
|
29568
|
+
if (!enriched["BackupPlanId"]) enriched["BackupPlanId"] = physicalId;
|
|
29569
|
+
break;
|
|
29570
|
+
case "AWS::Backup::BackupSelection":
|
|
29571
|
+
if (!enriched["SelectionId"] || !enriched["BackupPlanId"]) {
|
|
29572
|
+
const firstUnderscore = physicalId.indexOf("_");
|
|
29573
|
+
if (firstUnderscore > 0) {
|
|
29574
|
+
if (!enriched["SelectionId"]) enriched["SelectionId"] = physicalId.substring(0, firstUnderscore);
|
|
29575
|
+
if (!enriched["BackupPlanId"]) enriched["BackupPlanId"] = physicalId.substring(firstUnderscore + 1);
|
|
29450
29576
|
}
|
|
29451
|
-
|
|
29452
|
-
|
|
29453
|
-
|
|
29454
|
-
|
|
29455
|
-
|
|
29456
|
-
if (!enriched["Arn"] && typeof model["Arn"] === "string") enriched["Arn"] = model["Arn"];
|
|
29457
|
-
if (!enriched["Alias"] && typeof model["Alias"] === "string") enriched["Alias"] = model["Alias"];
|
|
29458
|
-
if (!enriched["NetworkOrigin"] && typeof model["NetworkOrigin"] === "string") enriched["NetworkOrigin"] = model["NetworkOrigin"];
|
|
29459
|
-
log.debug(`Enriched S3 AccessPoint ${physicalId} with Arn/Alias from CC GetResource`);
|
|
29460
|
-
}
|
|
29577
|
+
const model = await this.readCcResourceModel(resourceType, physicalId, log);
|
|
29578
|
+
if (model) {
|
|
29579
|
+
if (typeof model["SelectionId"] === "string") enriched["SelectionId"] = model["SelectionId"];
|
|
29580
|
+
if (typeof model["BackupPlanId"] === "string") enriched["BackupPlanId"] = model["BackupPlanId"];
|
|
29581
|
+
log.debug(`Enriched Backup BackupSelection ${physicalId} with SelectionId from CC GetResource`);
|
|
29461
29582
|
}
|
|
29462
|
-
|
|
29463
|
-
|
|
29583
|
+
}
|
|
29584
|
+
break;
|
|
29585
|
+
case "AWS::Pipes::Pipe":
|
|
29586
|
+
if (!enriched["Arn"]) {
|
|
29464
29587
|
const model = await this.readCcResourceModel(resourceType, physicalId, log);
|
|
29465
29588
|
if (model) {
|
|
29466
29589
|
if (typeof model["Arn"] === "string") enriched["Arn"] = model["Arn"];
|
|
29467
|
-
|
|
29590
|
+
if (!enriched["CurrentState"] && typeof model["CurrentState"] === "string") enriched["CurrentState"] = model["CurrentState"];
|
|
29591
|
+
if (!enriched["StateReason"] && typeof model["StateReason"] === "string") enriched["StateReason"] = model["StateReason"];
|
|
29592
|
+
if (!enriched["CreationTime"] && typeof model["CreationTime"] === "string") enriched["CreationTime"] = model["CreationTime"];
|
|
29593
|
+
if (!enriched["LastModifiedTime"] && typeof model["LastModifiedTime"] === "string") enriched["LastModifiedTime"] = model["LastModifiedTime"];
|
|
29594
|
+
log.debug(`Enriched Pipes Pipe ${physicalId} with Arn from CC GetResource`);
|
|
29595
|
+
}
|
|
29596
|
+
}
|
|
29597
|
+
break;
|
|
29598
|
+
case "AWS::S3::AccessPoint":
|
|
29599
|
+
if (!enriched["Arn"] || !enriched["Alias"]) {
|
|
29600
|
+
const model = await this.readCcResourceModel(resourceType, physicalId, log);
|
|
29601
|
+
if (model) {
|
|
29602
|
+
if (!enriched["Arn"] && typeof model["Arn"] === "string") enriched["Arn"] = model["Arn"];
|
|
29603
|
+
if (!enriched["Alias"] && typeof model["Alias"] === "string") enriched["Alias"] = model["Alias"];
|
|
29604
|
+
if (!enriched["NetworkOrigin"] && typeof model["NetworkOrigin"] === "string") enriched["NetworkOrigin"] = model["NetworkOrigin"];
|
|
29605
|
+
log.debug(`Enriched S3 AccessPoint ${physicalId} with Arn/Alias from CC GetResource`);
|
|
29468
29606
|
}
|
|
29469
29607
|
}
|
|
29608
|
+
break;
|
|
29609
|
+
case "AWS::ResourceGroups::Group": if (!enriched["Arn"]) {
|
|
29610
|
+
const model = await this.readCcResourceModel(resourceType, physicalId, log);
|
|
29611
|
+
if (model) {
|
|
29612
|
+
if (typeof model["Arn"] === "string") enriched["Arn"] = model["Arn"];
|
|
29613
|
+
log.debug(`Enriched ResourceGroups Group ${physicalId} with Arn from CC GetResource`);
|
|
29614
|
+
}
|
|
29470
29615
|
}
|
|
29471
|
-
return enriched;
|
|
29472
29616
|
}
|
|
29473
|
-
|
|
29474
|
-
|
|
29475
|
-
|
|
29476
|
-
|
|
29477
|
-
|
|
29617
|
+
return enriched;
|
|
29618
|
+
}
|
|
29619
|
+
|
|
29620
|
+
// src/provisioning/cc-import-identifier.ts
|
|
29621
|
+
const primaryIdentifierCache = /* @__PURE__ */ new Map();
|
|
29622
|
+
function getPrimaryIdentifierFields(resourceType) {
|
|
29623
|
+
if (hasNoRegistrySchema(resourceType)) return Promise.resolve(void 0);
|
|
29624
|
+
const cached = primaryIdentifierCache.get(resourceType);
|
|
29625
|
+
if (cached) return cached;
|
|
29626
|
+
const entry = fetchPrimaryIdentifierFields(resourceType).catch((error) => {
|
|
29627
|
+
primaryIdentifierCache.delete(resourceType);
|
|
29628
|
+
getLogger().child("CcImportIdentifier").debug(`Failed to resolve the primary identifier for ${displaySafe(resourceType, { asciiOnly: true })} via cloudformation:DescribeType (${describeAwsFailure(error).detail}); the import id is passed to Cloud Control unchanged.`);
|
|
29629
|
+
});
|
|
29630
|
+
primaryIdentifierCache.set(resourceType, entry);
|
|
29631
|
+
return entry;
|
|
29632
|
+
}
|
|
29633
|
+
async function fetchPrimaryIdentifierFields(resourceType) {
|
|
29634
|
+
const response = await describeTypeWithThrottleRetry(resourceType);
|
|
29635
|
+
if (!response.Schema) return void 0;
|
|
29636
|
+
const primary = JSON.parse(response.Schema).primaryIdentifier;
|
|
29637
|
+
if (!Array.isArray(primary) || primary.length === 0) return void 0;
|
|
29638
|
+
const fields = [];
|
|
29639
|
+
for (const pointer of primary) {
|
|
29640
|
+
if (typeof pointer !== "string") return void 0;
|
|
29641
|
+
const match = /^\/properties\/([^/]+)$/.exec(pointer);
|
|
29642
|
+
if (!match?.[1]) return void 0;
|
|
29643
|
+
fields.push(match[1].replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
29644
|
+
}
|
|
29645
|
+
return fields;
|
|
29646
|
+
}
|
|
29647
|
+
function toCloudControlIdentifier(input) {
|
|
29648
|
+
const { resourceType, logicalId, physicalId, properties, fields } = input;
|
|
29649
|
+
if (fields === void 0 || fields.length < 2) return physicalId;
|
|
29650
|
+
if (physicalId.split("|").length === fields.length) return physicalId;
|
|
29651
|
+
if (physicalId.trimStart().startsWith("{")) return physicalId;
|
|
29652
|
+
const safeType = displayIdent(resourceType);
|
|
29653
|
+
const safeLogicalId = displayIdent(logicalId);
|
|
29654
|
+
const showId = (value) => displayIdent(value, { maxCodePoints: SECRET_REF_MAX_CODE_POINTS });
|
|
29655
|
+
const safeId = showId(physicalId);
|
|
29656
|
+
const shape = fields.map((field) => `<${field}>`).join("|");
|
|
29657
|
+
const remedy = `Pass the Cloud Control identifier instead: --resource '${quotedRemedyLogicalId(logicalId)}=${shape}'.`;
|
|
29658
|
+
const refusalHead = `${refusalTypeShown(resourceType)} ` + (isPasteableIdent(logicalId) ? logicalId : "(logical id not shown: it is not a plain identifier)");
|
|
29659
|
+
const refusalId = isQuotableImportValue(physicalId) ? safeId : "the supplied id (not shown: it is not a plain identifier)";
|
|
29660
|
+
if (physicalId.includes("|")) throw new Error(`${refusalHead}: ${refusalId} has ${physicalId.split("|").length} '${"|"}'-separated segments, but Cloud Control identifies this type by ${fields.length} (${shape}). ${remedy}`);
|
|
29661
|
+
const values = fields.map((field) => {
|
|
29662
|
+
const value = Object.hasOwn(properties, field) ? properties[field] : void 0;
|
|
29663
|
+
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
29664
|
+
return typeof value === "string" && value.trim() !== "" ? value : void 0;
|
|
29665
|
+
});
|
|
29666
|
+
const missing = fields.filter((_, index) => values[index] === void 0);
|
|
29667
|
+
if (missing.length > 1) throw new Error(`${refusalHead}: Cloud Control identifies this type by ${shape}, and the template supplies no literal value for ${missing.join(" or ")}, so ${refusalId} cannot be placed. ${remedy}`);
|
|
29668
|
+
if (missing.length === 1 && values.includes(physicalId)) throw new Error(`${refusalHead}: ${refusalId} equals a value the template already gives another field of the identifier ${shape}, so it cannot be told which field it is. ${remedy}`);
|
|
29669
|
+
const completed = values.map((value) => value ?? physicalId);
|
|
29670
|
+
const refusal = compositeIdSeparatorRefusal(resourceType, logicalId, fields.map((name, index) => ({
|
|
29671
|
+
name,
|
|
29672
|
+
value: completed[index]
|
|
29673
|
+
})));
|
|
29674
|
+
if (refusal !== void 0) throw new Error(refusal);
|
|
29675
|
+
const identifier = completed.join("|");
|
|
29676
|
+
if (missing.length === 0 && !values.includes(physicalId)) getLogger().child("CcImportIdentifier").debug(`${safeType} ${safeLogicalId}: the template supplies every field of the Cloud Control identifier ${shape}, so ${showId(identifier)} is looked up and the supplied id ${safeId} is not used.`);
|
|
29677
|
+
getLogger().child("CcImportIdentifier").debug(`${safeType} ${safeLogicalId}: completed ${safeId} to the Cloud Control identifier ${showId(identifier)} (${shape}) from the template.`);
|
|
29678
|
+
return identifier;
|
|
29679
|
+
}
|
|
29680
|
+
|
|
29681
|
+
// src/provisioning/cloud-control/import.ts
|
|
29682
|
+
async function importImpl$1(input) {
|
|
29683
|
+
if (!input.knownPhysicalId) return null;
|
|
29684
|
+
const identifier = toCloudControlIdentifier({
|
|
29685
|
+
resourceType: input.resourceType,
|
|
29686
|
+
logicalId: input.logicalId,
|
|
29687
|
+
physicalId: input.knownPhysicalId,
|
|
29688
|
+
properties: input.properties,
|
|
29689
|
+
fields: await getPrimaryIdentifierFields(input.resourceType)
|
|
29690
|
+
});
|
|
29691
|
+
try {
|
|
29692
|
+
const resp = await this.cloudControlClient.send(new GetResourceCommand({
|
|
29693
|
+
TypeName: input.resourceType,
|
|
29694
|
+
Identifier: identifier
|
|
29695
|
+
}));
|
|
29696
|
+
const safeType = displaySafe(input.resourceType, { asciiOnly: true });
|
|
29697
|
+
const safeId = displaySafe(identifier, { asciiOnly: true });
|
|
29698
|
+
let parsedModel;
|
|
29699
|
+
const raw = resp.ResourceDescription?.Properties;
|
|
29700
|
+
if (typeof raw === "string" && raw.length > 0) try {
|
|
29701
|
+
const parsed = JSON.parse(raw);
|
|
29702
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) parsedModel = parsed;
|
|
29703
|
+
else {
|
|
29704
|
+
const shape = parsed === null ? "null" : Array.isArray(parsed) ? "an array" : typeof parsed;
|
|
29705
|
+
this.logger.warn(`CC API ResourceModel for ${safeType}/${safeId} parsed to ${shape}, not an object — this import yields no attributes for it. ` + IMPORT_YIELDED_NO_ATTRIBUTES_CONSEQUENCE);
|
|
29706
|
+
}
|
|
29707
|
+
} catch (parseErr) {
|
|
29708
|
+
this.logger.warn(`Failed to parse CC API ResourceModel for ${safeType}/${safeId}: ${parseErr instanceof Error ? parseErr.name : typeof parseErr}. This import yields no attributes for it. ` + IMPORT_YIELDED_NO_ATTRIBUTES_CONSEQUENCE);
|
|
29709
|
+
}
|
|
29478
29710
|
return {
|
|
29479
|
-
|
|
29480
|
-
|
|
29711
|
+
physicalId: identifier,
|
|
29712
|
+
attributes: parsedModel === void 0 ? {} : await this.maskUncertifiedModelValues(parsedModel, input.resourceType, identifier)
|
|
29481
29713
|
};
|
|
29714
|
+
} catch (error) {
|
|
29715
|
+
if (error.name === "ResourceNotFoundException") return null;
|
|
29716
|
+
throw error;
|
|
29717
|
+
}
|
|
29718
|
+
}
|
|
29719
|
+
async function maskUncertifiedModelValues(model, resourceType, physicalId) {
|
|
29720
|
+
const safeType = displaySafe(resourceType, { asciiOnly: true });
|
|
29721
|
+
const safeId = displaySafe(physicalId, { asciiOnly: true });
|
|
29722
|
+
const attributeNames = await getTopLevelAttributeNames(resourceType);
|
|
29723
|
+
if (attributeNames === void 0) {
|
|
29724
|
+
if (!this.warnedUnresolvableSchemaTypes.has(resourceType)) {
|
|
29725
|
+
this.warnedUnresolvableSchemaTypes.add(resourceType);
|
|
29726
|
+
this.logger.warn(`Could not resolve the CloudFormation schema for ${safeType}, so cdkd cannot tell which of its Cloud Control model keys are Fn::GetAtt attributes. Every imported attribute for this type is recorded as "${"***"}" rather than risking a credential in state.json; an Fn::GetAtt against such a resource fails with a named refusal until that resource is next created or updated by a deploy. Grant cloudformation:DescribeType and re-import to record its attributes.`);
|
|
29727
|
+
}
|
|
29728
|
+
}
|
|
29729
|
+
const masked = Object.create(null);
|
|
29730
|
+
let maskedCount = 0;
|
|
29731
|
+
for (const [key, value] of Object.entries(model)) if (attributeNames?.has(key)) masked[key] = value;
|
|
29732
|
+
else {
|
|
29733
|
+
masked[key] = maskLeavesDeep(value);
|
|
29734
|
+
maskedCount++;
|
|
29735
|
+
}
|
|
29736
|
+
if (maskedCount > 0 && attributeNames !== void 0) this.logger.debug(`Masked ${maskedCount} non-attribute key(s) out of the ${safeType} Cloud Control model for ${safeId}: they are not Fn::GetAtt attributes of the type, so CloudFormation would reject an Fn::GetAtt naming them and cdkd has no evidence they are safe to persist.`);
|
|
29737
|
+
return masked;
|
|
29738
|
+
}
|
|
29739
|
+
|
|
29740
|
+
// src/provisioning/cloud-control-provider.ts
|
|
29741
|
+
var CloudControlProvider = class {
|
|
29742
|
+
cloudControlClient;
|
|
29743
|
+
baseLogger = getLogger().child("CloudControlProvider");
|
|
29744
|
+
get logger() {
|
|
29745
|
+
return idLogScope.getStore() ?? this.baseLogger;
|
|
29746
|
+
}
|
|
29747
|
+
patchGenerator = new JsonPatchGenerator();
|
|
29748
|
+
warnedUnresolvableSchemaTypes = /* @__PURE__ */ new Set();
|
|
29749
|
+
protectionFlips = new ProtectionFlipRegistry();
|
|
29750
|
+
MAX_WAIT_TIME_MS = 9e5;
|
|
29751
|
+
INITIAL_POLL_INTERVAL_MS = 1e3;
|
|
29752
|
+
MAX_POLL_INTERVAL_MS = 1e4;
|
|
29753
|
+
POLL_TRANSIENT_GRACE_MS = 12e4;
|
|
29754
|
+
PROTECTION_FLIP_TRANSIENT_GRACE_MS = 1e4;
|
|
29755
|
+
sdkDeleteDelegates = /* @__PURE__ */ new Map();
|
|
29756
|
+
asgDeleteDelegates = /* @__PURE__ */ new Map();
|
|
29757
|
+
constructor() {
|
|
29758
|
+
const awsClients = getAwsClients();
|
|
29759
|
+
this.cloudControlClient = awsClients.cloudControl;
|
|
29760
|
+
}
|
|
29761
|
+
create(logicalId, resourceType, properties, context) {
|
|
29762
|
+
return create$2.call(this, logicalId, resourceType, properties, context);
|
|
29763
|
+
}
|
|
29764
|
+
createInIdLogScope(logicalId, resourceType, properties, idLog, mask) {
|
|
29765
|
+
return createInIdLogScope.call(this, logicalId, resourceType, properties, idLog, mask);
|
|
29766
|
+
}
|
|
29767
|
+
cleanupFailedCreateRemnant(error, resourceType, logicalId, mask) {
|
|
29768
|
+
return cleanupFailedCreateRemnant.call(this, error, resourceType, logicalId, mask);
|
|
29769
|
+
}
|
|
29770
|
+
update(logicalId, physicalId, resourceType, properties, previousProperties, context) {
|
|
29771
|
+
return update$2.call(this, logicalId, physicalId, resourceType, properties, previousProperties, context);
|
|
29772
|
+
}
|
|
29773
|
+
updateInIdLogScope(logicalId, physicalId, resourceType, properties, previousProperties, context, idLog) {
|
|
29774
|
+
return updateInIdLogScope.call(this, logicalId, physicalId, resourceType, properties, previousProperties, context, idLog);
|
|
29775
|
+
}
|
|
29776
|
+
reimportApiGatewayV2(logicalId, physicalId, resourceType, reimport) {
|
|
29777
|
+
return reimportApiGatewayV2.call(this, logicalId, physicalId, resourceType, reimport);
|
|
29778
|
+
}
|
|
29779
|
+
readApiGatewayV2DefinitionObject(logicalId, physicalId, resourceType, location) {
|
|
29780
|
+
return readApiGatewayV2DefinitionObject.call(this, logicalId, physicalId, resourceType, location);
|
|
29781
|
+
}
|
|
29782
|
+
delete(logicalId, physicalId, resourceType, properties, context) {
|
|
29783
|
+
return deleteImpl$1.call(this, logicalId, physicalId, resourceType, properties, context);
|
|
29784
|
+
}
|
|
29785
|
+
deleteInIdLogScope(logicalId, physicalId, resourceType, properties, context) {
|
|
29786
|
+
return deleteInIdLogScope.call(this, logicalId, physicalId, resourceType, properties, context);
|
|
29787
|
+
}
|
|
29788
|
+
deleteThroughCloudControl(logicalId, physicalId, resourceType, context, indeterminateGuard, flip, protectedEc2) {
|
|
29789
|
+
return deleteThroughCloudControl.call(this, logicalId, physicalId, resourceType, context, indeterminateGuard, flip, protectedEc2);
|
|
29790
|
+
}
|
|
29791
|
+
sdkDeleteDelegateInCcRegion(resourceType, logicalId, physicalId) {
|
|
29792
|
+
return sdkDeleteDelegateInCcRegion.call(this, resourceType, logicalId, physicalId);
|
|
29793
|
+
}
|
|
29794
|
+
ec2ClientInCcRegion(resourceType, logicalId, physicalId) {
|
|
29795
|
+
return ec2ClientInCcRegion.call(this, resourceType, logicalId, physicalId);
|
|
29796
|
+
}
|
|
29797
|
+
assertRecordedRegionAgainstClient(phase, expectedRegion, resourceType, logicalId, physicalId) {
|
|
29798
|
+
return assertRecordedRegionAgainstClient.call(this, phase, expectedRegion, resourceType, logicalId, physicalId);
|
|
29799
|
+
}
|
|
29800
|
+
confirmDeleteTargetIdentity(logicalId, resourceType, physicalId, context) {
|
|
29801
|
+
return confirmDeleteTargetIdentity.call(this, logicalId, resourceType, physicalId, context);
|
|
29802
|
+
}
|
|
29803
|
+
disableCcProtection(logicalId, physicalId, resourceType, entry) {
|
|
29804
|
+
return disableCcProtection.call(this, logicalId, physicalId, resourceType, entry);
|
|
29805
|
+
}
|
|
29806
|
+
observeThenDisableCcProtection(logicalId, physicalId, resourceType, entry, flip, mask) {
|
|
29807
|
+
return observeThenDisableCcProtection.call(this, logicalId, physicalId, resourceType, entry, flip, mask);
|
|
29808
|
+
}
|
|
29809
|
+
reEnableCcProtection(logicalId, physicalId, resourceType, entry) {
|
|
29810
|
+
return reEnableCcProtection.call(this, logicalId, physicalId, resourceType, entry);
|
|
29811
|
+
}
|
|
29812
|
+
warnGuardLeftOff(flip, error, site, logicalId, physicalId) {
|
|
29813
|
+
return warnGuardLeftOff.call(this, flip, error, site, logicalId, physicalId);
|
|
29814
|
+
}
|
|
29815
|
+
ccClientRegion() {
|
|
29816
|
+
return ccClientRegion.call(this);
|
|
29817
|
+
}
|
|
29818
|
+
getResourceState(resourceType, physicalId) {
|
|
29819
|
+
return getResourceState.call(this, resourceType, physicalId);
|
|
29820
|
+
}
|
|
29821
|
+
waitForOperation(requestToken, logicalId, operation, resourceType, transientGraceMs = this.POLL_TRANSIENT_GRACE_MS) {
|
|
29822
|
+
return waitForOperation.call(this, requestToken, logicalId, operation, resourceType, transientGraceMs);
|
|
29823
|
+
}
|
|
29824
|
+
resumeCreatedResource(logicalId, resourceType, identifier, properties, context) {
|
|
29825
|
+
return resumeCreatedResource.call(this, logicalId, resourceType, identifier, properties, context);
|
|
29826
|
+
}
|
|
29827
|
+
resumeAbandonedRequest(requestToken, logicalId, resourceType) {
|
|
29828
|
+
return resumeAbandonedRequest.call(this, requestToken, logicalId, resourceType);
|
|
29829
|
+
}
|
|
29830
|
+
abandonWait(requestToken, logicalId, operation, resourceType, lastSeenIdentifier, reason, cause) {
|
|
29831
|
+
return abandonWait.call(this, requestToken, logicalId, operation, resourceType, lastSeenIdentifier, reason, cause);
|
|
29832
|
+
}
|
|
29833
|
+
buildResumeCommand(requestToken) {
|
|
29834
|
+
return buildResumeCommand.call(this, requestToken);
|
|
29835
|
+
}
|
|
29836
|
+
parseResourceModel(resourceModel, log = this.logger) {
|
|
29837
|
+
return parseResourceModel.call(this, resourceModel, log);
|
|
29838
|
+
}
|
|
29839
|
+
accountInfoForSynthesizedArn(resourceType, attributeName, physicalId, log = this.logger) {
|
|
29840
|
+
return accountInfoForSynthesizedArn.call(this, resourceType, attributeName, physicalId, log);
|
|
29841
|
+
}
|
|
29842
|
+
enrichResourceAttributes(resourceType, physicalId, attributes, log = this.logger) {
|
|
29843
|
+
return enrichResourceAttributes.call(this, resourceType, physicalId, attributes, log);
|
|
29844
|
+
}
|
|
29845
|
+
mergeSparseModelReadback(resourceType, physicalId, attributes, log = this.logger) {
|
|
29846
|
+
return mergeSparseModelReadback.call(this, resourceType, physicalId, attributes, log);
|
|
29482
29847
|
}
|
|
29483
29848
|
isSparseAttributeMap(attributes, physicalId) {
|
|
29484
|
-
|
|
29485
|
-
if (values.length === 0) return true;
|
|
29486
|
-
const identifierEchoes = new Set(physicalId.split("|"));
|
|
29487
|
-
identifierEchoes.add(physicalId);
|
|
29488
|
-
return values.every((value) => typeof value === "string" && identifierEchoes.has(value));
|
|
29849
|
+
return isSparseAttributeMap.call(this, attributes, physicalId);
|
|
29489
29850
|
}
|
|
29490
|
-
|
|
29491
|
-
|
|
29492
|
-
const raw = (await this.cloudControlClient.send(new GetResourceCommand({
|
|
29493
|
-
TypeName: resourceType,
|
|
29494
|
-
Identifier: physicalId
|
|
29495
|
-
}))).ResourceDescription?.Properties;
|
|
29496
|
-
if (typeof raw !== "string" || raw.length === 0) return;
|
|
29497
|
-
let parsed;
|
|
29498
|
-
try {
|
|
29499
|
-
parsed = JSON.parse(raw);
|
|
29500
|
-
} catch (parseError) {
|
|
29501
|
-
const detail = log.withheld === true ? describeJsonParseFailure(parseError, utf8ByteLength(raw)) : displaySafe(describeAwsFailure(parseError).detail);
|
|
29502
|
-
log.debug(`Failed to read CC model for ${resourceType} ${physicalId}: ${detail}`);
|
|
29503
|
-
return;
|
|
29504
|
-
}
|
|
29505
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return;
|
|
29506
|
-
return parsed;
|
|
29507
|
-
} catch (error) {
|
|
29508
|
-
log.debug(`Failed to read CC model for ${resourceType} ${physicalId}: ${describeAwsFailure(error).detail}`);
|
|
29509
|
-
return;
|
|
29510
|
-
}
|
|
29851
|
+
readCcResourceModel(resourceType, physicalId, log = this.logger) {
|
|
29852
|
+
return readCcResourceModel.call(this, resourceType, physicalId, log);
|
|
29511
29853
|
}
|
|
29512
29854
|
handleError(error, operation, resourceType, logicalId, physicalId) {
|
|
29513
|
-
|
|
29514
|
-
const rawMessage = err.message || "Unknown error";
|
|
29515
|
-
const awsMessage = maskCallerIdentity(rawMessage);
|
|
29516
|
-
if (!(error instanceof ProvisioningError) && awsMessage !== rawMessage) this.logger.debug(`${operation} ${logicalId}: AWS error before caller-identity masking: ${displaySafe(rawMessage)}`);
|
|
29517
|
-
if (err.name === "UnsupportedActionException" || err.name === "TypeNotFoundException") throw new ProvisioningError(`Resource type ${resourceType} is not supported by Cloud Control API and no SDK provider is registered.\nPlease report this issue at https://github.com/go-to-k/cdkd/issues so we can add SDK provider support.\nError: ${awsMessage}`, resourceType, logicalId, physicalId, error instanceof Error ? error : void 0);
|
|
29518
|
-
if (error instanceof ProvisioningError) throw error;
|
|
29519
|
-
throw new ProvisioningError(`${operation} failed for ${logicalId}: ${awsMessage}`, resourceType, logicalId, physicalId, error instanceof Error ? error : void 0);
|
|
29855
|
+
return handleError.call(this, error, operation, resourceType, logicalId, physicalId);
|
|
29520
29856
|
}
|
|
29521
29857
|
sleep(ms) {
|
|
29522
|
-
return
|
|
29858
|
+
return sleep$1.call(this, ms);
|
|
29523
29859
|
}
|
|
29524
29860
|
static isSupportedResourceType(resourceType) {
|
|
29525
29861
|
if ((/* @__PURE__ */ new Set([
|
|
@@ -29542,215 +29878,19 @@ var CloudControlProvider = class {
|
|
|
29542
29878
|
if (isNonProvisionable(resourceType)) return false;
|
|
29543
29879
|
return resourceType.startsWith("AWS::");
|
|
29544
29880
|
}
|
|
29545
|
-
|
|
29546
|
-
|
|
29547
|
-
const raw = (await this.cloudControlClient.send(new GetResourceCommand({
|
|
29548
|
-
TypeName: resourceType,
|
|
29549
|
-
Identifier: physicalId
|
|
29550
|
-
}))).ResourceDescription?.Properties;
|
|
29551
|
-
if (typeof raw !== "string" || raw.length === 0) return;
|
|
29552
|
-
let parsed;
|
|
29553
|
-
try {
|
|
29554
|
-
parsed = JSON.parse(raw);
|
|
29555
|
-
} catch (parseError) {
|
|
29556
|
-
this.logger.debug(safeMsg`Cloud Control resource model for ${displayIdent(resourceType)} failed to parse: ${parseFailureDebugDetail(parseError)}`);
|
|
29557
|
-
throw new SyntaxError(`Cloud Control returned a resource model for ${displayIdent(resourceType)} that is not valid JSON: ${describeJsonParseFailure(parseError, utf8ByteLength(raw))}`);
|
|
29558
|
-
}
|
|
29559
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return;
|
|
29560
|
-
return parsed;
|
|
29561
|
-
} catch (error) {
|
|
29562
|
-
if (error.name === "ResourceNotFoundException") return RESOURCE_NOT_FOUND;
|
|
29563
|
-
throw error;
|
|
29564
|
-
}
|
|
29565
|
-
}
|
|
29566
|
-
async maskDeployedNonAttributeKeys(attributes, modelKeys, resourceType, physicalId, attributeNamesLookup, desired, mask, log = this.logger) {
|
|
29567
|
-
const safeType = displaySafe(resourceType, { asciiOnly: true });
|
|
29568
|
-
const attributeNames = await attributeNamesLookup;
|
|
29569
|
-
if (attributeNames === void 0) {
|
|
29570
|
-
log.debug(`Could not resolve the CloudFormation schema for ${safeType}; recording its Cloud Control model unnarrowed for ${displaySafe(physicalId, { asciiOnly: true })}.`);
|
|
29571
|
-
return attributes;
|
|
29572
|
-
}
|
|
29573
|
-
const narrowed = new Set(modelKeys.filter((key) => !attributeNames.has(key) && !isLiteralDeployOnlyKey(resourceType, key, desired, mask)));
|
|
29574
|
-
if (narrowed.size === 0) return attributes;
|
|
29575
|
-
const out = Object.create(null);
|
|
29576
|
-
for (const [key, value] of Object.entries(attributes)) Object.defineProperty(out, key, {
|
|
29577
|
-
value: narrowed.has(key) ? maskLeavesDeep(value) : value,
|
|
29578
|
-
enumerable: true,
|
|
29579
|
-
writable: true,
|
|
29580
|
-
configurable: true
|
|
29581
|
-
});
|
|
29582
|
-
log.debug(`Masked ${narrowed.size} non-attribute key(s) of the ${safeType} Cloud Control model for ${displaySafe(physicalId, { asciiOnly: true })}: they are not Fn::GetAtt attributes of the type.`);
|
|
29583
|
-
return out;
|
|
29584
|
-
}
|
|
29585
|
-
async import(input) {
|
|
29586
|
-
if (!input.knownPhysicalId) return null;
|
|
29587
|
-
const identifier = toCloudControlIdentifier({
|
|
29588
|
-
resourceType: input.resourceType,
|
|
29589
|
-
logicalId: input.logicalId,
|
|
29590
|
-
physicalId: input.knownPhysicalId,
|
|
29591
|
-
properties: input.properties,
|
|
29592
|
-
fields: await getPrimaryIdentifierFields(input.resourceType)
|
|
29593
|
-
});
|
|
29594
|
-
try {
|
|
29595
|
-
const resp = await this.cloudControlClient.send(new GetResourceCommand({
|
|
29596
|
-
TypeName: input.resourceType,
|
|
29597
|
-
Identifier: identifier
|
|
29598
|
-
}));
|
|
29599
|
-
const safeType = displaySafe(input.resourceType, { asciiOnly: true });
|
|
29600
|
-
const safeId = displaySafe(identifier, { asciiOnly: true });
|
|
29601
|
-
let parsedModel;
|
|
29602
|
-
const raw = resp.ResourceDescription?.Properties;
|
|
29603
|
-
if (typeof raw === "string" && raw.length > 0) try {
|
|
29604
|
-
const parsed = JSON.parse(raw);
|
|
29605
|
-
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) parsedModel = parsed;
|
|
29606
|
-
else {
|
|
29607
|
-
const shape = parsed === null ? "null" : Array.isArray(parsed) ? "an array" : typeof parsed;
|
|
29608
|
-
this.logger.warn(`CC API ResourceModel for ${safeType}/${safeId} parsed to ${shape}, not an object — this import yields no attributes for it. ` + IMPORT_YIELDED_NO_ATTRIBUTES_CONSEQUENCE);
|
|
29609
|
-
}
|
|
29610
|
-
} catch (parseErr) {
|
|
29611
|
-
this.logger.warn(`Failed to parse CC API ResourceModel for ${safeType}/${safeId}: ${parseErr instanceof Error ? parseErr.name : typeof parseErr}. This import yields no attributes for it. ` + IMPORT_YIELDED_NO_ATTRIBUTES_CONSEQUENCE);
|
|
29612
|
-
}
|
|
29613
|
-
return {
|
|
29614
|
-
physicalId: identifier,
|
|
29615
|
-
attributes: parsedModel === void 0 ? {} : await this.maskUncertifiedModelValues(parsedModel, input.resourceType, identifier)
|
|
29616
|
-
};
|
|
29617
|
-
} catch (error) {
|
|
29618
|
-
if (error.name === "ResourceNotFoundException") return null;
|
|
29619
|
-
throw error;
|
|
29620
|
-
}
|
|
29621
|
-
}
|
|
29622
|
-
async maskUncertifiedModelValues(model, resourceType, physicalId) {
|
|
29623
|
-
const safeType = displaySafe(resourceType, { asciiOnly: true });
|
|
29624
|
-
const safeId = displaySafe(physicalId, { asciiOnly: true });
|
|
29625
|
-
const attributeNames = await getTopLevelAttributeNames(resourceType);
|
|
29626
|
-
if (attributeNames === void 0) {
|
|
29627
|
-
if (!this.warnedUnresolvableSchemaTypes.has(resourceType)) {
|
|
29628
|
-
this.warnedUnresolvableSchemaTypes.add(resourceType);
|
|
29629
|
-
this.logger.warn(`Could not resolve the CloudFormation schema for ${safeType}, so cdkd cannot tell which of its Cloud Control model keys are Fn::GetAtt attributes. Every imported attribute for this type is recorded as "${"***"}" rather than risking a credential in state.json; an Fn::GetAtt against such a resource fails with a named refusal until that resource is next created or updated by a deploy. Grant cloudformation:DescribeType and re-import to record its attributes.`);
|
|
29630
|
-
}
|
|
29631
|
-
}
|
|
29632
|
-
const masked = Object.create(null);
|
|
29633
|
-
let maskedCount = 0;
|
|
29634
|
-
for (const [key, value] of Object.entries(model)) if (attributeNames?.has(key)) masked[key] = value;
|
|
29635
|
-
else {
|
|
29636
|
-
masked[key] = maskLeavesDeep(value);
|
|
29637
|
-
maskedCount++;
|
|
29638
|
-
}
|
|
29639
|
-
if (maskedCount > 0 && attributeNames !== void 0) this.logger.debug(`Masked ${maskedCount} non-attribute key(s) out of the ${safeType} Cloud Control model for ${safeId}: they are not Fn::GetAtt attributes of the type, so CloudFormation would reject an Fn::GetAtt naming them and cdkd has no evidence they are safe to persist.`);
|
|
29640
|
-
return masked;
|
|
29641
|
-
}
|
|
29642
|
-
};
|
|
29643
|
-
var IdScrubLog = class {
|
|
29644
|
-
needles = [];
|
|
29645
|
-
base;
|
|
29646
|
-
mask;
|
|
29647
|
-
evidence;
|
|
29648
|
-
constructor(base, mask, evidence) {
|
|
29649
|
-
this.base = base;
|
|
29650
|
-
this.mask = mask;
|
|
29651
|
-
this.evidence = evidence;
|
|
29652
|
-
}
|
|
29653
|
-
get withheld() {
|
|
29654
|
-
return this.needles.length > 0;
|
|
29655
|
-
}
|
|
29656
|
-
addId(id) {
|
|
29657
|
-
if (!this.evidence || id === void 0 || id === "") return;
|
|
29658
|
-
const parts = [id, ...id.split("|")].filter((needle) => needle !== "");
|
|
29659
|
-
const raw = [...new Set(parts.flatMap((part) => [
|
|
29660
|
-
part,
|
|
29661
|
-
displaySafe(part),
|
|
29662
|
-
displaySafe(part, { asciiOnly: true })
|
|
29663
|
-
]))].filter((needle) => needle !== "" && needle !== "***");
|
|
29664
|
-
const masked = raw.map((needle) => this.mask(needle));
|
|
29665
|
-
this.needles = [.../* @__PURE__ */ new Set([
|
|
29666
|
-
...this.needles,
|
|
29667
|
-
...raw,
|
|
29668
|
-
...masked.filter((m, i) => m !== "" && m !== raw[i] && m !== "***")
|
|
29669
|
-
])].sort((a, b) => b.length - a.length);
|
|
29670
|
-
}
|
|
29671
|
-
scrub = (text) => maskMatchSpans(this.mask(text), this.needles, "***");
|
|
29672
|
-
scrubKeepingResume(text, requestTokens) {
|
|
29673
|
-
const tokens = requestTokens.filter((token) => token !== "");
|
|
29674
|
-
if (tokens.length === 0) return this.scrub(text);
|
|
29675
|
-
const keep = new RegExp(`(${[RESUME_COMMAND.source, ...tokens.map(escapeRegExp)].join("|")})`);
|
|
29676
|
-
return text.split(keep).map((segment, i) => i % 2 === 1 ? this.mask(segment) : this.scrub(segment)).join("");
|
|
29881
|
+
readCurrentState(physicalId, _logicalId, resourceType, _properties) {
|
|
29882
|
+
return readCurrentState$1.call(this, physicalId, _logicalId, resourceType, _properties);
|
|
29677
29883
|
}
|
|
29678
|
-
|
|
29679
|
-
|
|
29680
|
-
const original = errorCauseChain(error);
|
|
29681
|
-
const tokens = abandonedRequestTokens(error);
|
|
29682
|
-
const scrubbed = maskSecretsInError(error, /* @__PURE__ */ new Map(), (text) => this.scrubKeepingResume(text, tokens));
|
|
29683
|
-
const clones = errorCauseChain(scrubbed);
|
|
29684
|
-
original.forEach((link, i) => {
|
|
29685
|
-
const clone = clones[i];
|
|
29686
|
-
if (clone === void 0 || clone === link) return;
|
|
29687
|
-
for (const key of VERBATIM_ERROR_FIELDS) {
|
|
29688
|
-
const descriptor = Object.getOwnPropertyDescriptor(link, key);
|
|
29689
|
-
if (descriptor === void 0 || typeof descriptor.value !== "string") continue;
|
|
29690
|
-
try {
|
|
29691
|
-
Object.defineProperty(clone, key, descriptor);
|
|
29692
|
-
} catch {}
|
|
29693
|
-
}
|
|
29694
|
-
});
|
|
29695
|
-
return scrubbed;
|
|
29696
|
-
}
|
|
29697
|
-
warnKeepingResume(message, requestTokens) {
|
|
29698
|
-
this.base.warn(this.scrubKeepingResume(message, requestTokens));
|
|
29699
|
-
}
|
|
29700
|
-
debug(message) {
|
|
29701
|
-
this.base.debug(this.scrub(message));
|
|
29884
|
+
maskDeployedNonAttributeKeys(attributes, modelKeys, resourceType, physicalId, attributeNamesLookup, desired, mask, log = this.logger) {
|
|
29885
|
+
return maskDeployedNonAttributeKeys.call(this, attributes, modelKeys, resourceType, physicalId, attributeNamesLookup, desired, mask, log);
|
|
29702
29886
|
}
|
|
29703
|
-
|
|
29704
|
-
|
|
29705
|
-
}
|
|
29706
|
-
warn(message) {
|
|
29707
|
-
this.base.warn(this.scrub(message));
|
|
29887
|
+
import(input) {
|
|
29888
|
+
return importImpl$1.call(this, input);
|
|
29708
29889
|
}
|
|
29709
|
-
|
|
29710
|
-
|
|
29890
|
+
maskUncertifiedModelValues(model, resourceType, physicalId) {
|
|
29891
|
+
return maskUncertifiedModelValues.call(this, model, resourceType, physicalId);
|
|
29711
29892
|
}
|
|
29712
29893
|
};
|
|
29713
|
-
const VERBATIM_ERROR_FIELDS = ["logicalId", "resourceType"];
|
|
29714
|
-
function escapeRegExp(text) {
|
|
29715
|
-
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
29716
|
-
}
|
|
29717
|
-
const RESUME_COMMAND = /aws(?: --profile (?:'(?:[^'\n]|'\\'')*'|\S+))? cloudcontrol get-resource-request-status --request-token \S+(?: --region \S+)?/;
|
|
29718
|
-
function abandonedRequestTokens(error) {
|
|
29719
|
-
return error instanceof Error ? errorCauseChain(error).flatMap((link) => link instanceof CloudControlWaitAbandonedError ? [link.requestToken] : []) : [];
|
|
29720
|
-
}
|
|
29721
|
-
const idLogScope = new AsyncLocalStorage();
|
|
29722
|
-
async function inIdLogScope(idLog, fn) {
|
|
29723
|
-
try {
|
|
29724
|
-
return await idLogScope.run(idLog, fn);
|
|
29725
|
-
} catch (error) {
|
|
29726
|
-
throw idLog.scrubError(error);
|
|
29727
|
-
}
|
|
29728
|
-
}
|
|
29729
|
-
function identifierCarriedBy(error) {
|
|
29730
|
-
return error instanceof ProvisioningError ? error.physicalId : void 0;
|
|
29731
|
-
}
|
|
29732
|
-
function holdsSecretDerivedLeaf(value, mask, depth = 0) {
|
|
29733
|
-
if (typeof value === "string") return isSecretDerivedValue(value, mask);
|
|
29734
|
-
if (value === null || typeof value !== "object") return false;
|
|
29735
|
-
if (depth > 64) return true;
|
|
29736
|
-
if (Array.isArray(value)) return value.some((entry) => holdsSecretDerivedLeaf(entry, mask, depth + 1));
|
|
29737
|
-
return Object.entries(value).some(([key, entry]) => isSecretDerivedValue(key, mask) || holdsSecretDerivedLeaf(entry, mask, depth + 1));
|
|
29738
|
-
}
|
|
29739
|
-
const IMPORT_YIELDED_NO_ATTRIBUTES_CONSEQUENCE = "Attributes the stack's state already records for this physical id are kept; without them, an Fn::GetAtt against this resource falls back to a value constructed from its physical id.";
|
|
29740
|
-
function isLiteralDeployOnlyKey(resourceType, key, desired, mask) {
|
|
29741
|
-
if (resourceType !== "AWS::SSM::Parameter" || key !== "Value") return false;
|
|
29742
|
-
const declared = desired["Value"];
|
|
29743
|
-
return typeof declared === "string" && !isSecretDerivedValue(declared, mask);
|
|
29744
|
-
}
|
|
29745
|
-
function maskLeavesDeep(value) {
|
|
29746
|
-
if (Array.isArray(value)) return value.map((element) => maskLeavesDeep(element));
|
|
29747
|
-
if (value !== null && typeof value === "object") {
|
|
29748
|
-
const out = Object.create(null);
|
|
29749
|
-
for (const [key, nested] of Object.entries(value)) out[key] = maskLeavesDeep(nested);
|
|
29750
|
-
return out;
|
|
29751
|
-
}
|
|
29752
|
-
return "***";
|
|
29753
|
-
}
|
|
29754
29894
|
|
|
29755
29895
|
// src/provisioning/providers/custom-resource/lambda-payload.ts
|
|
29756
29896
|
function isCustomResourceResponsePayload(value) {
|
|
@@ -30817,9 +30957,16 @@ function customResourceS3Endpoint(env = process.env) {
|
|
|
30817
30957
|
if (parsed.search !== "" || parsed.hash !== "") refuse("must not carry a query or fragment");
|
|
30818
30958
|
return {
|
|
30819
30959
|
url: value,
|
|
30820
|
-
origin: parsed.origin
|
|
30960
|
+
origin: parsed.origin,
|
|
30961
|
+
httpsOnDefaultPort: parsed.protocol === "https:" && parsed.port === ""
|
|
30821
30962
|
};
|
|
30822
30963
|
}
|
|
30964
|
+
let warnedNodeHandlersCannotRespond = false;
|
|
30965
|
+
function warnIfNodeHandlersCannotRespond(endpoint, logger) {
|
|
30966
|
+
if (endpoint.httpsOnDefaultPort || warnedNodeHandlersCannotRespond) return;
|
|
30967
|
+
warnedNodeHandlersCannotRespond = true;
|
|
30968
|
+
logger.warn(safeMsg`${CR_S3_ENDPOINT_ENV} (${endpoint.origin}) is not https on port 443. ` + "CDK's Node.js custom-resource handlers (e.g. S3 autoDeleteObjects, AwsCustomResource, the Provider framework) send their response to https on port 443 whatever the ResponseURL's scheme and port, so they cannot respond to this endpoint and the custom resource waits until it times out. Serve the emulator's S3 over TLS on port 443 (e.g. behind a TLS-terminating proxy), with a certificate the Lambda runtime trusts, " + safeMsg`and set ${CR_S3_ENDPOINT_ENV}=https://<host>. ` + `Python cfnresponse handlers are unaffected.`);
|
|
30969
|
+
}
|
|
30823
30970
|
const presignClients = /* @__PURE__ */ new WeakMap();
|
|
30824
30971
|
function responsePresignClient(base, endpoint) {
|
|
30825
30972
|
const cached = presignClients.get(base);
|
|
@@ -31091,6 +31238,7 @@ async function generateResponseURL(responseKey, logicalId, watch, mask) {
|
|
|
31091
31238
|
let signer = this.s3Client;
|
|
31092
31239
|
if (signingEndpoint !== void 0) {
|
|
31093
31240
|
signer = await responsePresignClient(this.s3Client, signingEndpoint);
|
|
31241
|
+
warnIfNodeHandlersCannotRespond(signingEndpoint, this.logger);
|
|
31094
31242
|
this.logger.debug(safeMsg`Signing the custom resource ResponseURL for ${CR_S3_ENDPOINT_ENV} (${signingEndpoint.origin})`);
|
|
31095
31243
|
}
|
|
31096
31244
|
const presignedUrl = await getSignedUrl(signer, command, { expiresIn: 7200 });
|
|
@@ -33756,18 +33904,55 @@ function isCustomResource(resourceType) {
|
|
|
33756
33904
|
return resourceType.startsWith("Custom::") || resourceType === "AWS::CloudFormation::CustomResource";
|
|
33757
33905
|
}
|
|
33758
33906
|
|
|
33759
|
-
// src/provisioning/
|
|
33760
|
-
|
|
33761
|
-
|
|
33762
|
-
|
|
33763
|
-
|
|
33764
|
-
|
|
33765
|
-
|
|
33766
|
-
|
|
33907
|
+
// src/provisioning/delete-started.ts
|
|
33908
|
+
const DELETE_STARTED = Symbol.for("cdkd.deleteStarted");
|
|
33909
|
+
const MAX_DEPTH = 10;
|
|
33910
|
+
function markDeleteStarted(error) {
|
|
33911
|
+
try {
|
|
33912
|
+
if (typeof error !== "object" || error === null || !Object.isExtensible(error)) return error;
|
|
33913
|
+
Object.defineProperty(error, DELETE_STARTED, {
|
|
33914
|
+
value: true,
|
|
33915
|
+
enumerable: false,
|
|
33916
|
+
writable: false,
|
|
33917
|
+
configurable: true
|
|
33918
|
+
});
|
|
33919
|
+
} catch {}
|
|
33920
|
+
return error;
|
|
33767
33921
|
}
|
|
33768
|
-
function
|
|
33769
|
-
|
|
33770
|
-
|
|
33922
|
+
function isDeleteStarted(error) {
|
|
33923
|
+
try {
|
|
33924
|
+
let current = error;
|
|
33925
|
+
for (let depth = 0; depth < MAX_DEPTH && typeof current === "object" && current !== null; depth++) {
|
|
33926
|
+
if (current[DELETE_STARTED] === true) return true;
|
|
33927
|
+
current = current.cause;
|
|
33928
|
+
}
|
|
33929
|
+
} catch {}
|
|
33930
|
+
return false;
|
|
33931
|
+
}
|
|
33932
|
+
const REFUSAL_NAMES = /* @__PURE__ */ new Set([
|
|
33933
|
+
"AccessDenied",
|
|
33934
|
+
"AccessDeniedException",
|
|
33935
|
+
"UnauthorizedOperation",
|
|
33936
|
+
"AuthorizationError",
|
|
33937
|
+
"DependencyViolation",
|
|
33938
|
+
"DeleteConflict",
|
|
33939
|
+
"DeleteConflictException"
|
|
33940
|
+
]);
|
|
33941
|
+
function isRefusedByName(error) {
|
|
33942
|
+
try {
|
|
33943
|
+
let current = error;
|
|
33944
|
+
for (let depth = 0; depth < MAX_DEPTH && current != null; depth++) {
|
|
33945
|
+
if (typeof current !== "object") break;
|
|
33946
|
+
const link = current;
|
|
33947
|
+
for (const name of [
|
|
33948
|
+
link.name,
|
|
33949
|
+
link.Code,
|
|
33950
|
+
link.code
|
|
33951
|
+
]) if (typeof name === "string" && REFUSAL_NAMES.has(name)) return true;
|
|
33952
|
+
current = link.cause;
|
|
33953
|
+
}
|
|
33954
|
+
} catch {}
|
|
33955
|
+
return false;
|
|
33771
33956
|
}
|
|
33772
33957
|
|
|
33773
33958
|
// src/provisioning/tag-list.ts
|
|
@@ -33864,55 +34049,18 @@ function recordedTagsUnreadableWarning(resourceType, id, applied) {
|
|
|
33864
34049
|
return safeMsg`The recorded Tags of ${resourceType} ${id} is not a list cdkd can read, so cdkd removed no tag and applied the ${applied} desired tag(s) only. Untag any key the template no longer names yourself.`;
|
|
33865
34050
|
}
|
|
33866
34051
|
|
|
33867
|
-
// src/provisioning/
|
|
33868
|
-
|
|
33869
|
-
const
|
|
33870
|
-
|
|
33871
|
-
|
|
33872
|
-
|
|
33873
|
-
|
|
33874
|
-
|
|
33875
|
-
enumerable: false,
|
|
33876
|
-
writable: false,
|
|
33877
|
-
configurable: true
|
|
33878
|
-
});
|
|
33879
|
-
} catch {}
|
|
33880
|
-
return error;
|
|
33881
|
-
}
|
|
33882
|
-
function isDeleteStarted(error) {
|
|
33883
|
-
try {
|
|
33884
|
-
let current = error;
|
|
33885
|
-
for (let depth = 0; depth < MAX_DEPTH && typeof current === "object" && current !== null; depth++) {
|
|
33886
|
-
if (current[DELETE_STARTED] === true) return true;
|
|
33887
|
-
current = current.cause;
|
|
33888
|
-
}
|
|
33889
|
-
} catch {}
|
|
33890
|
-
return false;
|
|
34052
|
+
// src/provisioning/attribute-map.ts
|
|
34053
|
+
function definedAttributes(entries) {
|
|
34054
|
+
const out = {};
|
|
34055
|
+
for (const [key, value] of Object.entries(entries)) {
|
|
34056
|
+
if (value === void 0 || value === null) continue;
|
|
34057
|
+
out[key] = value;
|
|
34058
|
+
}
|
|
34059
|
+
return out;
|
|
33891
34060
|
}
|
|
33892
|
-
|
|
33893
|
-
|
|
33894
|
-
|
|
33895
|
-
"UnauthorizedOperation",
|
|
33896
|
-
"AuthorizationError",
|
|
33897
|
-
"DependencyViolation",
|
|
33898
|
-
"DeleteConflict",
|
|
33899
|
-
"DeleteConflictException"
|
|
33900
|
-
]);
|
|
33901
|
-
function isRefusedByName(error) {
|
|
33902
|
-
try {
|
|
33903
|
-
let current = error;
|
|
33904
|
-
for (let depth = 0; depth < MAX_DEPTH && current != null; depth++) {
|
|
33905
|
-
if (typeof current !== "object") break;
|
|
33906
|
-
const link = current;
|
|
33907
|
-
for (const name of [
|
|
33908
|
-
link.name,
|
|
33909
|
-
link.Code,
|
|
33910
|
-
link.code
|
|
33911
|
-
]) if (typeof name === "string" && REFUSAL_NAMES.has(name)) return true;
|
|
33912
|
-
current = link.cause;
|
|
33913
|
-
}
|
|
33914
|
-
} catch {}
|
|
33915
|
-
return false;
|
|
34061
|
+
function stringifyIfAssigned(value) {
|
|
34062
|
+
if (value === void 0 || value === null) return void 0;
|
|
34063
|
+
return String(value);
|
|
33916
34064
|
}
|
|
33917
34065
|
|
|
33918
34066
|
// src/types/deployment-events.ts
|
|
@@ -56974,5 +57122,5 @@ function sameGenerationClaimsOf(record) {
|
|
|
56974
57122
|
};
|
|
56975
57123
|
}
|
|
56976
57124
|
|
|
56977
|
-
export { deleteTableWithIndexBusyRetry as $, refuseUnreadableCdkCrossAccountRefs as $a, redactForState as $c, refuseMalformedDesiredTags as $i, withStackInstanceIdWithheld as $l, nameGenerationCarriedFrom as $n, malformedScrubResourceEntriesRefusalMessage as $o, addSuperseded as $r, unwrittenCreateOnlyReplacement as $s, deleteJournaledOrphans as $t, warnFinchArgvExposure as $u, vectorIndexesForCreate as A, ec2InstanceProtectionSite as Aa, ecsServiceLaunchTypeSetOrChanged as Ac, StageLoadError as Ad, createPreDeleteFinalSnapshot as Ai, recordPhysicalNameCopy as Al, equalModuloMarkedMask as An, lacksRecordedTableArn as Ao, formatDestructiveChange as Ar, refuseMalformedOutputsForDestroy as As, isSecretBearingReferenceString as At, isCrossRegionRedirect as Au, reverseMapTableContributorInsights as B, unsettledPropertiesOf as Ba, maskReadbackAtCoordinates as Bc, absoluteAssemblyPathEscape as Bd, ledgerForStack as Bi, WHOLE_DYNAMIC_REFERENCE_PATTERN as Bl, replacementNeverSwapped as Bn, malformedOrphanRecordsWarning as Bo, proposeRenames as Br, refuseMalformedState as Bs, NESTED_PENDING_PARENT_REASON as Bt, describeDockerFailure as Bu, isTtlAlreadyDisabled as C, UNSPECIFIED_SKIP_REASON as Ca, requireConfigString as Cc, decodeListingKey as Cd, secretNamedRecordNeedles as Ci, spelledKeysOf as Cl, replayFailedOperations as Cn, carriesDynamicReference as Co, isExportAliasCollision as Cr, malformedExportNamesWarning as Cs, conditionInputsFrom as Ct, loadPublishableAssetManifest as Cu, sendTtlWaitingOutRateLimit as D, withIndeterminateGuard as Da, withRetry as Dc, derivePartitionAndUrlSuffix as Dd, PRE_DELETE_SNAPSHOT_TYPES as Di, recoverMaskedOutput as Dl, settleUnsettledPrevious as Dn, AWS_NO_VALUE as Do, maskingRetryLogger as Dr, malformedOutputsWarning as Ds, enclosingDeadlineRemainingMs as Dt, assertAssetBucketRegion as Du, readTtlSpec as E, deleteSkipReason as Ea, describeTypeWithThrottleRetry as Ec, canonicalizeRegion as Ed, ATOMIC_FINAL_SNAPSHOT_TYPES as Ei, recordNestedStackParameterExpressions as El, recordAfterRollbackUpdate as En, keepsSecretReferenceToken as Eo, DEFAULT_RESOURCE_WARN_AFTER_MS as Er, malformedOutputsRefusalMessage as Es, enclosingDeadlineExpired as Et, BOOTSTRAP_MARKER_PREFIX as Eu, indexDeclaresContributorInsights as F, DiffCalculator as Fa, DagBuilder as Fc, defineOwnKey as Fd, APPSYNC_APIKEY_ARN_RESOURCE_PATH as Fi, recordMaskOnlyValuesIn as Fl, isReplacementOrphan as Fn, passedParameterClassesOf as Fo, withMovedTo as Fr, malformedResourcesWarning as Fs, planOrphanAdoption as Ft, buildDenyExternalAccessPolicy as Fu, beginDeleteWait as G, isSettledInstanceState as Ga, noEchoOutputsComparison as Gc, injectAwsRegion as Gd, DeploymentEventsStore as Gi, rebuildClientForBucketRegion as Gl, getCurrentProducerRegions as Gn, refuseMalformedOrphansForOrphan as Go, withStackRecords as Gr, STATE_RESOURCES_MALFORMED as Gs, nestedChildStackName as Gt, isDockerClientEnvKey as Gu, DYNAMODB_DELETE_DEADLINE_MARGIN_MS as H, withoutUnsettledProperties as Ha, maskedLeafCoordinatesOf as Hc, displayAssemblyPath as Hd, withCreateTokenLedger as Hi, LockManager as Hl, seedsDeleteFirstGuard as Hn, previewableOrphanRecords as Ho, awaitInFlightSibling as Hr, JSON_LISTING_HOLE_VALUE as Hs, displacedPhysicalIdShown as Ht, finchSecretArgvRefusal as Hu, planContributorInsightsOp as I, INTRINSIC_KEYS as Ia, TemplateParser as Ic, hasOwnKey as Id, maskedSecretSegment as Ii, recordNoEchoAttributeValues as Il, planFailedOps as In, declaresNoEcho as Io, isPairableType as Ir, malformedStateRefusalMessage as Is, pendingRequestCount as It, buildDockerImage as Iu, resolveDynamoDbDeleteBudgetClock as J, s3BucketDualStackDomainName as Ja, readsNoEchoSource as Jc, resolveBucketRegion as Jd, markDeleteStarted as Ji, applyCrossPrefixScan as Jl, isRedactedRecordedValue as Jn, unreadableOrphanRecords as Jo, cyan as Jr, hasReadableOutputs as Js, revertedNestedRowIds as Jt, redactDockerArgvValues as Ju, compensateRemovedDeletionProtection as K, s3BucketArn as Ka, passedNoEchoParametersOf as Kc, injectedAwsRegionValue as Kd, extractDeploymentEventError as Ki, CrossPrefixReadError as Kl, inheritProducerRegions as Kn, repairMalformedOrphanRecordsForReadOnly as Ko, replacedDeleteFailureVerdict as Kr, UNREADABLE_RESOURCES_MAP_ROW as Ks, recordDisplacedSkips as Kt, isMalformedEnvKey as Ku, planIndexContributorInsightsOps as L, isUsableAttemptedName as La, canonicalCoordinates as Lc, hasPlainPrototype$1 as Ld, secretSegmentsOfState as Li, recordNoEchoParameterFreshValue as Ll, planRollback as Ln, deployRefusesOrphanRowsReason as Lo, looselyEqual as Lr, refuseMalformedResourcesForDeploy as Ls, resolvePendingCloudControlRequests as Lt, resolveDockerContextDirectory as Lu, vectorIndexesShapeDetail as M, observeThenDisableInstanceApiTermination as Ma, canonicalLambdaFunctionName as Mc, describeJsonParseFailure as Md, isFinalSnapshotError as Mi, carriesSecretMask as Ml, undeclaredEmptyObservedKeys as Mn, parseWebACLArn as Mo, hintSidesOf as Mr, STATE_REGION_DIVERGED as Ms, mergeNoChangeOutputs as Mt, readBootstrapMarkerBody as Mu, CONTRIBUTOR_INSIGHTS_KEY as N, reDisableInstanceApiTermination as Na, lambdaFunctionNameForMask as Nc, parseFailureDebugDetail as Nd, refusesFinalSnapshot as Ni, provenPublicValue as Nl, demoteSupersededOrphans as Nn, withSharedDrainBudget as No, movedToHint as Nr, refuseDivergentRecordRegionForDestroy as Ns, makeCanonicalizePropertiesFn as Nt, validateAssetBucketName as Nu, planVectorIndexUpdates as O, isWaitAbandonedError as Oa, blockDeviceMappingsDifferOnlyInDeleteOnTermination as Oc, refuseFailedLookups as Od, buildFinalSnapshotIdentifier as Oi, physicalNameCopiesOf as Ol, withUnprovenUnsettled as On, cfnRefValueFromPhysicalId as Oo, constructPathOf as Or, refuseMalformedNestedChildOutputs as Os, withResourceDeadline as Ot, ensureAssetStorage as Ou, contributorInsightsRefusals as P, reEnableInstanceApiTermination as Pa, sameLambdaFunctionAddress as Pc, utf8ByteLength as Pd, unsupportedFinalSnapshotError as Pi, recordMaskOnlyValue as Pl, isJournaledOrphan as Pn, parameterInputsFor as Po, rollbackOrphanIds as Pr, malformedRenderedContainersWarning as Ps, makeSiblingClaimReader as Pt, validateContainerRepoName as Pu, TABLE_INDEX_NOUN as Q, producerLookupOver as Qa, markSameGenerationBag as Qc, readTagList as Qi, stackInstanceIdOf as Ql, updatePartialReason as Qn, malformedResourceEntriesWarning as Qo, yellow as Qr, findSdkUnwiredProperties as Qs, withNestedStackContext as Qt, runDockerStreaming as Qu, readContributorInsightsSpec as R, unsettledItemsField as Ra, isMarkedCoordinate as Rc, nullPrototypeRecord as Rd, withSecretPhysicalIdsMaskedInState as Ri, recordProvenPublicExpression as Rl, recheckFailedPlan as Rn, isReadableOrphanRecord as Ro, mappingPairs as Rr, refuseMalformedResourcesForDestroy as Rs, keptForRetainedRecord as Rt, describeDockerCapturedOutput as Ru, setResolvedResourceTimeouts as S, RollbackInlinePolicyWriters as Sa, requireConfigObject as Sc, CUSTOM_RESOURCE_RESPONSE_OBJECT_DESCRIPTION as Sd, secretNamedAttributeNamesOf as Si, pathCrossesDottedKey as Sl, refusePendingMovesOut as Sn, isImpossibleEmptyStoredAttribute as So, collectPublishedOutputNames as Sr, repairMalformedOrphansForReadOnly as Ss, conditionFingerprint as St, createAssetRedirectResolver as Su, planTimeToLive as T, deleteLeftInPlace as Ta, templateResourceTypes as Tc, PARTITION_TABLE as Td, storedSecretNameNeedles as Ti, inheritNestedStackParameterAssociations as Tl, removeProtectionTypeList as Tn, isNamelessDynamicReferenceError as To, DEFAULT_RESOURCE_TIMEOUT_MS as Tr, malformedLocalOutputsWarning as Ts, readRecordedConditionVerdicts as Tt, AssetModeResolver as Tu, DYNAMODB_DELETE_MIN_RESOURCE_TIMEOUT_MS as U, IntrinsicFunctionResolver as Ua, noEchoCoordinatesOf as Uc, renderAssemblyPathEscape as Ud, acquireIdempotencyToken as Ui, isLockInfoExpired as Ul, orphanNeedsIdentity as Un, refuseMalformedOrphanRecords as Uo, destroyStackRecordsView as Ur, accountArgs as Us, dropSettledNestedJournals as Ut, formatDockerLoginError as Uu, stripIndexContributorInsights as V, withUnsettledProperties as Va, maskWholeValue as Vc, describeFileReadFailure as Vd, reserveStackCreateToken as Vi, isSingleDynamicReferenceToken as Vl, resolveReplacementOldType as Vn, malformedOrphanRowsKeptWarning as Vo, refuseRestoreFromItself as Vr, repairMalformedResourcesForReadOnly as Vs, displacedOpClause as Vt, dockerSpawnEnvWithSensitive as Vu, DYNAMODB_DELETE_POLL_COST_MS as W, poisonRenderedSpellingsCollidingIn as Wa, noEchoLeavesOf as Wc, resolveAssemblyPath as Wd, DeploymentEventsReader as Wi, S3StateBackend as Wl, findNestedStackTypeChanges as Wn, refuseMalformedOrphanRecordsForDestroy as Wo, getStackRecords as Wr, withheldAccountClause as Ws, getNestedRevertRun as Wt, getDockerCmd as Wu, DELETE_INDEX_WAIT_PROCEED_NOTE as X, s3BucketWebsiteUrl as Xa, valueAtCoordinate as Xc, DBPROXY_TAG_OPTIONS as Xi, isAccessDenied$1 as Xl, redactedDeleteAddressSkip as Xn, malformedLocalResourceEntriesWarning as Xo, green as Xr, findActionableSdkUnwired as Xs, collectNestedChildUnaddressed as Xt, redactedDockerCause as Xu, resolveDynamoDbDeleteBudgetMs as Y, s3BucketRegionalDomainName as Ya, recordedNoEchoValuesOf as Yc, DBPROXY_TAGS_WHAT as Yi, crossPrefixDeniedWarning as Yl, redactedDeleteAddressFields as Yn, isReadableResourceEntry as Yo, gray as Yr, hasReadableResources as Ys, withNestedRevertRun as Yt, redactedCause as Yu, INDEX_SETTLE_POLL_INTERVAL_MS as Z, resolveDynamicReferences as Za, liveMatchesUnresolvedTokenFrame as Zc, planTagDiff as Zi, isNotImplemented as Zl, updatePartialMessage as Zn, malformedLocalResourcesWarning as Zo, red as Zr, findHandledUnwrittenCreateOnly as Zs, getCurrentNestedStackContext as Zt, runDockerForeground as Zu, streamMemberRefusals as _, waitForLambdaFunctionActive as _a, configIntegerRefusal as _c, CFN_TEMPLATE_BODY_LIMIT as _d, maskEventTextWithBoundBags as _i, withPhysicalNameCopies as _l, sameMove as _n, regionLessSecretName as _o, exportNameNoEchoParameters as _r, hasReadableOrphans as _s, findNestedTemplateTreeDefect as _t, AssetPublisher as _u, isProtectionValueActive as a, ProviderRegistry as aa, MULTI_REGION_RECREATE_BLOCKED_TYPES as ac, getLegacyStateBucketName as ad, supersededHeldByOtherTypeWarning as ai, literalSplitDelimitersOf as al, makeForeignHolderScan as an, assertFlagRoleArn as ao, withNameGenerationReached as ar, refuseMalformedResourceEntriesForImportSave as as, hasCdkAutoDeleteTag as at, hasReasonlessBaselineRefusal as au, waitForGoneAfterDelete as b, onlySecretReferencesDiffer as ba, replayWarn as bc, findLargeInlineResources as bd, secretNamePrintingBag as bi, dynamicReferenceTokens as bl, pendingMovesOutOf as bn, parameterTypeMayLoseSecretIdentity as bo, noEchoParameterValueSeed as br, refuseMalformedOrphans as bs, renderNestedTemplateTreeDefect as bt, WorkGraph as bu, DynamoDBGlobalTableProvider as c, wouldReturnToSdkProvider as ca, renderStatefulReason as cc, resolveAutoAssetStorage as cd, withoutSuperseded as ci, recordLogOnlyParameterValue as cl, chunks as cn, isIamRoleArn as co, reachableDivergentParameters as cr, unreadableResourceEntries as cs, markRefusedBeforeApplying as ct, importableOutputs as cu, declaredStreamPolicyMember as d, customResourceResponseExpirationWarning as da, isWarmThroughputDecrease as dc, resolveStateBucketWithDefault as dd, noEchoExactEchoLeavesOf as di, unionOfSecretBags as dl, withApiLimit as dn, applyCallerIdentityCredentials as do, displayTextOrWithheld as dr, refuseMalformedResourcePropertiesForDestroy as ds, crossStackOutputProvenanceSource as dt, orphansCarriedFrom as du, tagMapAsList as ea, withoutSdkUnwiredProperties as ec, AssetManifestLoader as ed, deleteSupersededEntry as ei, recordReferenceProvenanceEntry as el, dropFailedCommands as en, keepHeldTokenProvenance as eo, nameGenerationHighWaterOf as er, refuseMalformedResourceAttributesForOrphan as es, maskedLogger as et, splitImportedOps as eu, declaredStreamTagsMember as f, TemplateNoEchoReresolver as fa, toCfnInteger as fc, resolveStateBucketWithDefaultAndSource as fd, noEchoParameterNamesOf as fi, createSecretMasker as fl, readRefactorMarker as fn, callerEnvCredentials as fo, exportAliasCollisionScrubWarning as fr, refuseMalformedResourcePropertiesForDrift as fs, inheritedProvenanceForChildDiff as ft, shouldRetainResource as fu, streamDeclaresTags as g, withPrintingSecrets as ga, configBooleanRefusal as gc, ssmResolvedValueType as gd, journaledOrphanPrintingBag as gi, scrubResourceRecord as gl, refuseRefactorMarker as gn, producerRegionsFromState as go, carriedExportAliasExposure as gr, UNREADABLE_ORPHANS_CONTAINER_ROW as gs, childTemplateLoader as gt, timePhase as gu, streamDeclaresPolicy as h, getCurrentResourceSecrets as ha, coerceCfnInteger as hc, warnDeprecatedNoPrefixCliFlag as hd, completedReplayEntries as hi, maskSecretsInText as hl, refactorMarkerRefusalMessage as hn, classifyReplaySecretRegion as ho, secretSafeKeyDisplay as hr, repairMalformedResourcePropertiesForReadOnly as hs, serviceTokenBlockingReason as ht, renderPhaseTimings as hu, PROTECTION_PROPERTY_BY_TYPE as i, CC_BROKEN_REASON as ia, shownType as ic, getDefaultStateBucketName as id, supersededAfterRollback as ii, hasMaskableValues as il, loadJournaledOrphans as in, applyRoleArnIfSet as io, retiredNameGenerationsLeaving as ir, refuseMalformedResourceEntriesForImport as is, S3_AUTO_DELETE_OBJECTS_TAG as it, hasReadableExportSet as iu, vectorIndexesSettled as j, isTerminationProtectionPropagationError as ja, emrClusterInstancesReplaced as jc, processStackMessages as jd, effectiveDeletionPolicy as ji, splitGetAttStringForm as jl, equalModuloMask as jn, refStateLookupFromResource as jo, findRefactorHints as jr, repairMalformedOutputsForReadOnly as js, keptWholeReasonText as jt, parseBootstrapMarker as ju, readbackVectorIndexes as k, disableInstanceApiTermination as ka, dbInstanceEngineChangeIsInPlace as kc, AssemblyReader as kd, ccRoutedFinalSnapshotError as ki, recordAttributeIdCopy as kl, calculateResourceDrift as kn, isStalePlaceholderArnAttribute as ko, findDestructiveChanges as kr, refuseMalformedOutputs as ks, diffSecurity as kt, getBootstrapMarkerKey as ku, STREAM_POLICY_KEY as l, CUSTOM_RESOURCE_RESPONSE_LIFECYCLE_RULE_ID as la, WARM_THROUGHPUT_MEMBERS as lc, resolveCaptureObservedState as ld, noEchoAttributeNamesOf as li, recordLogOnlyValue as ll, isAccessDeniedError as ln, sendableAssumeRoleCommand as lo, resourcesNamingDeclaredParameter as lr, malformedDriftResourcePropertiesWarning as ls, IMPLICIT_DELETE_DEPENDENCIES as lt, isReadableBag as lu, reverseMapStreamPolicy as m, isCustomResourceType as ma, coerceCfnBoolean as mc, stateBucketExistenceConfirmed as md, createReadOnlyAttributeHealerFactory as mi, maskSecretsInError as ml, refactorMarkerMovesOf as mn, classifyRecordedSecretRegion as mo, secretBearingStateKeyWarning as mr, refuseMalformedResourcePropertiesForOrphan as ms, findServiceTokenRefusals as mt, PhaseClock as mu, recordedProtectionEvidence as n, definedAttributes as na, hasNoCloudControlHandlers as nc, Synthesizer as nd, isSupersededResourceRecord as ni, carryLogOnlyValues as nl, isHandledOrphan as nn, recordedOutputReferenceRegions as no, retiredAfterRollback as nr, refuseMalformedResourceEntriesForDeploy as ns, waitForIndexesSettled as nt, describeRegionValueKind as nu, perType as o, ccBrokenReason as oa, isStatefulRecreateTargetForReplace as oc, loadCdkJson as od, supersededHolderOf as oi, logOnlyValueCount as ol, sameJournaledOrphans as on, assertSendableRoleArn as oo, computeParameterTaint as or, refuseMalformedResourceEntriesForOrphan as os, isTruthyCfnBoolean as ot, hasUnverifiableParameterRefusal as ou, planStreamMemberOps as p, readsNoEchoDeleteValues as pa, toFiniteNumber as pc, resolveUseCdkBootstrapAssets as pd, withAttemptedItemsMasked as pi, errorCauseChain as pl, readRefactorMarkerOnce as pn, envCredentialsAreAssumedRole as po, secretBearing as pr, refuseMalformedResourcePropertiesForExport as ps, deferredServiceTokenWarning as pt, stackInstanceIdCarriedFrom as pu, deleteBudgetKey as q, s3BucketDomainName as qa, readbackPathFor as qc, clearBucketRegionCache as qd, isRefusedByName as qi, CrossPrefixScanCache as ql, REDACTED_DELETE_ADDRESS_SKIP_REASON as qn, unpreviewableOrphanRecords as qo, bold as qr, displayLogicalId as qs, revertNestedChildFromJournal as qt, partitionSensitiveEnv as qu, recordedProtectionNote as r, stringifyIfAssigned as ra, findReplacedReadersOfRecreateTargets as rc, synthesisStatusMessage as rd, removeSuperseded as ri, createUnionSecretMasker as rl, journaledOrphanLines as rn, recordedReferenceRegions as ro, retiredNameGenerationsAfter as rr, refuseMalformedResourceEntriesForDestroy as rs, ECR_AUTO_DELETE_IMAGES_TAG as rt, exportNamesCarriedFrom as ru, readProtection as s, isCustomResource as sa, isStatefulRecreateTargetSync as sc, resolveApp as sd, supersededResourcesOf as si, printingCorpusOf as sl, formatResourceLine as sn, explicitRoleArnOrThrow as so, namesAnyDeclaredParameter as sr, repairMalformedResourceEntriesForReadOnly as ss, getPriorAttempts as st, importableOutputKeys as su, DeployEngine as t, tagPlanWarning as ta, NO_CC_HANDLERS_REASON as tc, getDockerImageBySourceHash as td, holdsSupersededResources as ti, snapshotPassProvenance as tl, dropFailedHint as tn, outputReferenceProvenanceOf as to, nameScopeOf as tr, refuseMalformedResourceEntries as ts, relayedIndexBusyDelete as tt, acceptedCreateOnlyDropsOf as tu, STREAM_TAGS_KEY as u, applyCustomResourceResponseExpiration as ua, coerceWarmThroughput as uc, resolveSkipPrefix as ud, noEchoComparisonForTemplate as ui, shareLogOnlyValues as ul, lookupEachName as un, AWS_CREDENTIAL_ENV_KEYS as uo, WITHHELD_NAME_DISPLAY as ur, malformedResourcePropertiesWarning as us, computeImplicitDeleteEdges as ut, orphansAfterRollback as uu, streamPolicyMatchesDeclared as v, CloudControlProvider as va, configStringRefusal as vc, CFN_TEMPLATE_URL_LIMIT as vd, namingSecretsWithRecordedNoEcho as vi, withoutPhysicalNameCopies as vl, updateRefactorMarker as vn, coerceParameterTypedValue as vo, exportNameSecretExposure as vr, malformedOrphansRefusalMessage as vs, isAbsoluteAssetPath as vt, isSensitiveAttributeName as vu, isTtlRateLimited as w, deleteIndeterminateGuards as wa, prefetchCreateOnlyPropertyPaths as wc, expectedOwnerParam as wd, stateSecretNameNeedles as wi, identityKeyFor as wl, replayRollback as wn, carriesFetchableDynamicReference as wo, bindingSkippedOutputs as wr, malformedExportSourceWarning as ws, parentSuppliedValues as wt, rewriteTemplateAssetReferences as wu, resolvedResourceTimeoutMs as x, unchangedBehindSecretReference as xa, requireConfigArray as xc, uploadCfnTemplate as xd, secretNamePrintingBags as xi, isUncertifiedBaselineMaskPosition as xl, pendingMovesRefusalMessage as xn, getAccountInfo as xo, collectDeclaredOutputNames as xr, refuseMalformedOrphansForDestroy as xs, templateIdentity as xt, buildAssetRedirectMap as xu, streamTagsMatchDeclared as y, slowCcOperationTimeoutMs as ya, readConfigString as yc, MIGRATE_TMP_PREFIX as yd, orphanRecordsPrintingBag as yi, DYNAMIC_REFERENCE_TOKEN_SCAN as yl, hasPendingMovesOut as yn, isUnboundTemplateParameter as yo, isWholeDynamicReferenceValue as yr, malformedOrphansWarning as ys, listNestedTemplateRows as yt, stringifyValue as yu, reverseMapIndexContributorInsights as z, unsettledItemsOf as za, maskAtCoordinates as zc, ownValue as zd, earliestDefined as zi, wholeStringLeavesOf as zl, recordUnderIdIsNotOwn as zn, malformedOrphanRecordsRefusalMessage as zo, parseMappingFile as zr, refuseMalformedResourcesForExport as zs, recordRetainedForReadoption as zt, describeDockerExecFailure as zu };
|
|
56978
|
-
//# sourceMappingURL=deploy-engine-
|
|
57125
|
+
export { deleteTableWithIndexBusyRetry as $, refuseUnreadableCdkCrossAccountRefs as $a, redactForState as $c, refuseMalformedDesiredTags as $i, withStackInstanceIdWithheld as $l, nameGenerationCarriedFrom as $n, malformedScrubResourceEntriesRefusalMessage as $o, addSuperseded as $r, unwrittenCreateOnlyReplacement as $s, deleteJournaledOrphans as $t, warnFinchArgvExposure as $u, vectorIndexesForCreate as A, reDisableInstanceApiTermination as Aa, ecsServiceLaunchTypeSetOrChanged as Ac, StageLoadError as Ad, createPreDeleteFinalSnapshot as Ai, recordPhysicalNameCopy as Al, equalModuloMarkedMask as An, lacksRecordedTableArn as Ao, formatDestructiveChange as Ar, refuseMalformedOutputsForDestroy as As, isSecretBearingReferenceString as At, isCrossRegionRedirect as Au, reverseMapTableContributorInsights as B, unsettledPropertiesOf as Ba, maskReadbackAtCoordinates as Bc, absoluteAssemblyPathEscape as Bd, ledgerForStack as Bi, WHOLE_DYNAMIC_REFERENCE_PATTERN as Bl, replacementNeverSwapped as Bn, malformedOrphanRecordsWarning as Bo, proposeRenames as Br, refuseMalformedState as Bs, NESTED_PENDING_PARENT_REASON as Bt, describeDockerFailure as Bu, isTtlAlreadyDisabled as C, deleteLeftInPlace as Ca, requireConfigString as Cc, decodeListingKey as Cd, secretNamedRecordNeedles as Ci, spelledKeysOf as Cl, replayFailedOperations as Cn, carriesDynamicReference as Co, isExportAliasCollision as Cr, malformedExportNamesWarning as Cs, conditionInputsFrom as Ct, loadPublishableAssetManifest as Cu, sendTtlWaitingOutRateLimit as D, ec2InstanceProtectionSite as Da, withRetry as Dc, derivePartitionAndUrlSuffix as Dd, PRE_DELETE_SNAPSHOT_TYPES as Di, recoverMaskedOutput as Dl, settleUnsettledPrevious as Dn, AWS_NO_VALUE as Do, maskingRetryLogger as Dr, malformedOutputsWarning as Ds, enclosingDeadlineRemainingMs as Dt, assertAssetBucketRegion as Du, readTtlSpec as E, disableInstanceApiTermination as Ea, describeTypeWithThrottleRetry as Ec, canonicalizeRegion as Ed, ATOMIC_FINAL_SNAPSHOT_TYPES as Ei, recordNestedStackParameterExpressions as El, recordAfterRollbackUpdate as En, keepsSecretReferenceToken as Eo, DEFAULT_RESOURCE_WARN_AFTER_MS as Er, malformedOutputsRefusalMessage as Es, enclosingDeadlineExpired as Et, BOOTSTRAP_MARKER_PREFIX as Eu, indexDeclaresContributorInsights as F, DiffCalculator as Fa, DagBuilder as Fc, defineOwnKey as Fd, APPSYNC_APIKEY_ARN_RESOURCE_PATH as Fi, recordMaskOnlyValuesIn as Fl, isReplacementOrphan as Fn, passedParameterClassesOf as Fo, withMovedTo as Fr, malformedResourcesWarning as Fs, planOrphanAdoption as Ft, buildDenyExternalAccessPolicy as Fu, beginDeleteWait as G, isSettledInstanceState as Ga, noEchoOutputsComparison as Gc, injectAwsRegion as Gd, DeploymentEventsStore as Gi, rebuildClientForBucketRegion as Gl, getCurrentProducerRegions as Gn, refuseMalformedOrphansForOrphan as Go, withStackRecords as Gr, STATE_RESOURCES_MALFORMED as Gs, nestedChildStackName as Gt, isDockerClientEnvKey as Gu, DYNAMODB_DELETE_DEADLINE_MARGIN_MS as H, withoutUnsettledProperties as Ha, maskedLeafCoordinatesOf as Hc, displayAssemblyPath as Hd, withCreateTokenLedger as Hi, LockManager as Hl, seedsDeleteFirstGuard as Hn, previewableOrphanRecords as Ho, awaitInFlightSibling as Hr, JSON_LISTING_HOLE_VALUE as Hs, displacedPhysicalIdShown as Ht, finchSecretArgvRefusal as Hu, planContributorInsightsOp as I, INTRINSIC_KEYS as Ia, TemplateParser as Ic, hasOwnKey as Id, maskedSecretSegment as Ii, recordNoEchoAttributeValues as Il, planFailedOps as In, declaresNoEcho as Io, isPairableType as Ir, malformedStateRefusalMessage as Is, pendingRequestCount as It, buildDockerImage as Iu, resolveDynamoDbDeleteBudgetClock as J, s3BucketDualStackDomainName as Ja, readsNoEchoSource as Jc, resolveBucketRegion as Jd, stringifyIfAssigned as Ji, applyCrossPrefixScan as Jl, isRedactedRecordedValue as Jn, unreadableOrphanRecords as Jo, cyan as Jr, hasReadableOutputs as Js, revertedNestedRowIds as Jt, redactDockerArgvValues as Ju, compensateRemovedDeletionProtection as K, s3BucketArn as Ka, passedNoEchoParametersOf as Kc, injectedAwsRegionValue as Kd, extractDeploymentEventError as Ki, CrossPrefixReadError as Kl, inheritProducerRegions as Kn, repairMalformedOrphanRecordsForReadOnly as Ko, replacedDeleteFailureVerdict as Kr, UNREADABLE_RESOURCES_MAP_ROW as Ks, recordDisplacedSkips as Kt, isMalformedEnvKey as Ku, planIndexContributorInsightsOps as L, isUsableAttemptedName as La, canonicalCoordinates as Lc, hasPlainPrototype$1 as Ld, secretSegmentsOfState as Li, recordNoEchoParameterFreshValue as Ll, planRollback as Ln, deployRefusesOrphanRowsReason as Lo, looselyEqual as Lr, refuseMalformedResourcesForDeploy as Ls, resolvePendingCloudControlRequests as Lt, resolveDockerContextDirectory as Lu, vectorIndexesShapeDetail as M, onlySecretReferencesDiffer as Ma, canonicalLambdaFunctionName as Mc, describeJsonParseFailure as Md, isFinalSnapshotError as Mi, carriesSecretMask as Ml, undeclaredEmptyObservedKeys as Mn, parseWebACLArn as Mo, hintSidesOf as Mr, STATE_REGION_DIVERGED as Ms, mergeNoChangeOutputs as Mt, readBootstrapMarkerBody as Mu, CONTRIBUTOR_INSIGHTS_KEY as N, unchangedBehindSecretReference as Na, lambdaFunctionNameForMask as Nc, parseFailureDebugDetail as Nd, refusesFinalSnapshot as Ni, provenPublicValue as Nl, demoteSupersededOrphans as Nn, withSharedDrainBudget as No, movedToHint as Nr, refuseDivergentRecordRegionForDestroy as Ns, makeCanonicalizePropertiesFn as Nt, validateAssetBucketName as Nu, planVectorIndexUpdates as O, isTerminationProtectionPropagationError as Oa, blockDeviceMappingsDifferOnlyInDeleteOnTermination as Oc, refuseFailedLookups as Od, buildFinalSnapshotIdentifier as Oi, physicalNameCopiesOf as Ol, withUnprovenUnsettled as On, cfnRefValueFromPhysicalId as Oo, constructPathOf as Or, refuseMalformedNestedChildOutputs as Os, withResourceDeadline as Ot, ensureAssetStorage as Ou, contributorInsightsRefusals as P, isWaitAbandonedError as Pa, sameLambdaFunctionAddress as Pc, utf8ByteLength as Pd, unsupportedFinalSnapshotError as Pi, recordMaskOnlyValue as Pl, isJournaledOrphan as Pn, parameterInputsFor as Po, rollbackOrphanIds as Pr, malformedRenderedContainersWarning as Ps, makeSiblingClaimReader as Pt, validateContainerRepoName as Pu, TABLE_INDEX_NOUN as Q, producerLookupOver as Qa, markSameGenerationBag as Qc, readTagList as Qi, stackInstanceIdOf as Ql, updatePartialReason as Qn, malformedResourceEntriesWarning as Qo, yellow as Qr, findSdkUnwiredProperties as Qs, withNestedStackContext as Qt, runDockerStreaming as Qu, readContributorInsightsSpec as R, unsettledItemsField as Ra, isMarkedCoordinate as Rc, nullPrototypeRecord as Rd, withSecretPhysicalIdsMaskedInState as Ri, recordProvenPublicExpression as Rl, recheckFailedPlan as Rn, isReadableOrphanRecord as Ro, mappingPairs as Rr, refuseMalformedResourcesForDestroy as Rs, keptForRetainedRecord as Rt, describeDockerCapturedOutput as Ru, setResolvedResourceTimeouts as S, deleteIndeterminateGuards as Sa, requireConfigObject as Sc, CUSTOM_RESOURCE_RESPONSE_OBJECT_DESCRIPTION as Sd, secretNamedAttributeNamesOf as Si, pathCrossesDottedKey as Sl, refusePendingMovesOut as Sn, isImpossibleEmptyStoredAttribute as So, collectPublishedOutputNames as Sr, repairMalformedOrphansForReadOnly as Ss, conditionFingerprint as St, createAssetRedirectResolver as Su, planTimeToLive as T, withIndeterminateGuard as Ta, templateResourceTypes as Tc, PARTITION_TABLE as Td, storedSecretNameNeedles as Ti, inheritNestedStackParameterAssociations as Tl, removeProtectionTypeList as Tn, isNamelessDynamicReferenceError as To, DEFAULT_RESOURCE_TIMEOUT_MS as Tr, malformedLocalOutputsWarning as Ts, readRecordedConditionVerdicts as Tt, AssetModeResolver as Tu, DYNAMODB_DELETE_MIN_RESOURCE_TIMEOUT_MS as U, IntrinsicFunctionResolver as Ua, noEchoCoordinatesOf as Uc, renderAssemblyPathEscape as Ud, acquireIdempotencyToken as Ui, isLockInfoExpired as Ul, orphanNeedsIdentity as Un, refuseMalformedOrphanRecords as Uo, destroyStackRecordsView as Ur, accountArgs as Us, dropSettledNestedJournals as Ut, formatDockerLoginError as Uu, stripIndexContributorInsights as V, withUnsettledProperties as Va, maskWholeValue as Vc, describeFileReadFailure as Vd, reserveStackCreateToken as Vi, isSingleDynamicReferenceToken as Vl, resolveReplacementOldType as Vn, malformedOrphanRowsKeptWarning as Vo, refuseRestoreFromItself as Vr, repairMalformedResourcesForReadOnly as Vs, displacedOpClause as Vt, dockerSpawnEnvWithSensitive as Vu, DYNAMODB_DELETE_POLL_COST_MS as W, poisonRenderedSpellingsCollidingIn as Wa, noEchoLeavesOf as Wc, resolveAssemblyPath as Wd, DeploymentEventsReader as Wi, S3StateBackend as Wl, findNestedStackTypeChanges as Wn, refuseMalformedOrphanRecordsForDestroy as Wo, getStackRecords as Wr, withheldAccountClause as Ws, getNestedRevertRun as Wt, getDockerCmd as Wu, DELETE_INDEX_WAIT_PROCEED_NOTE as X, s3BucketWebsiteUrl as Xa, valueAtCoordinate as Xc, DBPROXY_TAG_OPTIONS as Xi, isAccessDenied$1 as Xl, redactedDeleteAddressSkip as Xn, malformedLocalResourceEntriesWarning as Xo, green as Xr, findActionableSdkUnwired as Xs, collectNestedChildUnaddressed as Xt, redactedDockerCause as Xu, resolveDynamoDbDeleteBudgetMs as Y, s3BucketRegionalDomainName as Ya, recordedNoEchoValuesOf as Yc, DBPROXY_TAGS_WHAT as Yi, crossPrefixDeniedWarning as Yl, redactedDeleteAddressFields as Yn, isReadableResourceEntry as Yo, gray as Yr, hasReadableResources as Ys, withNestedRevertRun as Yt, redactedCause as Yu, INDEX_SETTLE_POLL_INTERVAL_MS as Z, resolveDynamicReferences as Za, liveMatchesUnresolvedTokenFrame as Zc, planTagDiff as Zi, isNotImplemented as Zl, updatePartialMessage as Zn, malformedLocalResourcesWarning as Zo, red as Zr, findHandledUnwrittenCreateOnly as Zs, getCurrentNestedStackContext as Zt, runDockerForeground as Zu, streamMemberRefusals as _, waitForLambdaFunctionActive as _a, configIntegerRefusal as _c, CFN_TEMPLATE_BODY_LIMIT as _d, maskEventTextWithBoundBags as _i, withPhysicalNameCopies as _l, sameMove as _n, regionLessSecretName as _o, exportNameNoEchoParameters as _r, hasReadableOrphans as _s, findNestedTemplateTreeDefect as _t, AssetPublisher as _u, isProtectionValueActive as a, ProviderRegistry as aa, MULTI_REGION_RECREATE_BLOCKED_TYPES as ac, getLegacyStateBucketName as ad, supersededHeldByOtherTypeWarning as ai, literalSplitDelimitersOf as al, makeForeignHolderScan as an, assertFlagRoleArn as ao, withNameGenerationReached as ar, refuseMalformedResourceEntriesForImportSave as as, hasCdkAutoDeleteTag as at, hasReasonlessBaselineRefusal as au, waitForGoneAfterDelete as b, RollbackInlinePolicyWriters as ba, replayWarn as bc, findLargeInlineResources as bd, secretNamePrintingBag as bi, dynamicReferenceTokens as bl, pendingMovesOutOf as bn, parameterTypeMayLoseSecretIdentity as bo, noEchoParameterValueSeed as br, refuseMalformedOrphans as bs, renderNestedTemplateTreeDefect as bt, WorkGraph as bu, DynamoDBGlobalTableProvider as c, wouldReturnToSdkProvider as ca, renderStatefulReason as cc, resolveAutoAssetStorage as cd, withoutSuperseded as ci, recordLogOnlyParameterValue as cl, chunks as cn, isIamRoleArn as co, reachableDivergentParameters as cr, unreadableResourceEntries as cs, markRefusedBeforeApplying as ct, importableOutputs as cu, declaredStreamPolicyMember as d, customResourceResponseExpirationWarning as da, isWarmThroughputDecrease as dc, resolveStateBucketWithDefault as dd, noEchoExactEchoLeavesOf as di, unionOfSecretBags as dl, withApiLimit as dn, applyCallerIdentityCredentials as do, displayTextOrWithheld as dr, refuseMalformedResourcePropertiesForDestroy as ds, crossStackOutputProvenanceSource as dt, orphansCarriedFrom as du, tagMapAsList as ea, withoutSdkUnwiredProperties as ec, AssetManifestLoader as ed, deleteSupersededEntry as ei, recordReferenceProvenanceEntry as el, dropFailedCommands as en, keepHeldTokenProvenance as eo, nameGenerationHighWaterOf as er, refuseMalformedResourceAttributesForOrphan as es, maskedLogger as et, splitImportedOps as eu, declaredStreamTagsMember as f, TemplateNoEchoReresolver as fa, toCfnInteger as fc, resolveStateBucketWithDefaultAndSource as fd, noEchoParameterNamesOf as fi, createSecretMasker as fl, readRefactorMarker as fn, callerEnvCredentials as fo, exportAliasCollisionScrubWarning as fr, refuseMalformedResourcePropertiesForDrift as fs, inheritedProvenanceForChildDiff as ft, shouldRetainResource as fu, streamDeclaresTags as g, withPrintingSecrets as ga, configBooleanRefusal as gc, ssmResolvedValueType as gd, journaledOrphanPrintingBag as gi, scrubResourceRecord as gl, refuseRefactorMarker as gn, producerRegionsFromState as go, carriedExportAliasExposure as gr, UNREADABLE_ORPHANS_CONTAINER_ROW as gs, childTemplateLoader as gt, timePhase as gu, streamDeclaresPolicy as h, getCurrentResourceSecrets as ha, coerceCfnInteger as hc, warnDeprecatedNoPrefixCliFlag as hd, completedReplayEntries as hi, maskSecretsInText as hl, refactorMarkerRefusalMessage as hn, classifyReplaySecretRegion as ho, secretSafeKeyDisplay as hr, repairMalformedResourcePropertiesForReadOnly as hs, serviceTokenBlockingReason as ht, renderPhaseTimings as hu, PROTECTION_PROPERTY_BY_TYPE as i, CC_BROKEN_REASON as ia, shownType as ic, getDefaultStateBucketName as id, supersededAfterRollback as ii, hasMaskableValues as il, loadJournaledOrphans as in, applyRoleArnIfSet as io, retiredNameGenerationsLeaving as ir, refuseMalformedResourceEntriesForImport as is, S3_AUTO_DELETE_OBJECTS_TAG as it, hasReadableExportSet as iu, vectorIndexesSettled as j, reEnableInstanceApiTermination as ja, emrClusterInstancesReplaced as jc, processStackMessages as jd, effectiveDeletionPolicy as ji, splitGetAttStringForm as jl, equalModuloMask as jn, refStateLookupFromResource as jo, findRefactorHints as jr, repairMalformedOutputsForReadOnly as js, keptWholeReasonText as jt, parseBootstrapMarker as ju, readbackVectorIndexes as k, observeThenDisableInstanceApiTermination as ka, dbInstanceEngineChangeIsInPlace as kc, AssemblyReader as kd, ccRoutedFinalSnapshotError as ki, recordAttributeIdCopy as kl, calculateResourceDrift as kn, isStalePlaceholderArnAttribute as ko, findDestructiveChanges as kr, refuseMalformedOutputs as ks, diffSecurity as kt, getBootstrapMarkerKey as ku, STREAM_POLICY_KEY as l, CUSTOM_RESOURCE_RESPONSE_LIFECYCLE_RULE_ID as la, WARM_THROUGHPUT_MEMBERS as lc, resolveCaptureObservedState as ld, noEchoAttributeNamesOf as li, recordLogOnlyValue as ll, isAccessDeniedError as ln, sendableAssumeRoleCommand as lo, resourcesNamingDeclaredParameter as lr, malformedDriftResourcePropertiesWarning as ls, IMPLICIT_DELETE_DEPENDENCIES as lt, isReadableBag as lu, reverseMapStreamPolicy as m, isCustomResourceType as ma, coerceCfnBoolean as mc, stateBucketExistenceConfirmed as md, createReadOnlyAttributeHealerFactory as mi, maskSecretsInError as ml, refactorMarkerMovesOf as mn, classifyRecordedSecretRegion as mo, secretBearingStateKeyWarning as mr, refuseMalformedResourcePropertiesForOrphan as ms, findServiceTokenRefusals as mt, PhaseClock as mu, recordedProtectionEvidence as n, isRefusedByName as na, hasNoCloudControlHandlers as nc, Synthesizer as nd, isSupersededResourceRecord as ni, carryLogOnlyValues as nl, isHandledOrphan as nn, recordedOutputReferenceRegions as no, retiredAfterRollback as nr, refuseMalformedResourceEntriesForDeploy as ns, waitForIndexesSettled as nt, describeRegionValueKind as nu, perType as o, ccBrokenReason as oa, isStatefulRecreateTargetForReplace as oc, loadCdkJson as od, supersededHolderOf as oi, logOnlyValueCount as ol, sameJournaledOrphans as on, assertSendableRoleArn as oo, computeParameterTaint as or, refuseMalformedResourceEntriesForOrphan as os, isTruthyCfnBoolean as ot, hasUnverifiableParameterRefusal as ou, planStreamMemberOps as p, readsNoEchoDeleteValues as pa, toFiniteNumber as pc, resolveUseCdkBootstrapAssets as pd, withAttemptedItemsMasked as pi, errorCauseChain as pl, readRefactorMarkerOnce as pn, envCredentialsAreAssumedRole as po, secretBearing as pr, refuseMalformedResourcePropertiesForExport as ps, deferredServiceTokenWarning as pt, stackInstanceIdCarriedFrom as pu, deleteBudgetKey as q, s3BucketDomainName as qa, readbackPathFor as qc, clearBucketRegionCache as qd, definedAttributes as qi, CrossPrefixScanCache as ql, REDACTED_DELETE_ADDRESS_SKIP_REASON as qn, unpreviewableOrphanRecords as qo, bold as qr, displayLogicalId as qs, revertNestedChildFromJournal as qt, partitionSensitiveEnv as qu, recordedProtectionNote as r, markDeleteStarted as ra, findReplacedReadersOfRecreateTargets as rc, synthesisStatusMessage as rd, removeSuperseded as ri, createUnionSecretMasker as rl, journaledOrphanLines as rn, recordedReferenceRegions as ro, retiredNameGenerationsAfter as rr, refuseMalformedResourceEntriesForDestroy as rs, ECR_AUTO_DELETE_IMAGES_TAG as rt, exportNamesCarriedFrom as ru, readProtection as s, isCustomResource as sa, isStatefulRecreateTargetSync as sc, resolveApp as sd, supersededResourcesOf as si, printingCorpusOf as sl, formatResourceLine as sn, explicitRoleArnOrThrow as so, namesAnyDeclaredParameter as sr, repairMalformedResourceEntriesForReadOnly as ss, getPriorAttempts as st, importableOutputKeys as su, DeployEngine as t, tagPlanWarning as ta, NO_CC_HANDLERS_REASON as tc, getDockerImageBySourceHash as td, holdsSupersededResources as ti, snapshotPassProvenance as tl, dropFailedHint as tn, outputReferenceProvenanceOf as to, nameScopeOf as tr, refuseMalformedResourceEntries as ts, relayedIndexBusyDelete as tt, acceptedCreateOnlyDropsOf as tu, STREAM_TAGS_KEY as u, applyCustomResourceResponseExpiration as ua, coerceWarmThroughput as uc, resolveSkipPrefix as ud, noEchoComparisonForTemplate as ui, shareLogOnlyValues as ul, lookupEachName as un, AWS_CREDENTIAL_ENV_KEYS as uo, WITHHELD_NAME_DISPLAY as ur, malformedResourcePropertiesWarning as us, computeImplicitDeleteEdges as ut, orphansAfterRollback as uu, streamPolicyMatchesDeclared as v, CloudControlProvider as va, configStringRefusal as vc, CFN_TEMPLATE_URL_LIMIT as vd, namingSecretsWithRecordedNoEcho as vi, withoutPhysicalNameCopies as vl, updateRefactorMarker as vn, coerceParameterTypedValue as vo, exportNameSecretExposure as vr, malformedOrphansRefusalMessage as vs, isAbsoluteAssetPath as vt, isSensitiveAttributeName as vu, isTtlRateLimited as w, deleteSkipReason as wa, prefetchCreateOnlyPropertyPaths as wc, expectedOwnerParam as wd, stateSecretNameNeedles as wi, identityKeyFor as wl, replayRollback as wn, carriesFetchableDynamicReference as wo, bindingSkippedOutputs as wr, malformedExportSourceWarning as ws, parentSuppliedValues as wt, rewriteTemplateAssetReferences as wu, resolvedResourceTimeoutMs as x, UNSPECIFIED_SKIP_REASON as xa, requireConfigArray as xc, uploadCfnTemplate as xd, secretNamePrintingBags as xi, isUncertifiedBaselineMaskPosition as xl, pendingMovesRefusalMessage as xn, getAccountInfo as xo, collectDeclaredOutputNames as xr, refuseMalformedOrphansForDestroy as xs, templateIdentity as xt, buildAssetRedirectMap as xu, streamTagsMatchDeclared as y, slowCcOperationTimeoutMs as ya, readConfigString as yc, MIGRATE_TMP_PREFIX as yd, orphanRecordsPrintingBag as yi, DYNAMIC_REFERENCE_TOKEN_SCAN as yl, hasPendingMovesOut as yn, isUnboundTemplateParameter as yo, isWholeDynamicReferenceValue as yr, malformedOrphansWarning as ys, listNestedTemplateRows as yt, stringifyValue as yu, reverseMapIndexContributorInsights as z, unsettledItemsOf as za, maskAtCoordinates as zc, ownValue as zd, earliestDefined as zi, wholeStringLeavesOf as zl, recordUnderIdIsNotOwn as zn, malformedOrphanRecordsRefusalMessage as zo, parseMappingFile as zr, refuseMalformedResourcesForExport as zs, recordRetainedForReadoption as zt, describeDockerExecFailure as zu };
|
|
57126
|
+
//# sourceMappingURL=deploy-engine-1ZXSkp13.js.map
|