cdk-real-drift 0.12.29 → 0.12.31
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 +26 -11
- package/dist/cli.js +165 -34
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -802,7 +802,9 @@ covers them. **If you never run `revert`, cdkrd needs no write permissions at al
|
|
|
802
802
|
handlers),
|
|
803
803
|
`dlm:GetLifecyclePolicy` (reads an `AWS::DLM::LifecyclePolicy` — a Data
|
|
804
804
|
Lifecycle Manager EBS-snapshot / AMI backup-schedule policy, NON_PROVISIONABLE
|
|
805
|
-
with no Cloud Control handlers; the physical id IS the policy id
|
|
805
|
+
with no Cloud Control handlers; the physical id IS the policy id, and the same
|
|
806
|
+
`GetLifecyclePolicy` response carries the policy's `Tags` — no extra call — so a
|
|
807
|
+
declared `Tags` is not false-flagged as drift),
|
|
806
808
|
`dms:DescribeEndpoints` + `dms:DescribeReplicationSubnetGroups` +
|
|
807
809
|
`dms:DescribeReplicationInstances` + `dms:DescribeReplicationTasks` +
|
|
808
810
|
`dms:ListTagsForResource` (read an `AWS::DMS::Endpoint` /
|
|
@@ -815,21 +817,27 @@ covers them. **If you never run `revert`, cdkrd needs no write permissions at al
|
|
|
815
817
|
registered S3 data location whose Cloud Control `GetResource` returns
|
|
816
818
|
`UnsupportedActionException`; the physical id IS the location `ResourceArn`, and
|
|
817
819
|
the reader projects `RoleArn` / `WithFederation` / `HybridAccessEnabled`),
|
|
818
|
-
`mediaconvert:GetQueue` + `mediaconvert:GetJobTemplate`
|
|
820
|
+
`mediaconvert:GetQueue` + `mediaconvert:GetJobTemplate` +
|
|
821
|
+
`mediaconvert:ListTagsForResource` (read an
|
|
819
822
|
`AWS::MediaConvert::Queue` / `AWS::MediaConvert::JobTemplate` — a video-pipeline
|
|
820
823
|
staple, NON_PROVISIONABLE with no Cloud Control handlers; the physical id IS the
|
|
821
|
-
resource name
|
|
824
|
+
resource name, and `ListTagsForResource` reads each resource's tags, which the
|
|
825
|
+
`Get*` responses omit — without it a declared `Tags` false-flagged as drift on
|
|
826
|
+
every tagged MediaConvert resource),
|
|
822
827
|
`ssm:DescribeParameters` (supplements the Cloud Control read of an
|
|
823
828
|
`AWS::SSM::Parameter` with its writeOnly `Description` / `AllowedPattern`),
|
|
824
829
|
`elasticache:DescribeReplicationGroups` + `elasticache:DescribeCacheClusters`
|
|
825
830
|
(supplement an `AWS::ElastiCache::ReplicationGroup` with its writeOnly
|
|
826
831
|
`PreferredMaintenanceWindow` / `NotificationTopicArn` / `EngineVersion`, read
|
|
827
832
|
from the member cache cluster),
|
|
828
|
-
`elasticache:DescribeCacheParameterGroups` + `elasticache:DescribeCacheParameters`
|
|
833
|
+
`elasticache:DescribeCacheParameterGroups` + `elasticache:DescribeCacheParameters` +
|
|
834
|
+
`elasticache:ListTagsForResource`
|
|
829
835
|
(read an `AWS::ElastiCache::ParameterGroup`'s `Properties` as the `Source=user`
|
|
830
836
|
MODIFIED set only — the Cloud Control read returns the full effective set, so the
|
|
831
837
|
~60 inherited engine defaults would otherwise surface as first-run drift; an
|
|
832
|
-
out-of-band parameter change is `Source=user` and still detected
|
|
838
|
+
out-of-band parameter change is `Source=user` and still detected;
|
|
839
|
+
`ListTagsForResource` reads the group's tags, which the `Describe*` responses
|
|
840
|
+
omit — without it a declared `Tags` false-flagged as drift on every tagged group),
|
|
833
841
|
`ecs:DescribeServices` (supplements an
|
|
834
842
|
`AWS::ECS::Service` with its writeOnly `ServiceConnectConfiguration` /
|
|
835
843
|
`VolumeConfigurations`, read from the PRIMARY deployment),
|
|
@@ -856,10 +864,13 @@ covers them. **If you never run `revert`, cdkrd needs no write permissions at al
|
|
|
856
864
|
full resolved option set; an out-of-band console edit to any environment option
|
|
857
865
|
is otherwise invisible, and the service-filled default options fold to
|
|
858
866
|
`atDefault`),
|
|
859
|
-
`servicediscovery:GetNamespace` + `servicediscovery:GetService`
|
|
867
|
+
`servicediscovery:GetNamespace` + `servicediscovery:GetService` +
|
|
868
|
+
`servicediscovery:ListTagsForResource` (read a Cloud Map
|
|
860
869
|
`HttpNamespace` / `PrivateDnsNamespace` / `PublicDnsNamespace` — incl. the Arn an
|
|
861
870
|
ECS Service Connect namespace `Fn::GetAtt` resolves against — and a Cloud Map
|
|
862
|
-
`Service`
|
|
871
|
+
`Service`; `ListTagsForResource` reads each resource's tags, which the `Get*`
|
|
872
|
+
responses omit — without it a declared `Tags` false-flagged as drift on every
|
|
873
|
+
tagged Cloud Map resource),
|
|
863
874
|
`docdb:DescribeDBClusters` + `docdb:DescribeDBInstances` +
|
|
864
875
|
`rds:ListTagsForResource` (read an `AWS::DocDB::DBCluster` /
|
|
865
876
|
`AWS::DocDB::DBInstance` — the whole DocumentDB family is a Cloud Control read
|
|
@@ -873,8 +884,10 @@ covers them. **If you never run `revert`, cdkrd needs no write permissions at al
|
|
|
873
884
|
`codebuild:BatchGetProjects` (reads an `AWS::CodeBuild::Project`) +
|
|
874
885
|
`codebuild:BatchGetReportGroups` (reads an `AWS::CodeBuild::ReportGroup`),
|
|
875
886
|
`dax:DescribeClusters` + `dax:DescribeParameterGroups` + `dax:DescribeParameters` +
|
|
876
|
-
`dax:DescribeSubnetGroups` (read an `AWS::DAX::Cluster` /
|
|
877
|
-
`SubnetGroup` — the DynamoDB Accelerator family
|
|
887
|
+
`dax:DescribeSubnetGroups` + `dax:ListTags` (read an `AWS::DAX::Cluster` /
|
|
888
|
+
`ParameterGroup` / `SubnetGroup` — the DynamoDB Accelerator family; `ListTags`
|
|
889
|
+
reads a cluster's tags, which `DescribeClusters` omits — without it a declared
|
|
890
|
+
`Tags` false-flagged as drift on every tagged DAX cluster),
|
|
878
891
|
`ec2:DescribeClientVpnEndpoints` + `ec2:DescribeClientVpnAuthorizationRules` +
|
|
879
892
|
`ec2:DescribeClientVpnTargetNetworks` (read an `AWS::EC2::ClientVpnEndpoint` /
|
|
880
893
|
`ClientVpnAuthorizationRule` / `ClientVpnTargetNetworkAssociation`),
|
|
@@ -883,10 +896,12 @@ covers them. **If you never run `revert`, cdkrd needs no write permissions at al
|
|
|
883
896
|
`appsync:ListApiKeys` (reads an `AWS::AppSync::ApiKey` — a Cloud Control gap),
|
|
884
897
|
`cognito-sync:GetCognitoEvents` (enriches the Cloud Control read of an
|
|
885
898
|
`AWS::Cognito::IdentityPool` with its writeOnly `CognitoEvents` Sync trigger),
|
|
886
|
-
`glue:GetClassifier` + `glue:GetWorkflow` + `glue:GetConnection`
|
|
899
|
+
`glue:GetClassifier` + `glue:GetWorkflow` + `glue:GetConnection` + `glue:GetTags`
|
|
887
900
|
(`glue:GetConnection` is issued with `HidePassword` so NO credential enters the
|
|
888
901
|
baseline — read an `AWS::Glue::Classifier` / `Workflow` / `Connection`, the rest
|
|
889
|
-
of the Glue family that has no Cloud Control handler
|
|
902
|
+
of the Glue family that has no Cloud Control handler; `glue:GetTags` reads a
|
|
903
|
+
workflow's tags, which `GetWorkflow` omits — without it a declared `Tags`
|
|
904
|
+
false-flagged as drift on every tagged Glue workflow),
|
|
890
905
|
`rds:DescribeOptionGroupOptions` (reads an `AWS::RDS::OptionGroup`'s option-default
|
|
891
906
|
catalog — the `DefaultValue` AWS materializes for every plugin setting the template
|
|
892
907
|
did not declare — so the service default-fill folds to `atDefault` instead of
|
package/dist/cli.js
CHANGED
|
@@ -33,24 +33,24 @@ import { DescribeConfigurationSettingsCommand, ElasticBeanstalkClient, UpdateApp
|
|
|
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
35
|
import { DescribeDBClustersCommand as DescribeDBClustersCommand$1, DescribeDBInstancesCommand as DescribeDBInstancesCommand$1, DocDBClient, ListTagsForResourceCommand, ModifyDBClusterCommand, ModifyDBInstanceCommand } from "@aws-sdk/client-docdb";
|
|
36
|
-
import { DAXClient, DescribeClustersCommand, DescribeParameterGroupsCommand, DescribeParametersCommand as DescribeParametersCommand$1, DescribeSubnetGroupsCommand, UpdateClusterCommand, UpdateParameterGroupCommand } from "@aws-sdk/client-dax";
|
|
37
|
-
import { GetClassifierCommand, GetConnectionCommand, GetJobCommand, GetSecurityConfigurationCommand, GetTableCommand, GetWorkflowCommand, GlueClient, UpdateClassifierCommand, UpdateConnectionCommand, UpdateJobCommand, UpdateTableCommand, UpdateWorkflowCommand } from "@aws-sdk/client-glue";
|
|
36
|
+
import { DAXClient, DescribeClustersCommand, DescribeParameterGroupsCommand, DescribeParametersCommand as DescribeParametersCommand$1, DescribeSubnetGroupsCommand, ListTagsCommand, UpdateClusterCommand, UpdateParameterGroupCommand } from "@aws-sdk/client-dax";
|
|
37
|
+
import { GetClassifierCommand, GetConnectionCommand, GetJobCommand, GetSecurityConfigurationCommand, GetTableCommand, GetTagsCommand, 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";
|
|
39
39
|
import { DeleteBucketPolicyCommand, GetBucketPolicyCommand, GetObjectCommand, PutBucketPolicyCommand, S3Client } from "@aws-sdk/client-s3";
|
|
40
|
-
import { DescribeCacheClustersCommand, DescribeCacheParameterGroupsCommand, DescribeCacheParametersCommand, DescribeReplicationGroupsCommand, DescribeUsersCommand, ElastiCacheClient, ModifyCacheParameterGroupCommand, ResetCacheParameterGroupCommand } from "@aws-sdk/client-elasticache";
|
|
40
|
+
import { DescribeCacheClustersCommand, DescribeCacheParameterGroupsCommand, DescribeCacheParametersCommand, DescribeReplicationGroupsCommand, DescribeUsersCommand, ElastiCacheClient, ListTagsForResourceCommand as ListTagsForResourceCommand$1, ModifyCacheParameterGroupCommand, ResetCacheParameterGroupCommand } from "@aws-sdk/client-elasticache";
|
|
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, ListTagsForResourceCommand as ListTagsForResourceCommand$
|
|
44
|
+
import { DatabaseMigrationServiceClient, DescribeEndpointsCommand, DescribeReplicationInstancesCommand, DescribeReplicationSubnetGroupsCommand, DescribeReplicationTasksCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$2 } from "@aws-sdk/client-database-migration-service";
|
|
45
45
|
import { DescribeResourceCommand, EntityNotFoundException, LakeFormationClient } from "@aws-sdk/client-lakeformation";
|
|
46
|
-
import { GetJobTemplateCommand, GetQueueCommand, MediaConvertClient } from "@aws-sdk/client-mediaconvert";
|
|
46
|
+
import { GetJobTemplateCommand, GetQueueCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$3, MediaConvertClient } from "@aws-sdk/client-mediaconvert";
|
|
47
47
|
import { DescribeConfigurationCommand, DescribeConfigurationRevisionCommand, KafkaClient, UpdateConfigurationCommand } from "@aws-sdk/client-kafka";
|
|
48
48
|
import { GetWorkgroupCommand, RedshiftServerlessClient } from "@aws-sdk/client-redshift-serverless";
|
|
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, ListTagsCommand, SageMakerClient } from "@aws-sdk/client-sagemaker";
|
|
53
|
-
import { GetNamespaceCommand, GetServiceCommand, ServiceDiscoveryClient, UpdateHttpNamespaceCommand } from "@aws-sdk/client-servicediscovery";
|
|
52
|
+
import { DescribeEndpointConfigCommand, ListTagsCommand as ListTagsCommand$1, SageMakerClient } from "@aws-sdk/client-sagemaker";
|
|
53
|
+
import { GetNamespaceCommand, GetServiceCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$4, 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";
|
|
56
56
|
import { S_BAR, S_BAR_END, S_BAR_START, S_CHECKBOX_INACTIVE, S_CHECKBOX_SELECTED, confirm, isCancel, select, spinner } from "@clack/prompts";
|
|
@@ -1142,6 +1142,35 @@ function cleanupEmptyContextFile(file, existedBefore) {
|
|
|
1142
1142
|
if (isEmptyContextJson(readFileSync(file, "utf-8"))) rmSync(file);
|
|
1143
1143
|
} catch {}
|
|
1144
1144
|
}
|
|
1145
|
+
const ASSEMBLY_FRESHNESS_TOLERANCE_MS = 2e3;
|
|
1146
|
+
/**
|
|
1147
|
+
* Verify the cloud assembly's manifest.json was (re)written by THIS synth run (#1323).
|
|
1148
|
+
*
|
|
1149
|
+
* Only meaningful on the `--app` COMMAND path (`isDir === false`): toolkit-lib runs the app
|
|
1150
|
+
* subprocess, resolves the outdir to `<cwd>/cdk.out`, then reads whatever manifest.json is
|
|
1151
|
+
* there — it never checks the subprocess actually WROTE one. An app that exits 0 without
|
|
1152
|
+
* synthesizing (a no-op wrapper, a script that swallows a synth failure, a dropped
|
|
1153
|
+
* `app.synth()`) makes cdkrd silently consume the STALE assembly a PRIOR run left behind.
|
|
1154
|
+
* That stale template becomes the DESIRED state, so `check` reports false declared drift and
|
|
1155
|
+
* `revert --yes` writes stale values back to AWS. Fail LOUDLY instead.
|
|
1156
|
+
*
|
|
1157
|
+
* The DIRECTORY path (`isDir === true`, `fromAssemblyDirectory`) is INTENTIONAL stale
|
|
1158
|
+
* consumption (the user points at a pre-synth assembly), so this is a no-op there.
|
|
1159
|
+
*
|
|
1160
|
+
* `synthStart` is a `Date.now()` captured just BEFORE `toolkit.synth`. Staleness =
|
|
1161
|
+
* `mtimeMs < synthStart - ASSEMBLY_FRESHNESS_TOLERANCE_MS`. A missing manifest is also treated
|
|
1162
|
+
* as failure (toolkit-lib normally throws ENOENT first, but the defensive check keeps the
|
|
1163
|
+
* loud, actionable message). Pure + exported so the freshness logic is unit-testable against a
|
|
1164
|
+
* real temp file whose mtime we control, without driving a real assembly.
|
|
1165
|
+
*/
|
|
1166
|
+
function assertAssemblyFresh(manifestPath, synthStart, isDir) {
|
|
1167
|
+
if (isDir) return;
|
|
1168
|
+
const stale = () => {
|
|
1169
|
+
throw new Error(`the --app command exited 0 but did not produce a cloud assembly (${manifestPath} was not written by this run) — the app must synthesize a cloud assembly (did app.synth()/the CDK app run?)`);
|
|
1170
|
+
};
|
|
1171
|
+
if (!existsSync(manifestPath)) stale();
|
|
1172
|
+
if (statSync(manifestPath).mtimeMs < synthStart - 2e3) stale();
|
|
1173
|
+
}
|
|
1145
1174
|
async function synthApp(app, opts = {}) {
|
|
1146
1175
|
const { region, profile, context = {} } = opts;
|
|
1147
1176
|
const stackSelector = buildStackSelector(opts.stackPatterns);
|
|
@@ -1174,9 +1203,11 @@ async function synthApp(app, opts = {}) {
|
|
|
1174
1203
|
...hasOverrides && { contextStore: new CdkAppMultiContext(process.cwd(), context) }
|
|
1175
1204
|
});
|
|
1176
1205
|
}
|
|
1206
|
+
const synthStart = Date.now();
|
|
1177
1207
|
const cached = await toolkit.synth(source, stackSelector ? { stacks: stackSelector } : void 0);
|
|
1178
1208
|
if (!isDir) cleanupEmptyContextFile(contextFile, contextFileExistedBefore);
|
|
1179
1209
|
try {
|
|
1210
|
+
assertAssemblyFresh(join(cached.cloudAssembly.directory, "manifest.json"), synthStart, isDir);
|
|
1180
1211
|
const missingKeys = missingContextKeys(collectMissingRecursively(cached.cloudAssembly));
|
|
1181
1212
|
if (missingKeys.length > 0) {
|
|
1182
1213
|
const msg = missingContextWarning(missingKeys, { preDeploy: opts.preDeploy });
|
|
@@ -4302,6 +4333,7 @@ function unpreviewableParamInfo(template, stackParams, stackName) {
|
|
|
4302
4333
|
}).map(([k]) => k);
|
|
4303
4334
|
if (noValue.length === 0) return null;
|
|
4304
4335
|
const referenced = collectReferencedNames(template.Resources ?? {});
|
|
4336
|
+
collectReferencedNames(template.Conditions ?? {}, referenced);
|
|
4305
4337
|
const unpreviewable = noValue.filter((k) => referenced.has(k)).sort();
|
|
4306
4338
|
if (unpreviewable.length === 0) return null;
|
|
4307
4339
|
const shown = unpreviewable.slice(0, 10);
|
|
@@ -5559,7 +5591,7 @@ function matchesKnownDefault(live, def) {
|
|
|
5559
5591
|
if (!isNestedObject(live) || !isNestedObject(def)) return false;
|
|
5560
5592
|
return Object.entries(live).every(([k, v]) => k in def ? matchesKnownDefault(v, def[k]) : isTrivialEmpty(v));
|
|
5561
5593
|
}
|
|
5562
|
-
function collectNestedUndeclared(declaredVal, liveVal, path, emit, nestedArrayIdentity) {
|
|
5594
|
+
function collectNestedUndeclared(declaredVal, liveVal, path, emit, nestedArrayIdentity, declaredAbsent = false) {
|
|
5563
5595
|
if (Array.isArray(declaredVal) && Array.isArray(liveVal)) {
|
|
5564
5596
|
if (declaredVal.length === 0 || liveVal.length === 0) return;
|
|
5565
5597
|
const regId = nestedArrayIdentity?.[path.replace(/\[[^\]]*\]/g, "")];
|
|
@@ -5603,7 +5635,7 @@ function collectNestedUndeclared(declaredVal, liveVal, path, emit, nestedArrayId
|
|
|
5603
5635
|
}
|
|
5604
5636
|
if (!isNestedObject(declaredVal) || !isNestedObject(liveVal)) return;
|
|
5605
5637
|
if (Object.keys(liveVal).some((k) => PATH_UNSAFE_KEY.test(k))) {
|
|
5606
|
-
if (
|
|
5638
|
+
if (declaredAbsent) emit(path, liveVal);
|
|
5607
5639
|
return;
|
|
5608
5640
|
}
|
|
5609
5641
|
for (const [k, val] of Object.entries(liveVal)) {
|
|
@@ -6653,7 +6685,7 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
|
|
|
6653
6685
|
}) ?? false);
|
|
6654
6686
|
if (!offStateIsMeaningful && (isTrivialEmpty(v) || isSelfEchoTrivialEmpty(v, physicalId) || isEmptyPolicyShell(v))) continue;
|
|
6655
6687
|
if (isNestedObject(v) && DESCEND_UNDECLARED_OBJECT_PATHS[resourceType]?.has(k)) {
|
|
6656
|
-
collectNestedUndeclared({}, v, k, emitNested, NESTED_ARRAY_IDENTITY[resourceType]);
|
|
6688
|
+
collectNestedUndeclared({}, v, k, emitNested, NESTED_ARRAY_IDENTITY[resourceType], true);
|
|
6657
6689
|
continue;
|
|
6658
6690
|
}
|
|
6659
6691
|
const subsetSpecU = IDENTITY_KEYED_SUBSET_ARRAYS[resourceType]?.[k];
|
|
@@ -6757,6 +6789,8 @@ function unqualifiedFunctionRef(ref) {
|
|
|
6757
6789
|
if (seg.length >= 8 && seg[5] === "function") return seg.slice(0, 7).join(":");
|
|
6758
6790
|
return ref;
|
|
6759
6791
|
}
|
|
6792
|
+
const partial = ref.match(/^\d{12}:function:([^:]+)/);
|
|
6793
|
+
if (partial) return partial[1];
|
|
6760
6794
|
const i = ref.indexOf(":");
|
|
6761
6795
|
return i === -1 ? ref : ref.slice(0, i);
|
|
6762
6796
|
}
|
|
@@ -7477,7 +7511,7 @@ async function enumerateLambdaFunctionChildren(ctx) {
|
|
|
7477
7511
|
for (const r of desired.resources) {
|
|
7478
7512
|
if (r.resourceType !== "AWS::Lambda::Url") continue;
|
|
7479
7513
|
const target = r.declared.TargetFunctionArn;
|
|
7480
|
-
if (
|
|
7514
|
+
if (lambdaFunctionRefMatches(target, functionName, fnArn)) {
|
|
7481
7515
|
if (fnArn !== void 0) declaredUrlArns.push(fnArn);
|
|
7482
7516
|
if (r.physicalId) declaredUrlArns.push(r.physicalId);
|
|
7483
7517
|
} else if (r.physicalId) declaredUrlArns.push(r.physicalId);
|
|
@@ -7485,7 +7519,7 @@ async function enumerateLambdaFunctionChildren(ctx) {
|
|
|
7485
7519
|
const declaredAliasArns = [];
|
|
7486
7520
|
for (const r of desired.resources) {
|
|
7487
7521
|
if (r.resourceType !== "AWS::Lambda::Alias" || !r.physicalId) continue;
|
|
7488
|
-
if (
|
|
7522
|
+
if (lambdaFunctionRefMatches(r.declared.FunctionName, functionName, fnArn)) declaredAliasArns.push(r.physicalId);
|
|
7489
7523
|
}
|
|
7490
7524
|
const declaredVersionArns = [];
|
|
7491
7525
|
for (const r of desired.resources) {
|
|
@@ -8824,6 +8858,31 @@ function mirrorDeclaredTags(declaredTags) {
|
|
|
8824
8858
|
}));
|
|
8825
8859
|
return out.length > 0 ? out : void 0;
|
|
8826
8860
|
}
|
|
8861
|
+
function projectTagMap(tags) {
|
|
8862
|
+
const out = {};
|
|
8863
|
+
for (const [k, v] of Object.entries(tags ?? {})) {
|
|
8864
|
+
if (str$1(k) === void 0) continue;
|
|
8865
|
+
out[k] = v ?? "";
|
|
8866
|
+
}
|
|
8867
|
+
return Object.keys(out).length > 0 ? out : void 0;
|
|
8868
|
+
}
|
|
8869
|
+
function tagListToMap(tags) {
|
|
8870
|
+
const out = {};
|
|
8871
|
+
for (const t of tags ?? []) {
|
|
8872
|
+
const k = str$1(t.Key);
|
|
8873
|
+
if (k !== void 0) out[k] = t.Value ?? "";
|
|
8874
|
+
}
|
|
8875
|
+
return out;
|
|
8876
|
+
}
|
|
8877
|
+
function mirrorDeclaredTagsMap(declaredTags) {
|
|
8878
|
+
if (typeof declaredTags !== "object" || declaredTags === null || Array.isArray(declaredTags)) return void 0;
|
|
8879
|
+
const out = {};
|
|
8880
|
+
for (const [k, v] of Object.entries(declaredTags)) {
|
|
8881
|
+
if (str$1(k) === void 0) continue;
|
|
8882
|
+
out[k] = str$1(v) ?? "";
|
|
8883
|
+
}
|
|
8884
|
+
return Object.keys(out).length > 0 ? out : void 0;
|
|
8885
|
+
}
|
|
8827
8886
|
const readS3BucketPolicy = async ({ declared, region }) => {
|
|
8828
8887
|
const bucket = str$1(declared.Bucket);
|
|
8829
8888
|
if (!bucket) return void 0;
|
|
@@ -9130,11 +9189,16 @@ const readDlmLifecyclePolicy = async ({ physicalId, declared, region }) => {
|
|
|
9130
9189
|
if (declared.PolicyDetails === void 0 && DLM_DEFAULT_POLICY_SHORTHAND.some((k) => declared[k] !== void 0)) {
|
|
9131
9190
|
for (const k of DLM_DEFAULT_POLICY_SHORTHAND) if (details[k] !== void 0) model[k] = details[k];
|
|
9132
9191
|
} else if (Object.keys(details).length > 0) model.PolicyDetails = details;
|
|
9192
|
+
const dlmTags = projectTagList(Object.entries(p.Tags ?? {}).map(([Key, Value]) => ({
|
|
9193
|
+
Key,
|
|
9194
|
+
Value
|
|
9195
|
+
})));
|
|
9196
|
+
if (dlmTags) model.Tags = dlmTags;
|
|
9133
9197
|
return model;
|
|
9134
9198
|
};
|
|
9135
9199
|
async function attachDmsTags(c, arn, declared, model, label) {
|
|
9136
9200
|
try {
|
|
9137
|
-
const tags = projectTagList((await c.send(new ListTagsForResourceCommand$
|
|
9201
|
+
const tags = projectTagList((await c.send(new ListTagsForResourceCommand$2({ ResourceArn: arn }))).TagList);
|
|
9138
9202
|
if (tags) model.Tags = tags;
|
|
9139
9203
|
} catch (err) {
|
|
9140
9204
|
const mirrored = mirrorDeclaredTags(declared.Tags);
|
|
@@ -9291,28 +9355,42 @@ const readLakeFormationResource = async ({ physicalId, region }) => {
|
|
|
9291
9355
|
if (typeof info.HybridAccessEnabled === "boolean") model.HybridAccessEnabled = info.HybridAccessEnabled;
|
|
9292
9356
|
return model;
|
|
9293
9357
|
};
|
|
9294
|
-
|
|
9358
|
+
async function attachMediaConvertTags(c, arn, declared, model, label) {
|
|
9359
|
+
try {
|
|
9360
|
+
const tags = projectTagMap((await c.send(new ListTagsForResourceCommand$3({ Arn: arn }))).ResourceTags?.Tags);
|
|
9361
|
+
if (tags) model.Tags = tags;
|
|
9362
|
+
} catch (err) {
|
|
9363
|
+
const mirrored = mirrorDeclaredTagsMap(declared.Tags);
|
|
9364
|
+
if (mirrored) model.Tags = mirrored;
|
|
9365
|
+
const call = err?.name || "unknown error";
|
|
9366
|
+
process.stderr.write(`[cdkrd] warning: MediaConvert ListTagsForResource for ${label} (${arn}) failed (${call}) — mirroring declared Tags to avoid a false drift; grant mediaconvert:ListTagsForResource to detect out-of-band tag changes\n`);
|
|
9367
|
+
}
|
|
9368
|
+
}
|
|
9369
|
+
const readMediaConvertQueue = async ({ physicalId, declared, region }) => {
|
|
9295
9370
|
const name = str$1(physicalId);
|
|
9296
9371
|
if (!name) return void 0;
|
|
9297
|
-
const
|
|
9372
|
+
const c = new MediaConvertClient({
|
|
9298
9373
|
region,
|
|
9299
9374
|
...READ_RETRY
|
|
9300
|
-
})
|
|
9375
|
+
});
|
|
9376
|
+
const q = (await c.send(new GetQueueCommand({ Name: name }))).Queue;
|
|
9301
9377
|
if (!q) throw new ResourceGoneError(`MediaConvert Queue ${name} absent`);
|
|
9302
9378
|
const model = {};
|
|
9303
9379
|
if (str$1(q.Name)) model.Name = q.Name;
|
|
9304
9380
|
if (str$1(q.Description)) model.Description = q.Description;
|
|
9305
9381
|
if (str$1(q.PricingPlan)) model.PricingPlan = q.PricingPlan;
|
|
9306
9382
|
if (str$1(q.Status)) model.Status = q.Status;
|
|
9383
|
+
if (str$1(q.Arn)) await attachMediaConvertTags(c, q.Arn, declared, model, `Queue ${name}`);
|
|
9307
9384
|
return model;
|
|
9308
9385
|
};
|
|
9309
|
-
const readMediaConvertJobTemplate = async ({ physicalId, region }) => {
|
|
9386
|
+
const readMediaConvertJobTemplate = async ({ physicalId, declared, region }) => {
|
|
9310
9387
|
const name = str$1(physicalId);
|
|
9311
9388
|
if (!name) return void 0;
|
|
9312
|
-
const
|
|
9389
|
+
const c = new MediaConvertClient({
|
|
9313
9390
|
region,
|
|
9314
9391
|
...READ_RETRY
|
|
9315
|
-
})
|
|
9392
|
+
});
|
|
9393
|
+
const t = (await c.send(new GetJobTemplateCommand({ Name: name }))).JobTemplate;
|
|
9316
9394
|
if (!t) throw new ResourceGoneError(`MediaConvert JobTemplate ${name} absent`);
|
|
9317
9395
|
const model = {};
|
|
9318
9396
|
if (str$1(t.Name)) model.Name = t.Name;
|
|
@@ -9324,6 +9402,7 @@ const readMediaConvertJobTemplate = async ({ physicalId, region }) => {
|
|
|
9324
9402
|
if (t.AccelerationSettings !== void 0) model.AccelerationSettings = t.AccelerationSettings;
|
|
9325
9403
|
if (Array.isArray(t.HopDestinations) && t.HopDestinations.length > 0) model.HopDestinations = t.HopDestinations;
|
|
9326
9404
|
if (t.Settings !== void 0) model.SettingsJson = t.Settings;
|
|
9405
|
+
if (str$1(t.Arn)) await attachMediaConvertTags(c, t.Arn, declared, model, `JobTemplate ${name}`);
|
|
9327
9406
|
return model;
|
|
9328
9407
|
};
|
|
9329
9408
|
const readCodeBuildReportGroup = async ({ physicalId, region }) => {
|
|
@@ -9496,13 +9575,14 @@ const readEc2ClientVpnTargetNetworkAssociation = async ({ physicalId, declared,
|
|
|
9496
9575
|
if (str$1(n.TargetNetworkId)) model.SubnetId = n.TargetNetworkId;
|
|
9497
9576
|
return model;
|
|
9498
9577
|
};
|
|
9499
|
-
const readDaxCluster = async ({ physicalId, region }) => {
|
|
9578
|
+
const readDaxCluster = async ({ physicalId, declared, region }) => {
|
|
9500
9579
|
const name = str$1(physicalId);
|
|
9501
9580
|
if (!name) return void 0;
|
|
9502
|
-
const
|
|
9581
|
+
const c = new DAXClient({
|
|
9503
9582
|
region,
|
|
9504
9583
|
...READ_RETRY
|
|
9505
|
-
})
|
|
9584
|
+
});
|
|
9585
|
+
const cl = (await c.send(new DescribeClustersCommand({ ClusterNames: [name] }))).Clusters?.[0];
|
|
9506
9586
|
if (!cl) throw new ResourceGoneError(`DAX Cluster ${name} absent`);
|
|
9507
9587
|
const model = {};
|
|
9508
9588
|
if (str$1(cl.ClusterName)) model.ClusterName = cl.ClusterName;
|
|
@@ -9517,6 +9597,16 @@ const readDaxCluster = async ({ physicalId, region }) => {
|
|
|
9517
9597
|
if (cl.ParameterGroup && str$1(cl.ParameterGroup.ParameterGroupName)) model.ParameterGroupName = cl.ParameterGroup.ParameterGroupName;
|
|
9518
9598
|
if (cl.NotificationConfiguration && str$1(cl.NotificationConfiguration.TopicArn)) model.NotificationTopicARN = cl.NotificationConfiguration.TopicArn;
|
|
9519
9599
|
if (cl.SSEDescription?.Status === "ENABLED") model.SSESpecification = { SSEEnabled: true };
|
|
9600
|
+
const daxArn = str$1(cl.ClusterArn);
|
|
9601
|
+
if (daxArn) try {
|
|
9602
|
+
const tags = projectTagMap(tagListToMap((await c.send(new ListTagsCommand({ ResourceName: daxArn }))).Tags));
|
|
9603
|
+
if (tags) model.Tags = tags;
|
|
9604
|
+
} catch (err) {
|
|
9605
|
+
const mirrored = mirrorDeclaredTagsMap(declared.Tags);
|
|
9606
|
+
if (mirrored) model.Tags = mirrored;
|
|
9607
|
+
const call = err?.name || "unknown error";
|
|
9608
|
+
process.stderr.write(`[cdkrd] warning: DAX ListTags for Cluster ${name} (${daxArn}) failed (${call}) — mirroring declared Tags to avoid a false drift; grant dax:ListTags to detect out-of-band tag changes\n`);
|
|
9609
|
+
}
|
|
9520
9610
|
return model;
|
|
9521
9611
|
};
|
|
9522
9612
|
const readDaxParameterGroup = async ({ physicalId, region }) => {
|
|
@@ -9542,7 +9632,7 @@ const readDaxParameterGroup = async ({ physicalId, region }) => {
|
|
|
9542
9632
|
if (Object.keys(values).length > 0) model.ParameterNameValues = values;
|
|
9543
9633
|
return model;
|
|
9544
9634
|
};
|
|
9545
|
-
const readElastiCacheParameterGroup = async ({ physicalId, region }) => {
|
|
9635
|
+
const readElastiCacheParameterGroup = async ({ physicalId, declared, region, accountId }) => {
|
|
9546
9636
|
const name = str$1(physicalId);
|
|
9547
9637
|
if (!name) return void 0;
|
|
9548
9638
|
const c = new ElastiCacheClient({
|
|
@@ -9571,6 +9661,18 @@ const readElastiCacheParameterGroup = async ({ physicalId, region }) => {
|
|
|
9571
9661
|
marker = str$1(p.Marker);
|
|
9572
9662
|
} while (marker !== void 0);
|
|
9573
9663
|
if (Object.keys(values).length > 0) model.Properties = values;
|
|
9664
|
+
if (accountId) {
|
|
9665
|
+
const arn = `arn:${partitionForRegion(region).partition}:elasticache:${region}:${accountId}:parametergroup:${name}`;
|
|
9666
|
+
try {
|
|
9667
|
+
const tags = projectTagList((await c.send(new ListTagsForResourceCommand$1({ ResourceName: arn }))).TagList);
|
|
9668
|
+
if (tags) model.Tags = tags;
|
|
9669
|
+
} catch (err) {
|
|
9670
|
+
const mirrored = mirrorDeclaredTags(declared.Tags);
|
|
9671
|
+
if (mirrored) model.Tags = mirrored;
|
|
9672
|
+
const call = err?.name || "unknown error";
|
|
9673
|
+
process.stderr.write(`[cdkrd] warning: ElastiCache ListTagsForResource for ParameterGroup ${name} (${arn}) failed (${call}) — mirroring declared Tags to avoid a false drift; grant elasticache:ListTagsForResource to detect out-of-band tag changes\n`);
|
|
9674
|
+
}
|
|
9675
|
+
}
|
|
9574
9676
|
return model;
|
|
9575
9677
|
};
|
|
9576
9678
|
const readDaxSubnetGroup = async ({ physicalId, region }) => {
|
|
@@ -9736,18 +9838,31 @@ const readGlueClassifier = async ({ physicalId, declared, region }) => {
|
|
|
9736
9838
|
if (cl.XMLClassifier) out.XMLClassifier = project(cl.XMLClassifier);
|
|
9737
9839
|
return out;
|
|
9738
9840
|
};
|
|
9739
|
-
const readGlueWorkflow = async ({ physicalId, declared, region }) => {
|
|
9841
|
+
const readGlueWorkflow = async ({ physicalId, declared, region, accountId }) => {
|
|
9740
9842
|
const name = str$1(physicalId) ?? str$1(declared.Name);
|
|
9741
9843
|
if (!name) return void 0;
|
|
9742
|
-
const
|
|
9844
|
+
const c = new GlueClient({
|
|
9743
9845
|
region,
|
|
9744
9846
|
...READ_RETRY
|
|
9745
|
-
})
|
|
9847
|
+
});
|
|
9848
|
+
const w = (await c.send(new GetWorkflowCommand({ Name: name }))).Workflow;
|
|
9746
9849
|
if (!w) return void 0;
|
|
9747
9850
|
const out = { Name: w.Name };
|
|
9748
9851
|
if (w.Description !== void 0) out.Description = w.Description;
|
|
9749
9852
|
if (w.DefaultRunProperties !== void 0) out.DefaultRunProperties = w.DefaultRunProperties;
|
|
9750
9853
|
if (w.MaxConcurrentRuns !== void 0) out.MaxConcurrentRuns = w.MaxConcurrentRuns;
|
|
9854
|
+
if (accountId) {
|
|
9855
|
+
const arn = `arn:${partitionForRegion(region).partition}:glue:${region}:${accountId}:workflow/${name}`;
|
|
9856
|
+
try {
|
|
9857
|
+
const tags = projectTagMap((await c.send(new GetTagsCommand({ ResourceArn: arn }))).Tags);
|
|
9858
|
+
if (tags) out.Tags = tags;
|
|
9859
|
+
} catch (err) {
|
|
9860
|
+
const mirrored = mirrorDeclaredTagsMap(declared.Tags);
|
|
9861
|
+
if (mirrored) out.Tags = mirrored;
|
|
9862
|
+
const call = err?.name || "unknown error";
|
|
9863
|
+
process.stderr.write(`[cdkrd] warning: Glue GetTags for Workflow ${name} (${arn}) failed (${call}) — mirroring declared Tags to avoid a false drift; grant glue:GetTags to detect out-of-band tag changes\n`);
|
|
9864
|
+
}
|
|
9865
|
+
}
|
|
9751
9866
|
return out;
|
|
9752
9867
|
};
|
|
9753
9868
|
const GLUE_CONNECTION_MANAGED = new Set([
|
|
@@ -9844,7 +9959,7 @@ const readSageMakerEndpointConfig = async ({ physicalId, declared, region, accou
|
|
|
9844
9959
|
if (r.VpcConfig !== void 0) model.VpcConfig = r.VpcConfig;
|
|
9845
9960
|
const tagArn = str$1(r.EndpointConfigArn) ?? (accountId ? `arn:${partitionForRegion(region).partition}:sagemaker:${region}:${accountId}:endpoint-config/${name}` : void 0);
|
|
9846
9961
|
if (tagArn) try {
|
|
9847
|
-
const tags = projectTagList((await c.send(new ListTagsCommand({ ResourceArn: tagArn }))).Tags);
|
|
9962
|
+
const tags = projectTagList((await c.send(new ListTagsCommand$1({ ResourceArn: tagArn }))).Tags);
|
|
9848
9963
|
if (tags) model.Tags = tags;
|
|
9849
9964
|
} catch (err) {
|
|
9850
9965
|
const mirrored = mirrorDeclaredTags(declared.Tags);
|
|
@@ -10012,28 +10127,42 @@ const readCodeBuildProject = async ({ physicalId, declared, region }) => {
|
|
|
10012
10127
|
}));
|
|
10013
10128
|
return model;
|
|
10014
10129
|
};
|
|
10015
|
-
|
|
10130
|
+
async function attachServiceDiscoveryTags(c, arn, declared, model, label) {
|
|
10131
|
+
try {
|
|
10132
|
+
const tags = projectTagList((await c.send(new ListTagsForResourceCommand$4({ ResourceARN: arn }))).Tags);
|
|
10133
|
+
if (tags) model.Tags = tags;
|
|
10134
|
+
} catch (err) {
|
|
10135
|
+
const mirrored = mirrorDeclaredTags(declared.Tags);
|
|
10136
|
+
if (mirrored) model.Tags = mirrored;
|
|
10137
|
+
const call = err?.name || "unknown error";
|
|
10138
|
+
process.stderr.write(`[cdkrd] warning: ServiceDiscovery ListTagsForResource for ${label} (${arn}) failed (${call}) — mirroring declared Tags to avoid a false drift; grant servicediscovery:ListTagsForResource to detect out-of-band tag changes\n`);
|
|
10139
|
+
}
|
|
10140
|
+
}
|
|
10141
|
+
const readServiceDiscoveryNamespace = async ({ physicalId, declared, region }) => {
|
|
10016
10142
|
const id = str$1(physicalId);
|
|
10017
10143
|
if (!id) return void 0;
|
|
10018
|
-
const
|
|
10144
|
+
const c = new ServiceDiscoveryClient({
|
|
10019
10145
|
region,
|
|
10020
10146
|
...READ_RETRY
|
|
10021
|
-
})
|
|
10147
|
+
});
|
|
10148
|
+
const ns = (await c.send(new GetNamespaceCommand({ Id: id }))).Namespace;
|
|
10022
10149
|
if (!ns) return void 0;
|
|
10023
10150
|
const model = {};
|
|
10024
10151
|
if (ns.Name !== void 0) model.Name = ns.Name;
|
|
10025
10152
|
if (ns.Description !== void 0) model.Description = ns.Description;
|
|
10026
10153
|
if (ns.Arn !== void 0) model.Arn = ns.Arn;
|
|
10027
10154
|
if (ns.Id !== void 0) model.Id = ns.Id;
|
|
10155
|
+
if (str$1(ns.Arn)) await attachServiceDiscoveryTags(c, ns.Arn, declared, model, `Namespace ${id}`);
|
|
10028
10156
|
return model;
|
|
10029
10157
|
};
|
|
10030
|
-
const readServiceDiscoveryService = async ({ physicalId, region }) => {
|
|
10158
|
+
const readServiceDiscoveryService = async ({ physicalId, declared, region }) => {
|
|
10031
10159
|
const id = str$1(physicalId);
|
|
10032
10160
|
if (!id) return void 0;
|
|
10033
|
-
const
|
|
10161
|
+
const c = new ServiceDiscoveryClient({
|
|
10034
10162
|
region,
|
|
10035
10163
|
...READ_RETRY
|
|
10036
|
-
})
|
|
10164
|
+
});
|
|
10165
|
+
const s = (await c.send(new GetServiceCommand({ Id: id }))).Service;
|
|
10037
10166
|
if (!s) return void 0;
|
|
10038
10167
|
const model = {};
|
|
10039
10168
|
if (s.Name !== void 0) model.Name = s.Name;
|
|
@@ -10053,6 +10182,7 @@ const readServiceDiscoveryService = async ({ physicalId, region }) => {
|
|
|
10053
10182
|
...s.HealthCheckConfig.FailureThreshold !== void 0 && { FailureThreshold: s.HealthCheckConfig.FailureThreshold }
|
|
10054
10183
|
};
|
|
10055
10184
|
if (s.HealthCheckCustomConfig) model.HealthCheckCustomConfig = { ...s.HealthCheckCustomConfig.FailureThreshold !== void 0 && { FailureThreshold: s.HealthCheckCustomConfig.FailureThreshold } };
|
|
10185
|
+
if (str$1(s.Arn)) await attachServiceDiscoveryTags(c, s.Arn, declared, model, `Service ${id}`);
|
|
10056
10186
|
return model;
|
|
10057
10187
|
};
|
|
10058
10188
|
async function attachDocDbTags(c, arn, declared, model, label) {
|
|
@@ -11570,7 +11700,8 @@ function buildSiblingListenerPorts(desired) {
|
|
|
11570
11700
|
const ranges = r.declared?.PortRanges;
|
|
11571
11701
|
const first = Array.isArray(ranges) ? ranges[0] : void 0;
|
|
11572
11702
|
const from = first && typeof first === "object" ? first.FromPort : void 0;
|
|
11573
|
-
|
|
11703
|
+
const port = typeof from === "number" ? from : typeof from === "string" && /^\d+$/.test(from) ? Number(from) : void 0;
|
|
11704
|
+
if (port !== void 0) map[r.physicalId] = port;
|
|
11574
11705
|
}
|
|
11575
11706
|
return map;
|
|
11576
11707
|
}
|