cdk-real-drift 0.12.22 → 0.12.24
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 +106 -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({
|
|
@@ -1865,6 +1865,7 @@ const KNOWN_DEFAULTS = {
|
|
|
1865
1865
|
},
|
|
1866
1866
|
"AWS::S3::Bucket": {
|
|
1867
1867
|
VersioningConfiguration: { Status: "Suspended" },
|
|
1868
|
+
AccelerateConfiguration: { AccelerationStatus: "Suspended" },
|
|
1868
1869
|
AbacStatus: "Disabled",
|
|
1869
1870
|
PublicAccessBlockConfiguration: {
|
|
1870
1871
|
RestrictPublicBuckets: true,
|
|
@@ -8794,6 +8795,21 @@ function safeDecode(s) {
|
|
|
8794
8795
|
return s;
|
|
8795
8796
|
}
|
|
8796
8797
|
}
|
|
8798
|
+
function projectTagList(tags) {
|
|
8799
|
+
const out = (tags ?? []).filter((t) => str$1(t.Key) !== void 0).map((t) => ({
|
|
8800
|
+
Key: t.Key,
|
|
8801
|
+
Value: t.Value ?? ""
|
|
8802
|
+
}));
|
|
8803
|
+
return out.length > 0 ? out : void 0;
|
|
8804
|
+
}
|
|
8805
|
+
function mirrorDeclaredTags(declaredTags) {
|
|
8806
|
+
if (!Array.isArray(declaredTags)) return void 0;
|
|
8807
|
+
const out = declaredTags.filter((t) => typeof t === "object" && t !== null).filter((t) => str$1(t.Key) !== void 0).map((t) => ({
|
|
8808
|
+
Key: t.Key,
|
|
8809
|
+
Value: str$1(t.Value) ?? ""
|
|
8810
|
+
}));
|
|
8811
|
+
return out.length > 0 ? out : void 0;
|
|
8812
|
+
}
|
|
8797
8813
|
const readS3BucketPolicy = async ({ declared, region }) => {
|
|
8798
8814
|
const bucket = str$1(declared.Bucket);
|
|
8799
8815
|
if (!bucket) return void 0;
|
|
@@ -9102,7 +9118,18 @@ const readDlmLifecyclePolicy = async ({ physicalId, declared, region }) => {
|
|
|
9102
9118
|
} else if (Object.keys(details).length > 0) model.PolicyDetails = details;
|
|
9103
9119
|
return model;
|
|
9104
9120
|
};
|
|
9105
|
-
|
|
9121
|
+
async function attachDmsTags(c, arn, declared, model, label) {
|
|
9122
|
+
try {
|
|
9123
|
+
const tags = projectTagList((await c.send(new ListTagsForResourceCommand$1({ ResourceArn: arn }))).TagList);
|
|
9124
|
+
if (tags) model.Tags = tags;
|
|
9125
|
+
} catch (err) {
|
|
9126
|
+
const mirrored = mirrorDeclaredTags(declared.Tags);
|
|
9127
|
+
if (mirrored) model.Tags = mirrored;
|
|
9128
|
+
const call = err?.name || "unknown error";
|
|
9129
|
+
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`);
|
|
9130
|
+
}
|
|
9131
|
+
}
|
|
9132
|
+
const readDmsEndpoint = async ({ physicalId, declared, region }) => {
|
|
9106
9133
|
const id = str$1(physicalId);
|
|
9107
9134
|
if (!id) return void 0;
|
|
9108
9135
|
const c = new DatabaseMigrationServiceClient({
|
|
@@ -9127,27 +9154,36 @@ const readDmsEndpoint = async ({ physicalId, region }) => {
|
|
|
9127
9154
|
if (str$1(e.KmsKeyId)) model.KmsKeyId = e.KmsKeyId;
|
|
9128
9155
|
if (str$1(e.CertificateArn)) model.CertificateArn = e.CertificateArn;
|
|
9129
9156
|
if (str$1(e.SslMode)) model.SslMode = e.SslMode;
|
|
9157
|
+
const tagArn = str$1(e.EndpointArn) ?? (id.startsWith("arn:") ? id : void 0);
|
|
9158
|
+
if (tagArn) await attachDmsTags(c, tagArn, declared, model, "Endpoint");
|
|
9130
9159
|
return model;
|
|
9131
9160
|
};
|
|
9132
|
-
const readDmsReplicationSubnetGroup = async ({ physicalId, region }) => {
|
|
9161
|
+
const readDmsReplicationSubnetGroup = async ({ physicalId, declared, region, accountId }) => {
|
|
9133
9162
|
const id = str$1(physicalId);
|
|
9134
9163
|
if (!id) return void 0;
|
|
9135
|
-
const
|
|
9164
|
+
const c = new DatabaseMigrationServiceClient({
|
|
9136
9165
|
region,
|
|
9137
9166
|
...READ_RETRY
|
|
9138
|
-
})
|
|
9167
|
+
});
|
|
9168
|
+
const g = (await c.send(new DescribeReplicationSubnetGroupsCommand({ Filters: [{
|
|
9139
9169
|
Name: "replication-subnet-group-id",
|
|
9140
9170
|
Values: [id]
|
|
9141
9171
|
}] }))).ReplicationSubnetGroups?.[0];
|
|
9142
9172
|
if (!g) throw new ResourceGoneError(`DMS ReplicationSubnetGroup ${id} absent`);
|
|
9143
9173
|
const model = {};
|
|
9144
|
-
|
|
9174
|
+
const identifier = str$1(g.ReplicationSubnetGroupIdentifier);
|
|
9175
|
+
if (identifier) model.ReplicationSubnetGroupIdentifier = identifier;
|
|
9145
9176
|
if (str$1(g.ReplicationSubnetGroupDescription)) model.ReplicationSubnetGroupDescription = g.ReplicationSubnetGroupDescription;
|
|
9146
9177
|
const subnetIds = (g.Subnets ?? []).map((s) => str$1(s.SubnetIdentifier)).filter((v) => v !== void 0).sort();
|
|
9147
9178
|
if (subnetIds.length > 0) model.SubnetIds = subnetIds;
|
|
9179
|
+
const subgrpId = identifier ?? id;
|
|
9180
|
+
if (accountId && subgrpId) {
|
|
9181
|
+
const { partition } = partitionForRegion(region);
|
|
9182
|
+
await attachDmsTags(c, `arn:${partition}:dms:${region}:${accountId}:subgrp:${subgrpId}`, declared, model, "ReplicationSubnetGroup");
|
|
9183
|
+
}
|
|
9148
9184
|
return model;
|
|
9149
9185
|
};
|
|
9150
|
-
const readDmsReplicationInstance = async ({ physicalId, region }) => {
|
|
9186
|
+
const readDmsReplicationInstance = async ({ physicalId, declared, region }) => {
|
|
9151
9187
|
const id = str$1(physicalId);
|
|
9152
9188
|
if (!id) return void 0;
|
|
9153
9189
|
const c = new DatabaseMigrationServiceClient({
|
|
@@ -9171,12 +9207,16 @@ const readDmsReplicationInstance = async ({ physicalId, region }) => {
|
|
|
9171
9207
|
if (str$1(i.AvailabilityZone)) model.AvailabilityZone = i.AvailabilityZone;
|
|
9172
9208
|
if (str$1(i.PreferredMaintenanceWindow)) model.PreferredMaintenanceWindow = i.PreferredMaintenanceWindow;
|
|
9173
9209
|
if (str$1(i.KmsKeyId)) model.KmsKeyId = i.KmsKeyId;
|
|
9210
|
+
if (str$1(i.NetworkType)) model.NetworkType = i.NetworkType;
|
|
9211
|
+
if (str$1(i.DnsNameServers)) model.DnsNameServers = i.DnsNameServers;
|
|
9174
9212
|
if (str$1(i.ReplicationSubnetGroup?.ReplicationSubnetGroupIdentifier)) model.ReplicationSubnetGroupIdentifier = i.ReplicationSubnetGroup?.ReplicationSubnetGroupIdentifier;
|
|
9175
9213
|
const sgIds = (i.VpcSecurityGroups ?? []).map((g) => str$1(g.VpcSecurityGroupId)).filter((v) => v !== void 0).sort();
|
|
9176
9214
|
if (sgIds.length > 0) model.VpcSecurityGroupIds = sgIds;
|
|
9215
|
+
const tagArn = str$1(i.ReplicationInstanceArn) ?? (id.startsWith("arn:") ? id : void 0);
|
|
9216
|
+
if (tagArn) await attachDmsTags(c, tagArn, declared, model, "ReplicationInstance");
|
|
9177
9217
|
return model;
|
|
9178
9218
|
};
|
|
9179
|
-
const readDmsReplicationTask = async ({ physicalId, region }) => {
|
|
9219
|
+
const readDmsReplicationTask = async ({ physicalId, declared, region }) => {
|
|
9180
9220
|
const id = str$1(physicalId);
|
|
9181
9221
|
if (!id) return void 0;
|
|
9182
9222
|
const c = new DatabaseMigrationServiceClient({
|
|
@@ -9211,6 +9251,8 @@ const readDmsReplicationTask = async ({ physicalId, region }) => {
|
|
|
9211
9251
|
if (str$1(t.CdcStartPosition)) model.CdcStartPosition = t.CdcStartPosition;
|
|
9212
9252
|
if (str$1(t.CdcStopPosition)) model.CdcStopPosition = t.CdcStopPosition;
|
|
9213
9253
|
if (str$1(t.TaskData)) model.TaskData = t.TaskData;
|
|
9254
|
+
const tagArn = str$1(t.ReplicationTaskArn) ?? (id.startsWith("arn:") ? id : void 0);
|
|
9255
|
+
if (tagArn) await attachDmsTags(c, tagArn, declared, model, "ReplicationTask");
|
|
9214
9256
|
return model;
|
|
9215
9257
|
};
|
|
9216
9258
|
const readLakeFormationResource = async ({ physicalId, region }) => {
|
|
@@ -9766,13 +9808,14 @@ const projectSageMakerVariant = (v) => {
|
|
|
9766
9808
|
if (str$1(v.InferenceAmiVersion)) out.InferenceAmiVersion = v.InferenceAmiVersion;
|
|
9767
9809
|
return out;
|
|
9768
9810
|
};
|
|
9769
|
-
const readSageMakerEndpointConfig = async ({ physicalId, declared, region }) => {
|
|
9811
|
+
const readSageMakerEndpointConfig = async ({ physicalId, declared, region, accountId }) => {
|
|
9770
9812
|
const name = str$1(physicalId) ?? str$1(declared.EndpointConfigName);
|
|
9771
9813
|
if (!name) return void 0;
|
|
9772
|
-
const
|
|
9814
|
+
const c = new SageMakerClient({
|
|
9773
9815
|
region,
|
|
9774
9816
|
...READ_RETRY
|
|
9775
|
-
})
|
|
9817
|
+
});
|
|
9818
|
+
const r = await c.send(new DescribeEndpointConfigCommand({ EndpointConfigName: name }));
|
|
9776
9819
|
if (!r.EndpointConfigName) throw new ResourceGoneError(`SageMaker EndpointConfig ${name} absent`);
|
|
9777
9820
|
const model = {};
|
|
9778
9821
|
if (str$1(r.EndpointConfigName)) model.EndpointConfigName = r.EndpointConfigName;
|
|
@@ -9785,6 +9828,16 @@ const readSageMakerEndpointConfig = async ({ physicalId, declared, region }) =>
|
|
|
9785
9828
|
if (typeof r.EnableNetworkIsolation === "boolean") model.EnableNetworkIsolation = r.EnableNetworkIsolation;
|
|
9786
9829
|
if (str$1(r.ExecutionRoleArn)) model.ExecutionRoleArn = r.ExecutionRoleArn;
|
|
9787
9830
|
if (r.VpcConfig !== void 0) model.VpcConfig = r.VpcConfig;
|
|
9831
|
+
const tagArn = str$1(r.EndpointConfigArn) ?? (accountId ? `arn:${partitionForRegion(region).partition}:sagemaker:${region}:${accountId}:endpoint-config/${name}` : void 0);
|
|
9832
|
+
if (tagArn) try {
|
|
9833
|
+
const tags = projectTagList((await c.send(new ListTagsCommand({ ResourceArn: tagArn }))).Tags);
|
|
9834
|
+
if (tags) model.Tags = tags;
|
|
9835
|
+
} catch (err) {
|
|
9836
|
+
const mirrored = mirrorDeclaredTags(declared.Tags);
|
|
9837
|
+
if (mirrored) model.Tags = mirrored;
|
|
9838
|
+
const call = err?.name || "unknown error";
|
|
9839
|
+
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`);
|
|
9840
|
+
}
|
|
9788
9841
|
return model;
|
|
9789
9842
|
};
|
|
9790
9843
|
const readMetricFilter = async ({ physicalId, declared, region }) => {
|
|
@@ -9988,13 +10041,25 @@ const readServiceDiscoveryService = async ({ physicalId, region }) => {
|
|
|
9988
10041
|
if (s.HealthCheckCustomConfig) model.HealthCheckCustomConfig = { ...s.HealthCheckCustomConfig.FailureThreshold !== void 0 && { FailureThreshold: s.HealthCheckCustomConfig.FailureThreshold } };
|
|
9989
10042
|
return model;
|
|
9990
10043
|
};
|
|
9991
|
-
|
|
10044
|
+
async function attachDocDbTags(c, arn, declared, model, label) {
|
|
10045
|
+
try {
|
|
10046
|
+
const tags = projectTagList((await c.send(new ListTagsForResourceCommand({ ResourceName: arn }))).TagList);
|
|
10047
|
+
if (tags) model.Tags = tags;
|
|
10048
|
+
} catch (err) {
|
|
10049
|
+
const mirrored = mirrorDeclaredTags(declared.Tags);
|
|
10050
|
+
if (mirrored) model.Tags = mirrored;
|
|
10051
|
+
const call = err?.name || "unknown error";
|
|
10052
|
+
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`);
|
|
10053
|
+
}
|
|
10054
|
+
}
|
|
10055
|
+
const readDocDbCluster = async ({ physicalId, declared, region, accountId }) => {
|
|
9992
10056
|
const id = str$1(physicalId) ?? str$1(declared.DBClusterIdentifier);
|
|
9993
10057
|
if (!id) return void 0;
|
|
9994
|
-
const
|
|
10058
|
+
const c = new DocDBClient({
|
|
9995
10059
|
region,
|
|
9996
10060
|
...READ_RETRY
|
|
9997
|
-
})
|
|
10061
|
+
});
|
|
10062
|
+
const cl = (await c.send(new DescribeDBClustersCommand$1({ DBClusterIdentifier: id }))).DBClusters?.[0];
|
|
9998
10063
|
if (!cl) return void 0;
|
|
9999
10064
|
const model = {};
|
|
10000
10065
|
if (cl.DBClusterIdentifier !== void 0) model.DBClusterIdentifier = cl.DBClusterIdentifier;
|
|
@@ -10011,15 +10076,18 @@ const readDocDbCluster = async ({ physicalId, declared, region }) => {
|
|
|
10011
10076
|
if (cl.DBClusterParameterGroup !== void 0) model.DBClusterParameterGroupName = cl.DBClusterParameterGroup;
|
|
10012
10077
|
const sgs = (cl.VpcSecurityGroups ?? []).map((g) => g.VpcSecurityGroupId).filter((s) => s !== void 0);
|
|
10013
10078
|
if (sgs.length > 0) model.VpcSecurityGroupIds = sgs;
|
|
10079
|
+
const tagArn = str$1(cl.DBClusterArn) ?? (accountId && id ? `arn:${partitionForRegion(region).partition}:rds:${region}:${accountId}:cluster:${id}` : void 0);
|
|
10080
|
+
if (tagArn) await attachDocDbTags(c, tagArn, declared, model, "DBCluster");
|
|
10014
10081
|
return model;
|
|
10015
10082
|
};
|
|
10016
|
-
const readDocDbInstance = async ({ physicalId, declared, region }) => {
|
|
10083
|
+
const readDocDbInstance = async ({ physicalId, declared, region, accountId }) => {
|
|
10017
10084
|
const id = str$1(physicalId) ?? str$1(declared.DBInstanceIdentifier);
|
|
10018
10085
|
if (!id) return void 0;
|
|
10019
|
-
const
|
|
10086
|
+
const c = new DocDBClient({
|
|
10020
10087
|
region,
|
|
10021
10088
|
...READ_RETRY
|
|
10022
|
-
})
|
|
10089
|
+
});
|
|
10090
|
+
const inst = (await c.send(new DescribeDBInstancesCommand$1({ DBInstanceIdentifier: id }))).DBInstances?.[0];
|
|
10023
10091
|
if (!inst) return void 0;
|
|
10024
10092
|
const model = {};
|
|
10025
10093
|
if (inst.DBInstanceIdentifier !== void 0) model.DBInstanceIdentifier = inst.DBInstanceIdentifier;
|
|
@@ -10029,6 +10097,8 @@ const readDocDbInstance = async ({ physicalId, declared, region }) => {
|
|
|
10029
10097
|
if (inst.PreferredMaintenanceWindow !== void 0) model.PreferredMaintenanceWindow = inst.PreferredMaintenanceWindow;
|
|
10030
10098
|
if (inst.CACertificateIdentifier !== void 0) model.CACertificateIdentifier = inst.CACertificateIdentifier;
|
|
10031
10099
|
if (inst.PerformanceInsightsEnabled !== void 0) model.EnablePerformanceInsights = inst.PerformanceInsightsEnabled;
|
|
10100
|
+
const tagArn = str$1(inst.DBInstanceArn) ?? (accountId && id ? `arn:${partitionForRegion(region).partition}:rds:${region}:${accountId}:db:${id}` : void 0);
|
|
10101
|
+
if (tagArn) await attachDocDbTags(c, tagArn, declared, model, "DBInstance");
|
|
10032
10102
|
return model;
|
|
10033
10103
|
};
|
|
10034
10104
|
const readAppSyncApiKey = async ({ physicalId, declared, region }) => {
|
|
@@ -17102,9 +17172,17 @@ function stringifySymbolSafe(v) {
|
|
|
17102
17172
|
if (typeof v === "symbol") return JSON.stringify(symbolMarker(v));
|
|
17103
17173
|
return JSON.stringify(v, symbolReplacer);
|
|
17104
17174
|
}
|
|
17175
|
+
function escapeBidiZeroWidth(s) {
|
|
17176
|
+
let out = "";
|
|
17177
|
+
for (const ch of s) {
|
|
17178
|
+
const code = ch.charCodeAt(0);
|
|
17179
|
+
out += isBidiOrZeroWidth(code) ? `\\u{${code.toString(16).toUpperCase()}}` : ch;
|
|
17180
|
+
}
|
|
17181
|
+
return out;
|
|
17182
|
+
}
|
|
17105
17183
|
function j(v) {
|
|
17106
17184
|
const s = stringifySymbolSafe(v);
|
|
17107
|
-
return s && s.length > VALUE_CAP ? safeSlice(s, 0, VALUE_CAP) + "…" : s ?? String(v);
|
|
17185
|
+
return escapeBidiZeroWidth(s && s.length > VALUE_CAP ? safeSlice(s, 0, VALUE_CAP) + "…" : s ?? String(v));
|
|
17108
17186
|
}
|
|
17109
17187
|
function sanitizeForTerminal(s) {
|
|
17110
17188
|
let out = "";
|
|
@@ -17123,8 +17201,8 @@ function jPair(a, b) {
|
|
|
17123
17201
|
const as = stringifySymbolSafe(a) ?? String(a);
|
|
17124
17202
|
const bs = stringifySymbolSafe(b) ?? String(b);
|
|
17125
17203
|
if (as.length <= VALUE_CAP && bs.length <= VALUE_CAP) return {
|
|
17126
|
-
a: as,
|
|
17127
|
-
b: bs
|
|
17204
|
+
a: escapeBidiZeroWidth(as),
|
|
17205
|
+
b: escapeBidiZeroWidth(bs)
|
|
17128
17206
|
};
|
|
17129
17207
|
let i = 0;
|
|
17130
17208
|
const min = Math.min(as.length, bs.length);
|
|
@@ -17134,7 +17212,7 @@ function jPair(a, b) {
|
|
|
17134
17212
|
let out = safeSlice(s, start, start + VALUE_CAP);
|
|
17135
17213
|
if (start > 0) out = `…${out}`;
|
|
17136
17214
|
if (start + VALUE_CAP < s.length) out = `${out}…`;
|
|
17137
|
-
return out;
|
|
17215
|
+
return escapeBidiZeroWidth(out);
|
|
17138
17216
|
};
|
|
17139
17217
|
return {
|
|
17140
17218
|
a: window(as),
|
|
@@ -17646,8 +17724,8 @@ async function perFinding(p, decidable) {
|
|
|
17646
17724
|
|
|
17647
17725
|
//#endregion
|
|
17648
17726
|
//#region src/commands/check.ts
|
|
17649
|
-
function synthKey(stackName, region) {
|
|
17650
|
-
return `${stackName}\0${region ?? ""}`;
|
|
17727
|
+
function synthKey(stackName, region, account) {
|
|
17728
|
+
return `${stackName}\0${region ?? ""}\0${account ?? ""}`;
|
|
17651
17729
|
}
|
|
17652
17730
|
function reconcileBaseline(findings, baseline, opts) {
|
|
17653
17731
|
if (opts.declaredOnly) return findings;
|
|
@@ -17896,7 +17974,7 @@ async function runCheck(args) {
|
|
|
17896
17974
|
emitEmptyJsonOnError();
|
|
17897
17975
|
return 2;
|
|
17898
17976
|
}
|
|
17899
|
-
synthTemplates = new Map(synthed.map((s) => [synthKey(s.stackName, s.region ?? a.region), s.template]));
|
|
17977
|
+
synthTemplates = new Map(synthed.map((s) => [synthKey(s.stackName, s.region ?? a.region, s.account), s.template]));
|
|
17900
17978
|
console.error("(--pre-deploy) comparing live state against the LOCAL synth template");
|
|
17901
17979
|
}
|
|
17902
17980
|
let worst = 0;
|
|
@@ -17938,7 +18016,7 @@ async function runCheck(args) {
|
|
|
17938
18016
|
worst = Math.max(worst, a.strict ? 1 : 0);
|
|
17939
18017
|
continue;
|
|
17940
18018
|
}
|
|
17941
|
-
const sKey = synthKey(stackName, region);
|
|
18019
|
+
const sKey = synthKey(stackName, region, account);
|
|
17942
18020
|
if (synthTemplates && !synthTemplates.has(sKey)) {
|
|
17943
18021
|
console.error(`note: ${stackName}: not in the synth output — skipped (--pre-deploy)`);
|
|
17944
18022
|
jsonError(stackName, region, "not in the synth output — skipped (--pre-deploy)");
|