cdk-real-drift 0.12.28 → 0.12.30

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 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` (read an
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` (read a Cloud Map
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` / `ParameterGroup` /
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$1 } from "@aws-sdk/client-database-migration-service";
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";
@@ -926,7 +926,8 @@ function applyIgnores(findings, scope, config) {
926
926
  return {
927
927
  ...rest,
928
928
  tier: "ignored",
929
- note: `ignored by config rule "${hit.raw}"`
929
+ note: `ignored by config rule "${hit.raw}"`,
930
+ ...f.tier ? { ignoredFrom: f.tier } : {}
930
931
  };
931
932
  });
932
933
  }
@@ -1141,6 +1142,35 @@ function cleanupEmptyContextFile(file, existedBefore) {
1141
1142
  if (isEmptyContextJson(readFileSync(file, "utf-8"))) rmSync(file);
1142
1143
  } catch {}
1143
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
+ }
1144
1174
  async function synthApp(app, opts = {}) {
1145
1175
  const { region, profile, context = {} } = opts;
1146
1176
  const stackSelector = buildStackSelector(opts.stackPatterns);
@@ -1173,9 +1203,11 @@ async function synthApp(app, opts = {}) {
1173
1203
  ...hasOverrides && { contextStore: new CdkAppMultiContext(process.cwd(), context) }
1174
1204
  });
1175
1205
  }
1206
+ const synthStart = Date.now();
1176
1207
  const cached = await toolkit.synth(source, stackSelector ? { stacks: stackSelector } : void 0);
1177
1208
  if (!isDir) cleanupEmptyContextFile(contextFile, contextFileExistedBefore);
1178
1209
  try {
1210
+ assertAssemblyFresh(join(cached.cloudAssembly.directory, "manifest.json"), synthStart, isDir);
1179
1211
  const missingKeys = missingContextKeys(collectMissingRecursively(cached.cloudAssembly));
1180
1212
  if (missingKeys.length > 0) {
1181
1213
  const msg = missingContextWarning(missingKeys, { preDeploy: opts.preDeploy });
@@ -4301,6 +4333,7 @@ function unpreviewableParamInfo(template, stackParams, stackName) {
4301
4333
  }).map(([k]) => k);
4302
4334
  if (noValue.length === 0) return null;
4303
4335
  const referenced = collectReferencedNames(template.Resources ?? {});
4336
+ collectReferencedNames(template.Conditions ?? {}, referenced);
4304
4337
  const unpreviewable = noValue.filter((k) => referenced.has(k)).sort();
4305
4338
  if (unpreviewable.length === 0) return null;
4306
4339
  const shown = unpreviewable.slice(0, 10);
@@ -8823,6 +8856,31 @@ function mirrorDeclaredTags(declaredTags) {
8823
8856
  }));
8824
8857
  return out.length > 0 ? out : void 0;
8825
8858
  }
8859
+ function projectTagMap(tags) {
8860
+ const out = {};
8861
+ for (const [k, v] of Object.entries(tags ?? {})) {
8862
+ if (str$1(k) === void 0) continue;
8863
+ out[k] = v ?? "";
8864
+ }
8865
+ return Object.keys(out).length > 0 ? out : void 0;
8866
+ }
8867
+ function tagListToMap(tags) {
8868
+ const out = {};
8869
+ for (const t of tags ?? []) {
8870
+ const k = str$1(t.Key);
8871
+ if (k !== void 0) out[k] = t.Value ?? "";
8872
+ }
8873
+ return out;
8874
+ }
8875
+ function mirrorDeclaredTagsMap(declaredTags) {
8876
+ if (typeof declaredTags !== "object" || declaredTags === null || Array.isArray(declaredTags)) return void 0;
8877
+ const out = {};
8878
+ for (const [k, v] of Object.entries(declaredTags)) {
8879
+ if (str$1(k) === void 0) continue;
8880
+ out[k] = str$1(v) ?? "";
8881
+ }
8882
+ return Object.keys(out).length > 0 ? out : void 0;
8883
+ }
8826
8884
  const readS3BucketPolicy = async ({ declared, region }) => {
8827
8885
  const bucket = str$1(declared.Bucket);
8828
8886
  if (!bucket) return void 0;
@@ -9129,11 +9187,16 @@ const readDlmLifecyclePolicy = async ({ physicalId, declared, region }) => {
9129
9187
  if (declared.PolicyDetails === void 0 && DLM_DEFAULT_POLICY_SHORTHAND.some((k) => declared[k] !== void 0)) {
9130
9188
  for (const k of DLM_DEFAULT_POLICY_SHORTHAND) if (details[k] !== void 0) model[k] = details[k];
9131
9189
  } else if (Object.keys(details).length > 0) model.PolicyDetails = details;
9190
+ const dlmTags = projectTagList(Object.entries(p.Tags ?? {}).map(([Key, Value]) => ({
9191
+ Key,
9192
+ Value
9193
+ })));
9194
+ if (dlmTags) model.Tags = dlmTags;
9132
9195
  return model;
9133
9196
  };
9134
9197
  async function attachDmsTags(c, arn, declared, model, label) {
9135
9198
  try {
9136
- const tags = projectTagList((await c.send(new ListTagsForResourceCommand$1({ ResourceArn: arn }))).TagList);
9199
+ const tags = projectTagList((await c.send(new ListTagsForResourceCommand$2({ ResourceArn: arn }))).TagList);
9137
9200
  if (tags) model.Tags = tags;
9138
9201
  } catch (err) {
9139
9202
  const mirrored = mirrorDeclaredTags(declared.Tags);
@@ -9290,28 +9353,42 @@ const readLakeFormationResource = async ({ physicalId, region }) => {
9290
9353
  if (typeof info.HybridAccessEnabled === "boolean") model.HybridAccessEnabled = info.HybridAccessEnabled;
9291
9354
  return model;
9292
9355
  };
9293
- const readMediaConvertQueue = async ({ physicalId, region }) => {
9356
+ async function attachMediaConvertTags(c, arn, declared, model, label) {
9357
+ try {
9358
+ const tags = projectTagMap((await c.send(new ListTagsForResourceCommand$3({ Arn: arn }))).ResourceTags?.Tags);
9359
+ if (tags) model.Tags = tags;
9360
+ } catch (err) {
9361
+ const mirrored = mirrorDeclaredTagsMap(declared.Tags);
9362
+ if (mirrored) model.Tags = mirrored;
9363
+ const call = err?.name || "unknown error";
9364
+ 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`);
9365
+ }
9366
+ }
9367
+ const readMediaConvertQueue = async ({ physicalId, declared, region }) => {
9294
9368
  const name = str$1(physicalId);
9295
9369
  if (!name) return void 0;
9296
- const q = (await new MediaConvertClient({
9370
+ const c = new MediaConvertClient({
9297
9371
  region,
9298
9372
  ...READ_RETRY
9299
- }).send(new GetQueueCommand({ Name: name }))).Queue;
9373
+ });
9374
+ const q = (await c.send(new GetQueueCommand({ Name: name }))).Queue;
9300
9375
  if (!q) throw new ResourceGoneError(`MediaConvert Queue ${name} absent`);
9301
9376
  const model = {};
9302
9377
  if (str$1(q.Name)) model.Name = q.Name;
9303
9378
  if (str$1(q.Description)) model.Description = q.Description;
9304
9379
  if (str$1(q.PricingPlan)) model.PricingPlan = q.PricingPlan;
9305
9380
  if (str$1(q.Status)) model.Status = q.Status;
9381
+ if (str$1(q.Arn)) await attachMediaConvertTags(c, q.Arn, declared, model, `Queue ${name}`);
9306
9382
  return model;
9307
9383
  };
