cdk-real-drift 0.12.21 → 0.12.23
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/README.md +18 -6
- package/dist/cli.js +123 -29
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -803,9 +803,14 @@ covers them. **If you never run `revert`, cdkrd needs no write permissions at al
|
|
|
803
803
|
`dlm:GetLifecyclePolicy` (reads an `AWS::DLM::LifecyclePolicy` — a Data
|
|
804
804
|
Lifecycle Manager EBS-snapshot / AMI backup-schedule policy, NON_PROVISIONABLE
|
|
805
805
|
with no Cloud Control handlers; the physical id IS the policy id),
|
|
806
|
-
`dms:DescribeEndpoints` + `dms:DescribeReplicationSubnetGroups`
|
|
807
|
-
`
|
|
808
|
-
|
|
806
|
+
`dms:DescribeEndpoints` + `dms:DescribeReplicationSubnetGroups` +
|
|
807
|
+
`dms:DescribeReplicationInstances` + `dms:DescribeReplicationTasks` +
|
|
808
|
+
`dms:ListTagsForResource` (read an `AWS::DMS::Endpoint` /
|
|
809
|
+
`AWS::DMS::ReplicationSubnetGroup` / `AWS::DMS::ReplicationInstance` /
|
|
810
|
+
`AWS::DMS::ReplicationTask` — the classic DMS migration/CDC family,
|
|
811
|
+
NON_PROVISIONABLE with no Cloud Control handlers; `ListTagsForResource` reads
|
|
812
|
+
each resource's tags, which the `Describe*` responses omit — without it a
|
|
813
|
+
declared `Tags` false-flagged as drift on every tagged DMS resource),
|
|
809
814
|
`lakeformation:DescribeResource` (reads an `AWS::LakeFormation::Resource` — a
|
|
810
815
|
registered S3 data location whose Cloud Control `GetResource` returns
|
|
811
816
|
`UnsupportedActionException`; the physical id IS the location `ResourceArn`, and
|
|
@@ -855,9 +860,16 @@ covers them. **If you never run `revert`, cdkrd needs no write permissions at al
|
|
|
855
860
|
`HttpNamespace` / `PrivateDnsNamespace` / `PublicDnsNamespace` — incl. the Arn an
|
|
856
861
|
ECS Service Connect namespace `Fn::GetAtt` resolves against — and a Cloud Map
|
|
857
862
|
`Service`),
|
|
858
|
-
`docdb:DescribeDBClusters` + `docdb:DescribeDBInstances`
|
|
859
|
-
`
|
|
860
|
-
a Cloud Control read
|
|
863
|
+
`docdb:DescribeDBClusters` + `docdb:DescribeDBInstances` +
|
|
864
|
+
`rds:ListTagsForResource` (read an `AWS::DocDB::DBCluster` /
|
|
865
|
+
`AWS::DocDB::DBInstance` — the whole DocumentDB family is a Cloud Control read
|
|
866
|
+
gap; DocumentDB tag reads use the shared RDS `rds:ListTagsForResource` action,
|
|
867
|
+
which the `Describe*` responses omit — without it a declared `Tags`
|
|
868
|
+
false-flagged as drift on every tagged DocDB resource),
|
|
869
|
+
`sagemaker:DescribeEndpointConfig` + `sagemaker:ListTags` (read an
|
|
870
|
+
`AWS::SageMaker::EndpointConfig` — its production-variant model wiring, plus the
|
|
871
|
+
tags a separate `ListTags` call supplies since `DescribeEndpointConfig` omits
|
|
872
|
+
them),
|
|
861
873
|
`codebuild:BatchGetProjects` (reads an `AWS::CodeBuild::Project`) +
|
|
862
874
|
`codebuild:BatchGetReportGroups` (reads an `AWS::CodeBuild::ReportGroup`),
|
|
863
875
|
`dax:DescribeClusters` + `dax:DescribeParameterGroups` + `dax:DescribeParameters` +
|
package/dist/cli.js
CHANGED
|
@@ -32,7 +32,7 @@ import { BudgetsClient, DescribeBudgetCommand } from "@aws-sdk/client-budgets";
|
|
|
32
32
|
import { DescribeConfigurationSettingsCommand, ElasticBeanstalkClient, UpdateApplicationCommand, UpdateEnvironmentCommand } from "@aws-sdk/client-elastic-beanstalk";
|
|
33
33
|
import { CognitoSyncClient, GetCognitoEventsCommand, SetCognitoEventsCommand } from "@aws-sdk/client-cognito-sync";
|
|
34
34
|
import { BatchGetProjectsCommand, BatchGetReportGroupsCommand, CodeBuildClient, UpdateReportGroupCommand } from "@aws-sdk/client-codebuild";
|
|
35
|
-
import { DescribeDBClustersCommand as DescribeDBClustersCommand$1, DescribeDBInstancesCommand as DescribeDBInstancesCommand$1, DocDBClient, ModifyDBClusterCommand, ModifyDBInstanceCommand } from "@aws-sdk/client-docdb";
|
|
35
|
+
import { DescribeDBClustersCommand as DescribeDBClustersCommand$1, DescribeDBInstancesCommand as DescribeDBInstancesCommand$1, DocDBClient, ListTagsForResourceCommand, ModifyDBClusterCommand, ModifyDBInstanceCommand } from "@aws-sdk/client-docdb";
|
|
36
36
|
import { DAXClient, DescribeClustersCommand, DescribeParameterGroupsCommand, DescribeParametersCommand as DescribeParametersCommand$1, DescribeSubnetGroupsCommand, UpdateClusterCommand, UpdateParameterGroupCommand } from "@aws-sdk/client-dax";
|
|
37
37
|
import { GetClassifierCommand, GetConnectionCommand, GetJobCommand, GetSecurityConfigurationCommand, GetTableCommand, GetWorkflowCommand, GlueClient, UpdateClassifierCommand, UpdateConnectionCommand, UpdateJobCommand, UpdateTableCommand, UpdateWorkflowCommand } from "@aws-sdk/client-glue";
|
|
38
38
|
import { AttachGroupPolicyCommand, AttachRolePolicyCommand, AttachUserPolicyCommand, CreatePolicyVersionCommand, DeletePolicyVersionCommand, DeleteRolePolicyCommand, DetachGroupPolicyCommand, DetachRolePolicyCommand, DetachUserPolicyCommand, GetGroupPolicyCommand, GetPolicyCommand as GetPolicyCommand$1, GetPolicyVersionCommand, GetRolePolicyCommand, GetUserPolicyCommand, IAMClient, ListAccessKeysCommand, ListEntitiesForPolicyCommand, ListPolicyVersionsCommand, PutGroupPolicyCommand, PutRolePolicyCommand, PutUserPolicyCommand } from "@aws-sdk/client-iam";
|
|
@@ -41,7 +41,7 @@ import { DescribeCacheClustersCommand, DescribeCacheParameterGroupsCommand, Desc
|
|
|
41
41
|
import { DescribeParameterGroupsCommand as DescribeParameterGroupsCommand$1, DescribeParametersCommand as DescribeParametersCommand$2, DescribeUsersCommand as DescribeUsersCommand$1, MemoryDBClient, ResetParameterGroupCommand, UpdateParameterGroupCommand as UpdateParameterGroupCommand$1 } from "@aws-sdk/client-memorydb";
|
|
42
42
|
import { CloudWatchClient, DescribeAnomalyDetectorsCommand, PutAnomalyDetectorCommand } from "@aws-sdk/client-cloudwatch";
|
|
43
43
|
import { DLMClient, GetLifecyclePolicyCommand, UpdateLifecyclePolicyCommand } from "@aws-sdk/client-dlm";
|
|
44
|
-
import { DatabaseMigrationServiceClient, DescribeEndpointsCommand, DescribeReplicationInstancesCommand, DescribeReplicationSubnetGroupsCommand, DescribeReplicationTasksCommand } from "@aws-sdk/client-database-migration-service";
|
|
44
|
+
import { DatabaseMigrationServiceClient, DescribeEndpointsCommand, DescribeReplicationInstancesCommand, DescribeReplicationSubnetGroupsCommand, DescribeReplicationTasksCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$1 } from "@aws-sdk/client-database-migration-service";
|
|
45
45
|
import { DescribeResourceCommand, EntityNotFoundException, LakeFormationClient } from "@aws-sdk/client-lakeformation";
|
|
46
46
|
import { GetJobTemplateCommand, GetQueueCommand, MediaConvertClient } from "@aws-sdk/client-mediaconvert";
|
|
47
47
|
import { DescribeConfigurationCommand, DescribeConfigurationRevisionCommand, KafkaClient, UpdateConfigurationCommand } from "@aws-sdk/client-kafka";
|
|
@@ -49,7 +49,7 @@ import { GetWorkgroupCommand, RedshiftServerlessClient } from "@aws-sdk/client-r
|
|
|
49
49
|
import { BuildBotLocaleCommand, CreateIntentCommand, CreateSlotCommand, CreateSlotTypeCommand, DeleteIntentCommand, DeleteSlotCommand, DeleteSlotTypeCommand, DescribeBotLocaleCommand, DescribeIntentCommand, DescribeSlotCommand, DescribeSlotTypeCommand, LexModelsV2Client, ListBotLocalesCommand, ListIntentsCommand, ListSlotTypesCommand, ListSlotsCommand, UpdateBotLocaleCommand, UpdateIntentCommand, UpdateSlotCommand, UpdateSlotTypeCommand } from "@aws-sdk/client-lex-models-v2";
|
|
50
50
|
import { GetScheduleCommand, SchedulerClient } from "@aws-sdk/client-scheduler";
|
|
51
51
|
import { DescribeReceiptRuleCommand, DescribeReceiptRuleSetCommand, ListReceiptFiltersCommand, SESClient, UpdateReceiptRuleCommand } from "@aws-sdk/client-ses";
|
|
52
|
-
import { DescribeEndpointConfigCommand, SageMakerClient } from "@aws-sdk/client-sagemaker";
|
|
52
|
+
import { DescribeEndpointConfigCommand, ListTagsCommand, SageMakerClient } from "@aws-sdk/client-sagemaker";
|
|
53
53
|
import { GetNamespaceCommand, GetServiceCommand, ServiceDiscoveryClient, UpdateHttpNamespaceCommand } from "@aws-sdk/client-servicediscovery";
|
|
54
54
|
import { GetQueueAttributesCommand, SQSClient, SetQueueAttributesCommand } from "@aws-sdk/client-sqs";
|
|
55
55
|
import { createHash } from "node:crypto";
|
|
@@ -594,6 +594,19 @@ async function loadConfig() {
|
|
|
594
594
|
if (e.code === "ENOENT") return { ignore: [] };
|
|
595
595
|
throw e;
|
|
596
596
|
}
|
|
597
|
+
return parseConfigRaw(raw);
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* Validate-and-parse the decoded `.cdkrd/ignore.yaml` text into a `CdkrdConfig`. This is
|
|
601
|
+
* loadConfig's body AFTER the read+decode, factored out so a caller that ALREADY holds the
|
|
602
|
+
* raw bytes (addIgnoreRules' pre-write `existingRaw`) can derive the same validated config
|
|
603
|
+
* from the SAME snapshot — without a second `readFile`. Sharing one snapshot between the
|
|
604
|
+
* write basis and the dedupe basis is the #1290 fix: a peer rule that landed on disk between
|
|
605
|
+
* two separate reads would otherwise be in the dedupe basis but not the write basis, and get
|
|
606
|
+
* clobbered. Applies every guard loadConfig applied on read (syntax errors, alias/anchor,
|
|
607
|
+
* non-mapping, unknown top-level key, `ignore` typed as an array, per-entry validation).
|
|
608
|
+
*/
|
|
609
|
+
function parseConfigRaw(raw) {
|
|
597
610
|
let parsed;
|
|
598
611
|
const doc = parseDocument(raw, { prettyErrors: true });
|
|
599
612
|
const [firstError] = doc.errors;
|
|
@@ -798,6 +811,10 @@ async function atomicWrite(dest, content) {
|
|
|
798
811
|
* a concurrent `cdkrd` process, the on-disk config is RE-READ immediately before the write
|
|
799
812
|
* and the incoming rules merged against THAT fresh state — so a rule another process
|
|
800
813
|
* appended between our initial `loadConfig` and our write is preserved, not clobbered.
|
|
814
|
+
* The re-read is a SINGLE snapshot: both the write basis (`existingRaw`, re-emitted with its
|
|
815
|
+
* comments) and the dedupe basis (`parseConfigRaw(existingRaw)`) come from those same bytes,
|
|
816
|
+
* so a peer rule on disk is BOTH carried forward AND deduped against — never in one but not
|
|
817
|
+
* the other (#1290).
|
|
801
818
|
*/
|
|
802
819
|
async function addIgnoreRules(newRules) {
|
|
803
820
|
const firstPass = mergeIgnoreRules((await loadConfig()).ignore, newRules);
|
|
@@ -814,7 +831,7 @@ async function addIgnoreRules(newRules) {
|
|
|
814
831
|
} catch (e) {
|
|
815
832
|
if (e.code !== "ENOENT") throw e;
|
|
816
833
|
}
|
|
817
|
-
const { added, alreadyPresent } = mergeIgnoreRules(existingRaw !== void 0 && existingRaw.trim() !== "" ? (
|
|
834
|
+
const { added, alreadyPresent } = mergeIgnoreRules(existingRaw !== void 0 && existingRaw.trim() !== "" ? parseConfigRaw(existingRaw).ignore : [], newRules);
|
|
818
835
|
if (added.length === 0) return {
|
|
819
836
|
path: CONFIG_PATH,
|
|
820
837
|
added,
|
|
@@ -1275,7 +1292,7 @@ async function resolveStacks(a) {
|
|
|
1275
1292
|
const seen = /* @__PURE__ */ new Set();
|
|
1276
1293
|
const out = [];
|
|
1277
1294
|
const add = (stackName, region, account, template) => {
|
|
1278
|
-
const key = `${stackName}\0${region ?? ""}`;
|
|
1295
|
+
const key = `${stackName}\0${region ?? ""}\0${account ?? ""}`;
|
|
1279
1296
|
if (seen.has(key)) return;
|
|
1280
1297
|
seen.add(key);
|
|
1281
1298
|
out.push({
|
|
@@ -8777,6 +8794,21 @@ function safeDecode(s) {
|
|
|
8777
8794
|
return s;
|
|
8778
8795
|
}
|
|
8779
8796
|
}
|
|
8797
|
+
function projectTagList(tags) {
|
|
8798
|
+
const out = (tags ?? []).filter((t) => str$1(t.Key) !== void 0).map((t) => ({
|
|
8799
|
+
Key: t.Key,
|
|
8800
|
+
Value: t.Value ?? ""
|
|
8801
|
+
}));
|
|
8802
|
+
return out.length > 0 ? out : void 0;
|
|
8803
|
+
}
|
|
8804
|
+
function mirrorDeclaredTags(declaredTags) {
|
|
8805
|
+
if (!Array.isArray(declaredTags)) return void 0;
|
|
8806
|
+
const out = declaredTags.filter((t) => typeof t === "object" && t !== null).filter((t) => str$1(t.Key) !== void 0).map((t) => ({
|
|
8807
|
+
Key: t.Key,
|
|
8808
|
+
Value: str$1(t.Value) ?? ""
|
|
8809
|
+
}));
|
|
8810
|
+
return out.length > 0 ? out : void 0;
|
|
8811
|
+
}
|
|
8780
8812
|
const readS3BucketPolicy = async ({ declared, region }) => {
|
|
8781
8813
|
const bucket = str$1(declared.Bucket);
|
|
8782
8814
|
if (!bucket) return void 0;
|
|
@@ -9085,7 +9117,18 @@ const readDlmLifecyclePolicy = async ({ physicalId, declared, region }) => {
|
|
|
9085
9117
|
} else if (Object.keys(details).length > 0) model.PolicyDetails = details;
|
|
9086
9118
|
return model;
|
|
9087
9119
|
};
|
|
9088
|
-
|
|
9120
|
+
async function attachDmsTags(c, arn, declared, model, label) {
|
|
9121
|
+
try {
|
|
9122
|
+
const tags = projectTagList((await c.send(new ListTagsForResourceCommand$1({ ResourceArn: arn }))).TagList);
|
|
9123
|
+
if (tags) model.Tags = tags;
|
|
9124
|
+
} catch (err) {
|
|
9125
|
+
const mirrored = mirrorDeclaredTags(declared.Tags);
|
|
9126
|
+
if (mirrored) model.Tags = mirrored;
|
|
9127
|
+
const call = err?.name || "unknown error";
|
|
9128
|
+
process.stderr.write(`[cdkrd] warning: DMS ListTagsForResource for ${label} (${arn}) failed (${call}) — mirroring declared Tags to avoid a false drift; grant dms:ListTagsForResource to detect out-of-band tag changes\n`);
|
|
9129
|
+
}
|
|
9130
|
+
}
|
|
9131
|
+
const readDmsEndpoint = async ({ physicalId, declared, region }) => {
|
|
9089
9132
|
const id = str$1(physicalId);
|
|
9090
9133
|
if (!id) return void 0;
|
|
9091
9134
|
const c = new DatabaseMigrationServiceClient({
|
|
@@ -9110,27 +9153,36 @@ const readDmsEndpoint = async ({ physicalId, region }) => {
|
|
|
9110
9153
|
if (str$1(e.KmsKeyId)) model.KmsKeyId = e.KmsKeyId;
|
|
9111
9154
|
if (str$1(e.CertificateArn)) model.CertificateArn = e.CertificateArn;
|
|
9112
9155
|
if (str$1(e.SslMode)) model.SslMode = e.SslMode;
|
|
9156
|
+
const tagArn = str$1(e.EndpointArn) ?? (id.startsWith("arn:") ? id : void 0);
|
|
9157
|
+
if (tagArn) await attachDmsTags(c, tagArn, declared, model, "Endpoint");
|
|
9113
9158
|
return model;
|
|
9114
9159
|
};
|
|
9115
|
-
const readDmsReplicationSubnetGroup = async ({ physicalId, region }) => {
|
|
9160
|
+
const readDmsReplicationSubnetGroup = async ({ physicalId, declared, region, accountId }) => {
|
|
9116
9161
|
const id = str$1(physicalId);
|
|
9117
9162
|
if (!id) return void 0;
|
|
9118
|
-
const
|
|
9163
|
+
const c = new DatabaseMigrationServiceClient({
|
|
9119
9164
|
region,
|
|
9120
9165
|
...READ_RETRY
|
|
9121
|
-
})
|
|
9166
|
+
});
|
|
9167
|
+
const g = (await c.send(new DescribeReplicationSubnetGroupsCommand({ Filters: [{
|
|
9122
9168
|
Name: "replication-subnet-group-id",
|
|
9123
9169
|
Values: [id]
|
|
9124
9170
|
}] }))).ReplicationSubnetGroups?.[0];
|
|
9125
9171
|
if (!g) throw new ResourceGoneError(`DMS ReplicationSubnetGroup ${id} absent`);
|
|
9126
9172
|
const model = {};
|
|
9127
|
-
|
|
9173
|
+
const identifier = str$1(g.ReplicationSubnetGroupIdentifier);
|
|
9174
|
+
if (identifier) model.ReplicationSubnetGroupIdentifier = identifier;
|
|
9128
9175
|
if (str$1(g.ReplicationSubnetGroupDescription)) model.ReplicationSubnetGroupDescription = g.ReplicationSubnetGroupDescription;
|
|
9129
9176
|
const subnetIds = (g.Subnets ?? []).map((s) => str$1(s.SubnetIdentifier)).filter((v) => v !== void 0).sort();
|
|
9130
9177
|
if (subnetIds.length > 0) model.SubnetIds = subnetIds;
|
|
9178
|
+
const subgrpId = identifier ?? id;
|
|
9179
|
+
if (accountId && subgrpId) {
|
|
9180
|
+
const { partition } = partitionForRegion(region);
|
|
9181
|
+
await attachDmsTags(c, `arn:${partition}:dms:${region}:${accountId}:subgrp:${subgrpId}`, declared, model, "ReplicationSubnetGroup");
|
|
9182
|
+
}
|
|
9131
9183
|
return model;
|
|
9132
9184
|
};
|
|
9133
|
-
const readDmsReplicationInstance = async ({ physicalId, region }) => {
|
|
9185
|
+
const readDmsReplicationInstance = async ({ physicalId, declared, region }) => {
|
|
9134
9186
|
const id = str$1(physicalId);
|
|
9135
9187
|
if (!id) return void 0;
|
|
9136
9188
|
const c = new DatabaseMigrationServiceClient({
|
|
@@ -9154,12 +9206,16 @@ const readDmsReplicationInstance = async ({ physicalId, region }) => {
|
|
|
9154
9206
|
if (str$1(i.AvailabilityZone)) model.AvailabilityZone = i.AvailabilityZone;
|
|
9155
9207
|
if (str$1(i.PreferredMaintenanceWindow)) model.PreferredMaintenanceWindow = i.PreferredMaintenanceWindow;
|
|
9156
9208
|
if (str$1(i.KmsKeyId)) model.KmsKeyId = i.KmsKeyId;
|
|
9209
|
+
if (str$1(i.NetworkType)) model.NetworkType = i.NetworkType;
|
|
9210
|
+
if (str$1(i.DnsNameServers)) model.DnsNameServers = i.DnsNameServers;
|
|
9157
9211
|
if (str$1(i.ReplicationSubnetGroup?.ReplicationSubnetGroupIdentifier)) model.ReplicationSubnetGroupIdentifier = i.ReplicationSubnetGroup?.ReplicationSubnetGroupIdentifier;
|
|
9158
9212
|
const sgIds = (i.VpcSecurityGroups ?? []).map((g) => str$1(g.VpcSecurityGroupId)).filter((v) => v !== void 0).sort();
|
|
9159
9213
|
if (sgIds.length > 0) model.VpcSecurityGroupIds = sgIds;
|
|
9214
|
+
const tagArn = str$1(i.ReplicationInstanceArn) ?? (id.startsWith("arn:") ? id : void 0);
|
|
9215
|
+
if (tagArn) await attachDmsTags(c, tagArn, declared, model, "ReplicationInstance");
|
|
9160
9216
|
return model;
|
|
9161
9217
|
};
|
|
9162
|
-
const readDmsReplicationTask = async ({ physicalId, region }) => {
|
|
9218
|
+
const readDmsReplicationTask = async ({ physicalId, declared, region }) => {
|
|
9163
9219
|
const id = str$1(physicalId);
|
|
9164
9220
|
if (!id) return void 0;
|
|
9165
9221
|
const c = new DatabaseMigrationServiceClient({
|
|
@@ -9194,6 +9250,8 @@ const readDmsReplicationTask = async ({ physicalId, region }) => {
|
|
|
9194
9250
|
if (str$1(t.CdcStartPosition)) model.CdcStartPosition = t.CdcStartPosition;
|
|
9195
9251
|
if (str$1(t.CdcStopPosition)) model.CdcStopPosition = t.CdcStopPosition;
|
|
9196
9252
|
if (str$1(t.TaskData)) model.TaskData = t.TaskData;
|
|
9253
|
+
const tagArn = str$1(t.ReplicationTaskArn) ?? (id.startsWith("arn:") ? id : void 0);
|
|
9254
|
+
if (tagArn) await attachDmsTags(c, tagArn, declared, model, "ReplicationTask");
|
|
9197
9255
|
return model;
|
|
9198
9256
|
};
|
|
9199
9257
|
const readLakeFormationResource = async ({ physicalId, region }) => {
|
|
@@ -9749,13 +9807,14 @@ const projectSageMakerVariant = (v) => {
|
|
|
9749
9807
|
if (str$1(v.InferenceAmiVersion)) out.InferenceAmiVersion = v.InferenceAmiVersion;
|
|
9750
9808
|
return out;
|
|
9751
9809
|
};
|
|
9752
|
-
const readSageMakerEndpointConfig = async ({ physicalId, declared, region }) => {
|
|
9810
|
+
const readSageMakerEndpointConfig = async ({ physicalId, declared, region, accountId }) => {
|
|
9753
9811
|
const name = str$1(physicalId) ?? str$1(declared.EndpointConfigName);
|
|
9754
9812
|
if (!name) return void 0;
|
|
9755
|
-
const
|
|
9813
|
+
const c = new SageMakerClient({
|
|
9756
9814
|
region,
|
|
9757
9815
|
...READ_RETRY
|
|
9758
|
-
})
|
|
9816
|
+
});
|
|
9817
|
+
const r = await c.send(new DescribeEndpointConfigCommand({ EndpointConfigName: name }));
|
|
9759
9818
|
if (!r.EndpointConfigName) throw new ResourceGoneError(`SageMaker EndpointConfig ${name} absent`);
|
|
9760
9819
|
const model = {};
|
|
9761
9820
|
if (str$1(r.EndpointConfigName)) model.EndpointConfigName = r.EndpointConfigName;
|
|
@@ -9768,6 +9827,16 @@ const readSageMakerEndpointConfig = async ({ physicalId, declared, region }) =>
|
|
|
9768
9827
|
if (typeof r.EnableNetworkIsolation === "boolean") model.EnableNetworkIsolation = r.EnableNetworkIsolation;
|
|
9769
9828
|
if (str$1(r.ExecutionRoleArn)) model.ExecutionRoleArn = r.ExecutionRoleArn;
|
|
9770
9829
|
if (r.VpcConfig !== void 0) model.VpcConfig = r.VpcConfig;
|
|
9830
|
+
const tagArn = str$1(r.EndpointConfigArn) ?? (accountId ? `arn:${partitionForRegion(region).partition}:sagemaker:${region}:${accountId}:endpoint-config/${name}` : void 0);
|
|
9831
|
+
if (tagArn) try {
|
|
9832
|
+
const tags = projectTagList((await c.send(new ListTagsCommand({ ResourceArn: tagArn }))).Tags);
|
|
9833
|
+
if (tags) model.Tags = tags;
|
|
9834
|
+
} catch (err) {
|
|
9835
|
+
const mirrored = mirrorDeclaredTags(declared.Tags);
|
|
9836
|
+
if (mirrored) model.Tags = mirrored;
|
|
9837
|
+
const call = err?.name || "unknown error";
|
|
9838
|
+
process.stderr.write(`[cdkrd] warning: SageMaker ListTags for EndpointConfig (${tagArn}) failed (${call}) — mirroring declared Tags to avoid a false drift; grant sagemaker:ListTags to detect out-of-band tag changes\n`);
|
|
9839
|
+
}
|
|
9771
9840
|
return model;
|
|
9772
9841
|
};
|
|
9773
9842
|
const readMetricFilter = async ({ physicalId, declared, region }) => {
|
|
@@ -9971,13 +10040,25 @@ const readServiceDiscoveryService = async ({ physicalId, region }) => {
|
|
|
9971
10040
|
if (s.HealthCheckCustomConfig) model.HealthCheckCustomConfig = { ...s.HealthCheckCustomConfig.FailureThreshold !== void 0 && { FailureThreshold: s.HealthCheckCustomConfig.FailureThreshold } };
|
|
9972
10041
|
return model;
|
|
9973
10042
|
};
|
|
9974
|
-
|
|
10043
|
+
async function attachDocDbTags(c, arn, declared, model, label) {
|
|
10044
|
+
try {
|
|
10045
|
+
const tags = projectTagList((await c.send(new ListTagsForResourceCommand({ ResourceName: arn }))).TagList);
|
|
10046
|
+
if (tags) model.Tags = tags;
|
|
10047
|
+
} catch (err) {
|
|
10048
|
+
const mirrored = mirrorDeclaredTags(declared.Tags);
|
|
10049
|
+
if (mirrored) model.Tags = mirrored;
|
|
10050
|
+
const call = err?.name || "unknown error";
|
|
10051
|
+
process.stderr.write(`[cdkrd] warning: DocDB ListTagsForResource for ${label} (${arn}) failed (${call}) — mirroring declared Tags to avoid a false drift; grant rds:ListTagsForResource to detect out-of-band tag changes\n`);
|
|
10052
|
+
}
|
|
10053
|
+
}
|
|
10054
|
+
const readDocDbCluster = async ({ physicalId, declared, region, accountId }) => {
|
|
9975
10055
|
const id = str$1(physicalId) ?? str$1(declared.DBClusterIdentifier);
|
|
9976
10056
|
if (!id) return void 0;
|
|
9977
|
-
const
|
|
10057
|
+
const c = new DocDBClient({
|
|
9978
10058
|
region,
|
|
9979
10059
|
...READ_RETRY
|
|
9980
|
-
})
|
|
10060
|
+
});
|
|
10061
|
+
const cl = (await c.send(new DescribeDBClustersCommand$1({ DBClusterIdentifier: id }))).DBClusters?.[0];
|
|
9981
10062
|
if (!cl) return void 0;
|
|
9982
10063
|
const model = {};
|
|
9983
10064
|
if (cl.DBClusterIdentifier !== void 0) model.DBClusterIdentifier = cl.DBClusterIdentifier;
|
|
@@ -9994,15 +10075,18 @@ const readDocDbCluster = async ({ physicalId, declared, region }) => {
|
|
|
9994
10075
|
if (cl.DBClusterParameterGroup !== void 0) model.DBClusterParameterGroupName = cl.DBClusterParameterGroup;
|
|
9995
10076
|
const sgs = (cl.VpcSecurityGroups ?? []).map((g) => g.VpcSecurityGroupId).filter((s) => s !== void 0);
|
|
9996
10077
|
if (sgs.length > 0) model.VpcSecurityGroupIds = sgs;
|
|
10078
|
+
const tagArn = str$1(cl.DBClusterArn) ?? (accountId && id ? `arn:${partitionForRegion(region).partition}:rds:${region}:${accountId}:cluster:${id}` : void 0);
|
|
10079
|
+
if (tagArn) await attachDocDbTags(c, tagArn, declared, model, "DBCluster");
|
|
9997
10080
|
return model;
|
|
9998
10081
|
};
|
|
9999
|
-
const readDocDbInstance = async ({ physicalId, declared, region }) => {
|
|
10082
|
+
const readDocDbInstance = async ({ physicalId, declared, region, accountId }) => {
|
|
10000
10083
|
const id = str$1(physicalId) ?? str$1(declared.DBInstanceIdentifier);
|
|
10001
10084
|
if (!id) return void 0;
|
|
10002
|
-
const
|
|
10085
|
+
const c = new DocDBClient({
|
|
10003
10086
|
region,
|
|
10004
10087
|
...READ_RETRY
|
|
10005
|
-
})
|
|
10088
|
+
});
|
|
10089
|
+
const inst = (await c.send(new DescribeDBInstancesCommand$1({ DBInstanceIdentifier: id }))).DBInstances?.[0];
|
|
10006
10090
|
if (!inst) return void 0;
|
|
10007
10091
|
const model = {};
|
|
10008
10092
|
if (inst.DBInstanceIdentifier !== void 0) model.DBInstanceIdentifier = inst.DBInstanceIdentifier;
|
|
@@ -10012,6 +10096,8 @@ const readDocDbInstance = async ({ physicalId, declared, region }) => {
|
|
|
10012
10096
|
if (inst.PreferredMaintenanceWindow !== void 0) model.PreferredMaintenanceWindow = inst.PreferredMaintenanceWindow;
|
|
10013
10097
|
if (inst.CACertificateIdentifier !== void 0) model.CACertificateIdentifier = inst.CACertificateIdentifier;
|
|
10014
10098
|
if (inst.PerformanceInsightsEnabled !== void 0) model.EnablePerformanceInsights = inst.PerformanceInsightsEnabled;
|
|
10099
|
+
const tagArn = str$1(inst.DBInstanceArn) ?? (accountId && id ? `arn:${partitionForRegion(region).partition}:rds:${region}:${accountId}:db:${id}` : void 0);
|
|
10100
|
+
if (tagArn) await attachDocDbTags(c, tagArn, declared, model, "DBInstance");
|
|
10015
10101
|
return model;
|
|
10016
10102
|
};
|
|
10017
10103
|
const readAppSyncApiKey = async ({ physicalId, declared, region }) => {
|
|
@@ -17085,9 +17171,17 @@ function stringifySymbolSafe(v) {
|
|
|
17085
17171
|
if (typeof v === "symbol") return JSON.stringify(symbolMarker(v));
|
|
17086
17172
|
return JSON.stringify(v, symbolReplacer);
|
|
17087
17173
|
}
|
|
17174
|
+
function escapeBidiZeroWidth(s) {
|
|
17175
|
+
let out = "";
|
|
17176
|
+
for (const ch of s) {
|
|
17177
|
+
const code = ch.charCodeAt(0);
|
|
17178
|
+
out += isBidiOrZeroWidth(code) ? `\\u{${code.toString(16).toUpperCase()}}` : ch;
|
|
17179
|
+
}
|
|
17180
|
+
return out;
|
|
17181
|
+
}
|
|
17088
17182
|
function j(v) {
|
|
17089
17183
|
const s = stringifySymbolSafe(v);
|
|
17090
|
-
return s && s.length > VALUE_CAP ? safeSlice(s, 0, VALUE_CAP) + "…" : s ?? String(v);
|
|
17184
|
+
return escapeBidiZeroWidth(s && s.length > VALUE_CAP ? safeSlice(s, 0, VALUE_CAP) + "…" : s ?? String(v));
|
|
17091
17185
|
}
|
|
17092
17186
|
function sanitizeForTerminal(s) {
|
|
17093
17187
|
let out = "";
|
|
@@ -17106,8 +17200,8 @@ function jPair(a, b) {
|
|
|
17106
17200
|
const as = stringifySymbolSafe(a) ?? String(a);
|
|
17107
17201
|
const bs = stringifySymbolSafe(b) ?? String(b);
|
|
17108
17202
|
if (as.length <= VALUE_CAP && bs.length <= VALUE_CAP) return {
|
|
17109
|
-
a: as,
|
|
17110
|
-
b: bs
|
|
17203
|
+
a: escapeBidiZeroWidth(as),
|
|
17204
|
+
b: escapeBidiZeroWidth(bs)
|
|
17111
17205
|
};
|
|
17112
17206
|
let i = 0;
|
|
17113
17207
|
const min = Math.min(as.length, bs.length);
|
|
@@ -17117,7 +17211,7 @@ function jPair(a, b) {
|
|
|
17117
17211
|
let out = safeSlice(s, start, start + VALUE_CAP);
|
|
17118
17212
|
if (start > 0) out = `…${out}`;
|
|
17119
17213
|
if (start + VALUE_CAP < s.length) out = `${out}…`;
|
|
17120
|
-
return out;
|
|
17214
|
+
return escapeBidiZeroWidth(out);
|
|
17121
17215
|
};
|
|
17122
17216
|
return {
|
|
17123
17217
|
a: window(as),
|
|
@@ -17629,8 +17723,8 @@ async function perFinding(p, decidable) {
|
|
|
17629
17723
|
|
|
17630
17724
|
//#endregion
|
|
17631
17725
|
//#region src/commands/check.ts
|
|
17632
|
-
function synthKey(stackName, region) {
|
|
17633
|
-
return `${stackName}\0${region ?? ""}`;
|
|
17726
|
+
function synthKey(stackName, region, account) {
|
|
17727
|
+
return `${stackName}\0${region ?? ""}\0${account ?? ""}`;
|
|
17634
17728
|
}
|
|
17635
17729
|
function reconcileBaseline(findings, baseline, opts) {
|
|
17636
17730
|
if (opts.declaredOnly) return findings;
|
|
@@ -17879,7 +17973,7 @@ async function runCheck(args) {
|
|
|
17879
17973
|
emitEmptyJsonOnError();
|
|
17880
17974
|
return 2;
|
|
17881
17975
|
}
|
|
17882
|
-
synthTemplates = new Map(synthed.map((s) => [synthKey(s.stackName, s.region ?? a.region), s.template]));
|
|
17976
|
+
synthTemplates = new Map(synthed.map((s) => [synthKey(s.stackName, s.region ?? a.region, s.account), s.template]));
|
|
17883
17977
|
console.error("(--pre-deploy) comparing live state against the LOCAL synth template");
|
|
17884
17978
|
}
|
|
17885
17979
|
let worst = 0;
|
|
@@ -17921,7 +18015,7 @@ async function runCheck(args) {
|
|
|
17921
18015
|
worst = Math.max(worst, a.strict ? 1 : 0);
|
|
17922
18016
|
continue;
|
|
17923
18017
|
}
|
|
17924
|
-
const sKey = synthKey(stackName, region);
|
|
18018
|
+
const sKey = synthKey(stackName, region, account);
|
|
17925
18019
|
if (synthTemplates && !synthTemplates.has(sKey)) {
|
|
17926
18020
|
console.error(`note: ${stackName}: not in the synth output — skipped (--pre-deploy)`);
|
|
17927
18021
|
jsonError(stackName, region, "not in the synth output — skipped (--pre-deploy)");
|