cdk-real-drift 0.12.22 → 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 +105 -28
- 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";
|
|
@@ -1292,7 +1292,7 @@ async function resolveStacks(a) {
|
|
|
1292
1292
|
const seen = /* @__PURE__ */ new Set();
|
|
1293
1293
|
const out = [];
|
|
1294
1294
|
const add = (stackName, region, account, template) => {
|
|
1295
|
-
const key = `${stackName}\0${region ?? ""}`;
|
|
1295
|
+
const key = `${stackName}\0${region ?? ""}\0${account ?? ""}`;
|
|
1296
1296
|
if (seen.has(key)) return;
|
|
1297
1297
|
seen.add(key);
|
|
1298
1298
|
out.push({
|
|
@@ -8794,6 +8794,21 @@ function safeDecode(s) {
|
|
|
8794
8794
|
return s;
|
|
8795
8795
|
}
|
|
8796
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
|
+
}
|
|
8797
8812
|
const readS3BucketPolicy = async ({ declared, region }) => {
|
|
8798
8813
|
const bucket = str$1(declared.Bucket);
|
|
8799
8814
|
if (!bucket) return void 0;
|
|
@@ -9102,7 +9117,18 @@ const readDlmLifecyclePolicy = async ({ physicalId, declared, region }) => {
|
|
|
9102
9117
|
} else if (Object.keys(details).length > 0) model.PolicyDetails = details;
|
|
9103
9118
|
return model;
|
|
9104
9119
|
};
|
|
9105
|
-
|
|
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 }) => {
|
|
9106
9132
|
const id = str$1(physicalId);
|
|
9107
9133
|
if (!id) return void 0;
|
|
9108
9134
|
const c = new DatabaseMigrationServiceClient({
|
|
@@ -9127,27 +9153,36 @@ const readDmsEndpoint = async ({ physicalId, region }) => {
|
|
|
9127
9153
|
if (str$1(e.KmsKeyId)) model.KmsKeyId = e.KmsKeyId;
|
|
9128
9154
|
if (str$1(e.CertificateArn)) model.CertificateArn = e.CertificateArn;
|
|
9129
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");
|
|
9130
9158
|
return model;
|
|
9131
9159
|
};
|
|
9132
|
-
const readDmsReplicationSubnetGroup = async ({ physicalId, region }) => {
|
|
9160
|
+
const readDmsReplicationSubnetGroup = async ({ physicalId, declared, region, accountId }) => {
|
|
9133
9161
|
const id = str$1(physicalId);
|
|
9134
9162
|
if (!id) return void 0;
|
|
9135
|
-
const
|
|
9163
|
+
const c = new DatabaseMigrationServiceClient({
|
|
9136
9164
|
region,
|
|
9137
9165
|
...READ_RETRY
|
|
9138
|
-
})
|
|
9166
|
+
});
|
|
9167
|
+
const g = (await c.send(new DescribeReplicationSubnetGroupsCommand({ Filters: [{
|
|
9139
9168
|
Name: "replication-subnet-group-id",
|
|
9140
9169
|
Values: [id]
|
|
9141
9170
|
}] }))).ReplicationSubnetGroups?.[0];
|
|
9142
9171
|
if (!g) throw new ResourceGoneError(`DMS ReplicationSubnetGroup ${id} absent`);
|
|
9143
9172
|
const model = {};
|
|
9144
|
-
|
|
9173
|
+
const identifier = str$1(g.ReplicationSubnetGroupIdentifier);
|
|
9174
|
+
if (identifier) model.ReplicationSubnetGroupIdentifier = identifier;
|
|
9145
9175
|
if (str$1(g.ReplicationSubnetGroupDescription)) model.ReplicationSubnetGroupDescription = g.ReplicationSubnetGroupDescription;
|
|
9146
9176
|
const subnetIds = (g.Subnets ?? []).map((s) => str$1(s.SubnetIdentifier)).filter((v) => v !== void 0).sort();
|
|
9147
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
|
+
}
|
|
9148
9183
|
return model;
|
|
9149
9184
|
};
|
|
9150
|
-
const readDmsReplicationInstance = async ({ physicalId, region }) => {
|
|
9185
|
+
const readDmsReplicationInstance = async ({ physicalId, declared, region }) => {
|
|
9151
9186
|
const id = str$1(physicalId);
|
|
9152
9187
|
if (!id) return void 0;
|
|
9153
9188
|
const c = new DatabaseMigrationServiceClient({
|
|
@@ -9171,12 +9206,16 @@ const readDmsReplicationInstance = async ({ physicalId, region }) => {
|
|
|
9171
9206
|
if (str$1(i.AvailabilityZone)) model.AvailabilityZone = i.AvailabilityZone;
|
|
9172
9207
|
if (str$1(i.PreferredMaintenanceWindow)) model.PreferredMaintenanceWindow = i.PreferredMaintenanceWindow;
|
|
9173
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;
|
|
9174
9211
|
if (str$1(i.ReplicationSubnetGroup?.ReplicationSubnetGroupIdentifier)) model.ReplicationSubnetGroupIdentifier = i.ReplicationSubnetGroup?.ReplicationSubnetGroupIdentifier;
|
|
9175
9212
|
const sgIds = (i.VpcSecurityGroups ?? []).map((g) => str$1(g.VpcSecurityGroupId)).filter((v) => v !== void 0).sort();
|
|
9176
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");
|
|
9177
9216
|
return model;
|
|
9178
9217
|
};
|
|
9179
|
-
const readDmsReplicationTask = async ({ physicalId, region }) => {
|
|
9218
|
+
const readDmsReplicationTask = async ({ physicalId, declared, region }) => {
|
|
9180
9219
|
const id = str$1(physicalId);
|
|
9181
9220
|
if (!id) return void 0;
|
|
9182
9221
|
const c = new DatabaseMigrationServiceClient({
|
|
@@ -9211,6 +9250,8 @@ const readDmsReplicationTask = async ({ physicalId, region }) => {
|
|
|
9211
9250
|
if (str$1(t.CdcStartPosition)) model.CdcStartPosition = t.CdcStartPosition;
|
|
9212
9251
|
if (str$1(t.CdcStopPosition)) model.CdcStopPosition = t.CdcStopPosition;
|
|
9213
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");
|
|
9214
9255
|
return model;
|
|
9215
9256
|
};
|
|
9216
9257
|
const readLakeFormationResource = async ({ physicalId, region }) => {
|
|
@@ -9766,13 +9807,14 @@ const projectSageMakerVariant = (v) => {
|
|
|
9766
9807
|
if (str$1(v.InferenceAmiVersion)) out.InferenceAmiVersion = v.InferenceAmiVersion;
|
|
9767
9808
|
return out;
|
|
9768
9809
|
};
|
|
9769
|
-
const readSageMakerEndpointConfig = async ({ physicalId, declared, region }) => {
|
|
9810
|
+
const readSageMakerEndpointConfig = async ({ physicalId, declared, region, accountId }) => {
|
|
9770
9811
|
const name = str$1(physicalId) ?? str$1(declared.EndpointConfigName);
|
|
9771
9812
|
if (!name) return void 0;
|
|
9772
|
-
const
|
|
9813
|
+
const c = new SageMakerClient({
|
|
9773
9814
|
region,
|
|
9774
9815
|
...READ_RETRY
|
|
9775
|
-
})
|
|
9816
|
+
});
|
|
9817
|
+
const r = await c.send(new DescribeEndpointConfigCommand({ EndpointConfigName: name }));
|
|
9776
9818
|
if (!r.EndpointConfigName) throw new ResourceGoneError(`SageMaker EndpointConfig ${name} absent`);
|
|
9777
9819
|
const model = {};
|
|
9778
9820
|
if (str$1(r.EndpointConfigName)) model.EndpointConfigName = r.EndpointConfigName;
|
|
@@ -9785,6 +9827,16 @@ const readSageMakerEndpointConfig = async ({ physicalId, declared, region }) =>
|
|
|
9785
9827
|
if (typeof r.EnableNetworkIsolation === "boolean") model.EnableNetworkIsolation = r.EnableNetworkIsolation;
|
|
9786
9828
|
if (str$1(r.ExecutionRoleArn)) model.ExecutionRoleArn = r.ExecutionRoleArn;
|
|
9787
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
|
+
}
|
|
9788
9840
|
return model;
|
|
9789
9841
|
};
|
|
9790
9842
|
const readMetricFilter = async ({ physicalId, declared, region }) => {
|
|
@@ -9988,13 +10040,25 @@ const readServiceDiscoveryService = async ({ physicalId, region }) => {
|
|
|
9988
10040
|
if (s.HealthCheckCustomConfig) model.HealthCheckCustomConfig = { ...s.HealthCheckCustomConfig.FailureThreshold !== void 0 && { FailureThreshold: s.HealthCheckCustomConfig.FailureThreshold } };
|
|
9989
10041
|
return model;
|
|
9990
10042
|
};
|
|
9991
|
-
|
|
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 }) => {
|
|
9992
10055
|
const id = str$1(physicalId) ?? str$1(declared.DBClusterIdentifier);
|
|
9993
10056
|
if (!id) return void 0;
|
|
9994
|
-
const
|
|
10057
|
+
const c = new DocDBClient({
|
|
9995
10058
|
region,
|
|
9996
10059
|
...READ_RETRY
|
|
9997
|
-
})
|
|
10060
|
+
});
|
|
10061
|
+
const cl = (await c.send(new DescribeDBClustersCommand$1({ DBClusterIdentifier: id }))).DBClusters?.[0];
|
|
9998
10062
|
if (!cl) return void 0;
|
|
9999
10063
|
const model = {};
|
|
10000
10064
|
if (cl.DBClusterIdentifier !== void 0) model.DBClusterIdentifier = cl.DBClusterIdentifier;
|
|
@@ -10011,15 +10075,18 @@ const readDocDbCluster = async ({ physicalId, declared, region }) => {
|
|
|
10011
10075
|
if (cl.DBClusterParameterGroup !== void 0) model.DBClusterParameterGroupName = cl.DBClusterParameterGroup;
|
|
10012
10076
|
const sgs = (cl.VpcSecurityGroups ?? []).map((g) => g.VpcSecurityGroupId).filter((s) => s !== void 0);
|
|
10013
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");
|
|
10014
10080
|
return model;
|
|
10015
10081
|
};
|
|
10016
|
-
const readDocDbInstance = async ({ physicalId, declared, region }) => {
|
|
10082
|
+
const readDocDbInstance = async ({ physicalId, declared, region, accountId }) => {
|
|
10017
10083
|
const id = str$1(physicalId) ?? str$1(declared.DBInstanceIdentifier);
|
|
10018
10084
|
if (!id) return void 0;
|
|
10019
|
-
const
|
|
10085
|
+
const c = new DocDBClient({
|
|
10020
10086
|
region,
|
|
10021
10087
|
...READ_RETRY
|
|
10022
|
-
})
|
|
10088
|
+
});
|
|
10089
|
+
const inst = (await c.send(new DescribeDBInstancesCommand$1({ DBInstanceIdentifier: id }))).DBInstances?.[0];
|
|
10023
10090
|
if (!inst) return void 0;
|
|
10024
10091
|
const model = {};
|
|
10025
10092
|
if (inst.DBInstanceIdentifier !== void 0) model.DBInstanceIdentifier = inst.DBInstanceIdentifier;
|
|
@@ -10029,6 +10096,8 @@ const readDocDbInstance = async ({ physicalId, declared, region }) => {
|
|
|
10029
10096
|
if (inst.PreferredMaintenanceWindow !== void 0) model.PreferredMaintenanceWindow = inst.PreferredMaintenanceWindow;
|
|
10030
10097
|
if (inst.CACertificateIdentifier !== void 0) model.CACertificateIdentifier = inst.CACertificateIdentifier;
|
|
10031
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");
|
|
10032
10101
|
return model;
|
|
10033
10102
|
};
|
|
10034
10103
|
const readAppSyncApiKey = async ({ physicalId, declared, region }) => {
|
|
@@ -17102,9 +17171,17 @@ function stringifySymbolSafe(v) {
|
|
|
17102
17171
|
if (typeof v === "symbol") return JSON.stringify(symbolMarker(v));
|
|
17103
17172
|
return JSON.stringify(v, symbolReplacer);
|
|
17104
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
|
+
}
|
|
17105
17182
|
function j(v) {
|
|
17106
17183
|
const s = stringifySymbolSafe(v);
|
|
17107
|
-
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));
|
|
17108
17185
|
}
|
|
17109
17186
|
function sanitizeForTerminal(s) {
|
|
17110
17187
|
let out = "";
|
|
@@ -17123,8 +17200,8 @@ function jPair(a, b) {
|
|
|
17123
17200
|
const as = stringifySymbolSafe(a) ?? String(a);
|
|
17124
17201
|
const bs = stringifySymbolSafe(b) ?? String(b);
|
|
17125
17202
|
if (as.length <= VALUE_CAP && bs.length <= VALUE_CAP) return {
|
|
17126
|
-
a: as,
|
|
17127
|
-
b: bs
|
|
17203
|
+
a: escapeBidiZeroWidth(as),
|
|
17204
|
+
b: escapeBidiZeroWidth(bs)
|
|
17128
17205
|
};
|
|
17129
17206
|
let i = 0;
|
|
17130
17207
|
const min = Math.min(as.length, bs.length);
|
|
@@ -17134,7 +17211,7 @@ function jPair(a, b) {
|
|
|
17134
17211
|
let out = safeSlice(s, start, start + VALUE_CAP);
|
|
17135
17212
|
if (start > 0) out = `…${out}`;
|
|
17136
17213
|
if (start + VALUE_CAP < s.length) out = `${out}…`;
|
|
17137
|
-
return out;
|
|
17214
|
+
return escapeBidiZeroWidth(out);
|
|
17138
17215
|
};
|
|
17139
17216
|
return {
|
|
17140
17217
|
a: window(as),
|
|
@@ -17646,8 +17723,8 @@ async function perFinding(p, decidable) {
|
|
|
17646
17723
|
|
|
17647
17724
|
//#endregion
|
|
17648
17725
|
//#region src/commands/check.ts
|
|
17649
|
-
function synthKey(stackName, region) {
|
|
17650
|
-
return `${stackName}\0${region ?? ""}`;
|
|
17726
|
+
function synthKey(stackName, region, account) {
|
|
17727
|
+
return `${stackName}\0${region ?? ""}\0${account ?? ""}`;
|
|
17651
17728
|
}
|
|
17652
17729
|
function reconcileBaseline(findings, baseline, opts) {
|
|
17653
17730
|
if (opts.declaredOnly) return findings;
|
|
@@ -17896,7 +17973,7 @@ async function runCheck(args) {
|
|
|
17896
17973
|
emitEmptyJsonOnError();
|
|
17897
17974
|
return 2;
|
|
17898
17975
|
}
|
|
17899
|
-
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]));
|
|
17900
17977
|
console.error("(--pre-deploy) comparing live state against the LOCAL synth template");
|
|
17901
17978
|
}
|
|
17902
17979
|
let worst = 0;
|
|
@@ -17938,7 +18015,7 @@ async function runCheck(args) {
|
|
|
17938
18015
|
worst = Math.max(worst, a.strict ? 1 : 0);
|
|
17939
18016
|
continue;
|
|
17940
18017
|
}
|
|
17941
|
-
const sKey = synthKey(stackName, region);
|
|
18018
|
+
const sKey = synthKey(stackName, region, account);
|
|
17942
18019
|
if (synthTemplates && !synthTemplates.has(sKey)) {
|
|
17943
18020
|
console.error(`note: ${stackName}: not in the synth output — skipped (--pre-deploy)`);
|
|
17944
18021
|
jsonError(stackName, region, "not in the synth output — skipped (--pre-deploy)");
|