9308
- const readMediaConvertJobTemplate = async ({ physicalId, region }) => {
9384
+ const readMediaConvertJobTemplate = async ({ physicalId, declared, region }) => {
9309
9385
  const name = str$1(physicalId);
9310
9386
  if (!name) return void 0;
9311
- const t = (await new MediaConvertClient({
9387
+ const c = new MediaConvertClient({
9312
9388
  region,
9313
9389
  ...READ_RETRY
9314
- }).send(new GetJobTemplateCommand({ Name: name }))).JobTemplate;
9390
+ });
9391
+ const t = (await c.send(new GetJobTemplateCommand({ Name: name }))).JobTemplate;
9315
9392
  if (!t) throw new ResourceGoneError(`MediaConvert JobTemplate ${name} absent`);
9316
9393
  const model = {};
9317
9394
  if (str$1(t.Name)) model.Name = t.Name;
@@ -9323,6 +9400,7 @@ const readMediaConvertJobTemplate = async ({ physicalId, region }) => {
9323
9400
  if (t.AccelerationSettings !== void 0) model.AccelerationSettings = t.AccelerationSettings;
9324
9401
  if (Array.isArray(t.HopDestinations) && t.HopDestinations.length > 0) model.HopDestinations = t.HopDestinations;
9325
9402
  if (t.Settings !== void 0) model.SettingsJson = t.Settings;
9403
+ if (str$1(t.Arn)) await attachMediaConvertTags(c, t.Arn, declared, model, `JobTemplate ${name}`);
9326
9404
  return model;
9327
9405
  };
9328
9406
  const readCodeBuildReportGroup = async ({ physicalId, region }) => {
@@ -9495,13 +9573,14 @@ const readEc2ClientVpnTargetNetworkAssociation = async ({ physicalId, declared,
9495
9573
  if (str$1(n.TargetNetworkId)) model.SubnetId = n.TargetNetworkId;
9496
9574
  return model;
9497
9575
  };
9498
- const readDaxCluster = async ({ physicalId, region }) => {
9576
+ const readDaxCluster = async ({ physicalId, declared, region }) => {
9499
9577
  const name = str$1(physicalId);
9500
9578
  if (!name) return void 0;
9501
- const cl = (await new DAXClient({
9579
+ const c = new DAXClient({
9502
9580
  region,
9503
9581
  ...READ_RETRY
9504
- }).send(new DescribeClustersCommand({ ClusterNames: [name] }))).Clusters?.[0];
9582
+ });
9583
+ const cl = (await c.send(new DescribeClustersCommand({ ClusterNames: [name] }))).Clusters?.[0];
9505
9584
  if (!cl) throw new ResourceGoneError(`DAX Cluster ${name} absent`);
9506
9585
  const model = {};
9507
9586
  if (str$1(cl.ClusterName)) model.ClusterName = cl.ClusterName;
@@ -9516,6 +9595,16 @@ const readDaxCluster = async ({ physicalId, region }) => {
9516
9595
  if (cl.ParameterGroup && str$1(cl.ParameterGroup.ParameterGroupName)) model.ParameterGroupName = cl.ParameterGroup.ParameterGroupName;
9517
9596
  if (cl.NotificationConfiguration && str$1(cl.NotificationConfiguration.TopicArn)) model.NotificationTopicARN = cl.NotificationConfiguration.TopicArn;
9518
9597
  if (cl.SSEDescription?.Status === "ENABLED") model.SSESpecification = { SSEEnabled: true };
9598
+ const daxArn = str$1(cl.ClusterArn);
9599
+ if (daxArn) try {
9600
+ const tags = projectTagMap(tagListToMap((await c.send(new ListTagsCommand({ ResourceName: daxArn }))).Tags));
9601
+ if (tags) model.Tags = tags;
9602
+ } catch (err) {
9603
+ const mirrored = mirrorDeclaredTagsMap(declared.Tags);
9604
+ if (mirrored) model.Tags = mirrored;
9605
+ const call = err?.name || "unknown error";
9606
+ 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`);
9607
+ }
9519
9608
  return model;
9520
9609
  };
9521
9610
  const readDaxParameterGroup = async ({ physicalId, region }) => {
@@ -9541,7 +9630,7 @@ const readDaxParameterGroup = async ({ physicalId, region }) => {
9541
9630
  if (Object.keys(values).length > 0) model.ParameterNameValues = values;
9542
9631
  return model;
9543
9632
  };
9544
- const readElastiCacheParameterGroup = async ({ physicalId, region }) => {
9633
+ const readElastiCacheParameterGroup = async ({ physicalId, declared, region, accountId }) => {
9545
9634
  const name = str$1(physicalId);
9546
9635
  if (!name) return void 0;
9547
9636
  const c = new ElastiCacheClient({
@@ -9570,6 +9659,18 @@ const readElastiCacheParameterGroup = async ({ physicalId, region }) => {
9570
9659
  marker = str$1(p.Marker);
9571
9660
  } while (marker !== void 0);
9572
9661
  if (Object.keys(values).length > 0) model.Properties = values;
9662
+ if (accountId) {
9663
+ const arn = `arn:${partitionForRegion(region).partition}:elasticache:${region}:${accountId}:parametergroup:${name}`;
9664
+ try {
9665
+ const tags = projectTagList((await c.send(new ListTagsForResourceCommand$1({ ResourceName: arn }))).TagList);
9666
+ if (tags) model.Tags = tags;
9667
+ } catch (err) {
9668
+ const mirrored = mirrorDeclaredTags(declared.Tags);
9669
+ if (mirrored) model.Tags = mirrored;
9670
+ const call = err?.name || "unknown error";
9671
+ 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`);
9672
+ }
9673
+ }
9573
9674
  return model;
9574
9675
  };
9575
9676
  const readDaxSubnetGroup = async ({ physicalId, region }) => {
@@ -9735,18 +9836,31 @@ const readGlueClassifier = async ({ physicalId, declared, region }) => {
9735
9836
  if (cl.XMLClassifier) out.XMLClassifier = project(cl.XMLClassifier);
9736
9837
  return out;
9737
9838
  };
9738
- const readGlueWorkflow = async ({ physicalId, declared, region }) => {
9839
+ const readGlueWorkflow = async ({ physicalId, declared, region, accountId }) => {
9739
9840
  const name = str$1(physicalId) ?? str$1(declared.Name);
9740
9841
  if (!name) return void 0;
9741
- const w = (await new GlueClient({
9842
+ const c = new GlueClient({
9742
9843
  region,
9743
9844
  ...READ_RETRY
9744
- }).send(new GetWorkflowCommand({ Name: name }))).Workflow;
9845
+ });
9846
+ const w = (await c.send(new GetWorkflowCommand({ Name: name }))).Workflow;
9745
9847
  if (!w) return void 0;
9746
9848
  const out = { Name: w.Name };
9747
9849
  if (w.Description !== void 0) out.Description = w.Description;
9748
9850
  if (w.DefaultRunProperties !== void 0) out.DefaultRunProperties = w.DefaultRunProperties;
9749
9851
  if (w.MaxConcurrentRuns !== void 0) out.MaxConcurrentRuns = w.MaxConcurrentRuns;
9852
+ if (accountId) {
9853
+ const arn = `arn:${partitionForRegion(region).partition}:glue:${region}:${accountId}:workflow/${name}`;
9854
+ try {
9855
+ const tags = projectTagMap((await c.send(new GetTagsCommand({ ResourceArn: arn }))).Tags);
9856
+ if (tags) out.Tags = tags;
9857
+ } catch (err) {
9858
+ const mirrored = mirrorDeclaredTagsMap(declared.Tags);
9859
+ if (mirrored) out.Tags = mirrored;
9860
+ const call = err?.name || "unknown error";
9861
+ 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`);
9862
+ }
9863
+ }
9750
9864
  return out;
9751
9865
  };
9752
9866
  const GLUE_CONNECTION_MANAGED = new Set([
@@ -9843,7 +9957,7 @@ const readSageMakerEndpointConfig = async ({ physicalId, declared, region, accou
9843
9957
  if (r.VpcConfig !== void 0) model.VpcConfig = r.VpcConfig;
9844
9958
  const tagArn = str$1(r.EndpointConfigArn) ?? (accountId ? `arn:${partitionForRegion(region).partition}:sagemaker:${region}:${accountId}:endpoint-config/${name}` : void 0);
9845
9959
  if (tagArn) try {
9846
- const tags = projectTagList((await c.send(new ListTagsCommand({ ResourceArn: tagArn }))).Tags);
9960
+ const tags = projectTagList((await c.send(new ListTagsCommand$1({ ResourceArn: tagArn }))).Tags);
9847
9961
  if (tags) model.Tags = tags;
9848
9962
  } catch (err) {
9849
9963
  const mirrored = mirrorDeclaredTags(declared.Tags);
@@ -10011,28 +10125,42 @@ const readCodeBuildProject = async ({ physicalId, declared, region }) => {
10011
10125
  }));
10012
10126
  return model;
10013
10127
  };
10014
- const readServiceDiscoveryNamespace = async ({ physicalId, region }) => {
10128
+ async function attachServiceDiscoveryTags(c, arn, declared, model, label) {
10129
+ try {
10130
+ const tags = projectTagList((await c.send(new ListTagsForResourceCommand$4({ ResourceARN: arn }))).Tags);
10131
+ if (tags) model.Tags = tags;
10132
+ } catch (err) {
10133
+ const mirrored = mirrorDeclaredTags(declared.Tags);
10134
+ if (mirrored) model.Tags = mirrored;
10135
+ const call = err?.name || "unknown error";
10136
+ 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`);
10137
+ }
10138
+ }
10139
+ const readServiceDiscoveryNamespace = async ({ physicalId, declared, region }) => {
10015
10140
  const id = str$1(physicalId);
10016
10141
  if (!id) return void 0;
10017
- const ns = (await new ServiceDiscoveryClient({
10142
+ const c = new ServiceDiscoveryClient({
10018
10143
  region,
10019
10144
  ...READ_RETRY
10020
- }).send(new GetNamespaceCommand({ Id: id }))).Namespace;
10145
+ });
10146
+ const ns = (await c.send(new GetNamespaceCommand({ Id: id }))).Namespace;
10021
10147
  if (!ns) return void 0;
10022
10148
  const model = {};
10023
10149
  if (ns.Name !== void 0) model.Name = ns.Name;
10024
10150
  if (ns.Description !== void 0) model.Description = ns.Description;
10025
10151
  if (ns.Arn !== void 0) model.Arn = ns.Arn;
10026
10152
  if (ns.Id !== void 0) model.Id = ns.Id;
10153
+ if (str$1(ns.Arn)) await attachServiceDiscoveryTags(c, ns.Arn, declared, model, `Namespace ${id}`);
10027
10154
  return model;
10028
10155
  };
10029
- const readServiceDiscoveryService = async ({ physicalId, region }) => {
10156
+ const readServiceDiscoveryService = async ({ physicalId, declared, region }) => {
10030
10157
  const id = str$1(physicalId);
10031
10158
  if (!id) return void 0;
10032
- const s = (await new ServiceDiscoveryClient({
10159
+ const c = new ServiceDiscoveryClient({
10033
10160
  region,
10034
10161
  ...READ_RETRY
10035
- }).send(new GetServiceCommand({ Id: id }))).Service;
10162
+ });
10163
+ const s = (await c.send(new GetServiceCommand({ Id: id }))).Service;
10036
10164
  if (!s) return void 0;
10037
10165
  const model = {};
10038
10166
  if (s.Name !== void 0) model.Name = s.Name;
@@ -10052,6 +10180,7 @@ const readServiceDiscoveryService = async ({ physicalId, region }) => {
10052
10180
  ...s.HealthCheckConfig.FailureThreshold !== void 0 && { FailureThreshold: s.HealthCheckConfig.FailureThreshold }
10053
10181
  };
10054
10182
  if (s.HealthCheckCustomConfig) model.HealthCheckCustomConfig = { ...s.HealthCheckCustomConfig.FailureThreshold !== void 0 && { FailureThreshold: s.HealthCheckCustomConfig.FailureThreshold } };
10183
+ if (str$1(s.Arn)) await attachServiceDiscoveryTags(c, s.Arn, declared, model, `Service ${id}`);
10055
10184
  return model;
10056
10185
  };
10057
10186
  async function attachDocDbTags(c, arn, declared, model, label) {
@@ -12354,7 +12483,7 @@ function computeCompleteResources(allLogicalIds, findings, recorded, previousCom
12354
12483
  for (const f of findings) {
12355
12484
  if (f.tier === "skipped" || f.tier === "deleted" || f.tier === "readGap") blocked.add(f.logicalId);
12356
12485
  if (f.tier === "undeclared" && !recordedKeys.has(recordedKey(f))) blocked.add(f.logicalId);
12357
- if (f.tier === "ignored" && !recordedKeys.has(recordedKey(f))) blockedByIgnore.add(f.logicalId);
12486
+ if (f.tier === "ignored" && f.ignoredFrom === "undeclared" && !recordedKeys.has(recordedKey(f))) blockedByIgnore.add(f.logicalId);
12358
12487
  }
12359
12488
  const all = new Set(allLogicalIds);
12360
12489
  const complete = new Set(previousComplete.filter((id) => all.has(id) && !blockedByIgnore.has(id)));