cdk-real-drift 0.18.13 → 0.18.15

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/dist/cli.js CHANGED
@@ -45,7 +45,7 @@ import { DAXClient, DescribeClustersCommand, DescribeParameterGroupsCommand, Des
45
45
  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";
46
46
  import { DescribeCacheClustersCommand, DescribeCacheParameterGroupsCommand, DescribeCacheParametersCommand, DescribeReplicationGroupsCommand, DescribeUsersCommand, ElastiCacheClient, ListTagsForResourceCommand as ListTagsForResourceCommand$2, ModifyCacheParameterGroupCommand, ResetCacheParameterGroupCommand } from "@aws-sdk/client-elasticache";
47
47
  import { DescribeParameterGroupsCommand as DescribeParameterGroupsCommand$1, DescribeParametersCommand as DescribeParametersCommand$2, DescribeUsersCommand as DescribeUsersCommand$1, MemoryDBClient, ResetParameterGroupCommand, UpdateParameterGroupCommand as UpdateParameterGroupCommand$1 } from "@aws-sdk/client-memorydb";
48
- import { CloudWatchClient, DescribeAnomalyDetectorsCommand, PutAnomalyDetectorCommand } from "@aws-sdk/client-cloudwatch";
48
+ import { CloudWatchClient, DescribeAnomalyDetectorsCommand, DisableAlarmActionsCommand, EnableAlarmActionsCommand, PutAnomalyDetectorCommand } from "@aws-sdk/client-cloudwatch";
49
49
  import { DLMClient, GetLifecyclePolicyCommand, UpdateLifecyclePolicyCommand } from "@aws-sdk/client-dlm";
50
50
  import { DescribeResourceCommand, EntityNotFoundException, LakeFormationClient } from "@aws-sdk/client-lakeformation";
51
51
  import { GetJobTemplateCommand, GetQueueCommand, ListTagsForResourceCommand as ListTagsForResourceCommand$3, MediaConvertClient } from "@aws-sdk/client-mediaconvert";
@@ -2490,6 +2490,7 @@ const KNOWN_DEFAULTS = {
2490
2490
  MinimumHealthyPercent: 100
2491
2491
  }
2492
2492
  },
2493
+ "AWS::AppConfig::ConfigurationProfile": { Type: "AWS.Freeform" },
2493
2494
  "AWS::AppSync::GraphQLApi": {
2494
2495
  ApiType: "GRAPHQL",
2495
2496
  Visibility: "GLOBAL",
@@ -2613,6 +2614,7 @@ const KNOWN_DEFAULTS = {
2613
2614
  ClusterSubnetGroupName: "default"
2614
2615
  },
2615
2616
  "AWS::Redshift::ScheduledAction": { Enable: true },
2617
+ "AWS::EC2::VPCEndpointService": { SupportedIpAddressTypes: ["ipv4"] },
2616
2618
  "AWS::EC2::VPCEndpoint": {
2617
2619
  IpAddressType: "ipv4",
2618
2620
  VpcEndpointType: "Gateway",
@@ -3839,25 +3841,36 @@ const ELB_TG_ATTRIBUTE_DEFAULTS_BY_PROTOCOL = {
3839
3841
  TCP: {
3840
3842
  "stickiness.type": "source_ip",
3841
3843
  "deregistration_delay.connection_termination.enabled": "false",
3842
- "proxy_protocol_v2.enabled": "false"
3844
+ "proxy_protocol_v2.enabled": "false",
3845
+ "target_health_state.unhealthy.connection_termination.enabled": "true",
3846
+ "target_health_state.unhealthy.draining_interval_seconds": "0"
3843
3847
  },
3844
3848
  TLS: {
3845
3849
  "stickiness.type": "source_ip",
3846
3850
  "deregistration_delay.connection_termination.enabled": "false",
3847
- "proxy_protocol_v2.enabled": "false"
3851
+ "proxy_protocol_v2.enabled": "false",
3852
+ "target_health_state.unhealthy.connection_termination.enabled": "true",
3853
+ "target_health_state.unhealthy.draining_interval_seconds": "0"
3848
3854
  },
3849
3855
  UDP: {
3850
3856
  "stickiness.type": "source_ip",
3851
3857
  "deregistration_delay.connection_termination.enabled": "false",
3852
- "proxy_protocol_v2.enabled": "false"
3858
+ "proxy_protocol_v2.enabled": "false",
3859
+ "target_health_state.unhealthy.connection_termination.enabled": "true",
3860
+ "target_health_state.unhealthy.draining_interval_seconds": "0"
3853
3861
  },
3854
3862
  TCP_UDP: {
3855
3863
  "stickiness.type": "source_ip",
3856
3864
  "deregistration_delay.connection_termination.enabled": "false",
3857
- "proxy_protocol_v2.enabled": "false"
3865
+ "proxy_protocol_v2.enabled": "false",
3866
+ "target_health_state.unhealthy.connection_termination.enabled": "true",
3867
+ "target_health_state.unhealthy.draining_interval_seconds": "0"
3858
3868
  }
3859
3869
  };
3860
- const ELB_TG_ATTRIBUTE_DEFAULTS_BY_TARGET_TYPE = { alb: { "preserve_client_ip.enabled": "true" } };
3870
+ const ELB_TG_ATTRIBUTE_DEFAULTS_BY_TARGET_TYPE = {
3871
+ alb: { "preserve_client_ip.enabled": "true" },
3872
+ ip: { "preserve_client_ip.enabled": "false" }
3873
+ };
3861
3874
  const SENTINEL_UNPARSEABLE = Symbol("unparseable");
3862
3875
  function deepCompareUnordered(a, b) {
3863
3876
  if (a === b) return true;
@@ -3938,6 +3951,9 @@ const CASE_INSENSITIVE_PATHS = {
3938
3951
  "AWS::Redshift::Cluster": new Set(["ClusterIdentifier"]),
3939
3952
  "AWS::DMS::ReplicationInstance": new Set(["ReplicationInstanceIdentifier"]),
3940
3953
  "AWS::DMS::ReplicationSubnetGroup": new Set(["ReplicationSubnetGroupIdentifier"]),
3954
+ "AWS::DAX::ParameterGroup": new Set(["ParameterGroupName"]),
3955
+ "AWS::DAX::SubnetGroup": new Set(["SubnetGroupName"]),
3956
+ "AWS::CertificateManager::Certificate": new Set(["DomainName"]),
3941
3957
  "AWS::DMS::Endpoint": new Set(["EndpointType", "EndpointIdentifier"]),
3942
3958
  "AWS::WAFv2::LoggingConfiguration": new Set(["RedactedFields.*.SingleHeader.Name"]),
3943
3959
  "AWS::ElasticLoadBalancing::LoadBalancer": new Set(["Listeners.*.Protocol", "Listeners.*.InstanceProtocol"]),
@@ -4137,7 +4153,8 @@ function isPropertiesFileEqual(a, b) {
4137
4153
  }
4138
4154
  const CASE_INSENSITIVE_ARRAY_PATHS = {
4139
4155
  "AWS::ApiGatewayV2::Api": new Set(["CorsConfiguration.AllowHeaders", "CorsConfiguration.ExposeHeaders"]),
4140
- "AWS::Lambda::Url": new Set(["Cors.AllowHeaders", "Cors.ExposeHeaders"])
4156
+ "AWS::Lambda::Url": new Set(["Cors.AllowHeaders", "Cors.ExposeHeaders"]),
4157
+ "AWS::CertificateManager::Certificate": new Set(["SubjectAlternativeNames"])
4141
4158
  };
4142
4159
  function isCaseInsensitiveEqualScalarSet(a, b) {
4143
4160
  if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false;
@@ -4473,6 +4490,7 @@ const READGAP_COLLECTION_PATHS = {
4473
4490
  "AWS::DynamoDB::GlobalTable": new Set(["SSESpecification"]),
4474
4491
  "AWS::DynamoDB::Table": new Set(["SSESpecification"]),
4475
4492
  "AWS::CertificateManager::Certificate": new Set(["DomainValidationOptions"]),
4493
+ "AWS::Glue::Table": new Set(["OpenTableFormatInput"]),
4476
4494
  "AWS::EC2::ClientVpnEndpoint": new Set(["TagSpecifications"]),
4477
4495
  "AWS::DMS::Endpoint": new Set([
4478
4496
  "DocDbSettings",
@@ -6260,6 +6278,17 @@ function configRecordingStrategyAtDefault(resourceType, schemaPath, value, live)
6260
6278
  const useOnly = group.AllSupported === true ? "ALL_SUPPORTED_RESOURCE_TYPES" : Array.isArray(excl) && excl.length > 0 ? "EXCLUSION_BY_RESOURCE_TYPES" : Array.isArray(group.ResourceTypes) && group.ResourceTypes.length > 0 ? "INCLUSION_BY_RESOURCE_TYPES" : void 0;
6261
6279
  return useOnly !== void 0 && deepEqual(value, { UseOnly: useOnly });
6262
6280
  }
6281
+ function glueIcebergManagedParamsAtDefault(resourceType, schemaPath, value, declared) {
6282
+ if (resourceType !== "AWS::Glue::Table") return false;
6283
+ if (schemaPath !== "TableInput.Parameters") return false;
6284
+ const otf = declared.OpenTableFormatInput;
6285
+ if (!isNestedObject(otf) || !("IcebergInput" in otf)) return false;
6286
+ if (!isNestedObject(value)) return false;
6287
+ const params = value;
6288
+ const managed = new Set(["table_type", "metadata_location"]);
6289
+ if (!Object.keys(params).every((k) => managed.has(k))) return false;
6290
+ return params.table_type === "ICEBERG";
6291
+ }
6263
6292
  const CLB_DEFAULT_SSL_POLICY_NAME = "ELBSecurityPolicy-2016-08";
6264
6293
  function clbDefaultSslPoliciesAtDefault(resourceType, key, value) {
6265
6294
  if (resourceType !== "AWS::ElasticLoadBalancing::LoadBalancer" || key !== "Policies") return false;
@@ -6964,6 +6993,11 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
6964
6993
  ...knownDefPaths,
6965
6994
  "Artifacts.Name": artifactName
6966
6995
  };
6996
+ const envType = declared["Environment"]?.["Type"];
6997
+ if (typeof envType === "string" && envType.endsWith("_LAMBDA_CONTAINER")) knownDef = {
6998
+ ...knownDef,
6999
+ TimeoutInMinutes: 15
7000
+ };
6967
7001
  }
6968
7002
  if (resourceType === "AWS::SecretsManager::RotationSchedule") {
6969
7003
  const expr = declared["RotationRules"]?.["ScheduleExpression"];
@@ -6998,6 +7032,14 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
6998
7032
  };
6999
7033
  }
7000
7034
  }
7035
+ if (resourceType === "AWS::ElasticLoadBalancingV2::TargetGroup") {
7036
+ const proto = declared["Protocol"];
7037
+ if (typeof proto === "string" && (proto === "TCP" || proto === "TLS" || proto === "UDP" || proto === "TCP_UDP") && declared["TargetType"] !== "alb") knownDef = {
7038
+ ...knownDef,
7039
+ HealthCheckProtocol: "TCP",
7040
+ HealthCheckTimeoutSeconds: 10
7041
+ };
7042
+ }
7001
7043
  if (resourceType === "AWS::ElastiCache::ReplicationGroup" && declared["TransitEncryptionEnabled"] === true) knownDef = {
7002
7044
  ...knownDef,
7003
7045
  TransitEncryptionMode: "required"
@@ -7168,7 +7210,7 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
7168
7210
  const parentKey = (path.split(".").pop() ?? "").replace(/\[.*$/, "");
7169
7211
  if (!isObjectForm || /tags$/i.test(parentKey)) return;
7170
7212
  }
7171
- const tier = schemaPath in schema.defaultPaths && matchesKnownDefault(value, schema.defaultPaths[schemaPath]) || schemaPath in knownDefPaths && matchesKnownDefault(value, knownDefPaths[schemaPath]) || (KNOWN_DEFAULT_ONE_OF_PATHS[resourceType]?.[schemaPath]?.some((d) => matchesKnownDefault(value, d)) ?? false) || VALUE_INDEPENDENT_DEFAULT_NESTED_PATHS[resourceType]?.has(schemaPath) && !(schemaPath in knownDefPaths) || dynamoGsiWarmThroughputAtDefault(resourceType, path, value, live, declared) || resourceType === "AWS::Events::EventBusPolicy" && schemaPath === "Statement.*.Sid" && typeof value === "string" && value === declared["StatementId"] || configRecordingStrategyAtDefault(resourceType, schemaPath, value, live) ? "atDefault" : generatedPaths.includes(schemaPath) && isPhysicalIdSegment(value, physicalId) || generatedNestedPaths?.has(schemaPath) && !(schemaPath in knownDefPaths) && (!(schemaPath in (MANAGED_KEY_ALIAS_PATHS[resourceType] ?? {})) || shouldFoldManagedServiceKey(resourceType, schemaPath, value, opts.kmsAliasTargets)) ? "generated" : "undeclared";
7213
+ const tier = schemaPath in schema.defaultPaths && matchesKnownDefault(value, schema.defaultPaths[schemaPath]) || schemaPath in knownDefPaths && matchesKnownDefault(value, knownDefPaths[schemaPath]) || (KNOWN_DEFAULT_ONE_OF_PATHS[resourceType]?.[schemaPath]?.some((d) => matchesKnownDefault(value, d)) ?? false) || VALUE_INDEPENDENT_DEFAULT_NESTED_PATHS[resourceType]?.has(schemaPath) && !(schemaPath in knownDefPaths) || dynamoGsiWarmThroughputAtDefault(resourceType, path, value, live, declared) || resourceType === "AWS::Events::EventBusPolicy" && schemaPath === "Statement.*.Sid" && typeof value === "string" && value === declared["StatementId"] || configRecordingStrategyAtDefault(resourceType, schemaPath, value, live) || glueIcebergManagedParamsAtDefault(resourceType, schemaPath, value, declared) ? "atDefault" : generatedPaths.includes(schemaPath) && isPhysicalIdSegment(value, physicalId) || generatedNestedPaths?.has(schemaPath) && !(schemaPath in knownDefPaths) && (!(schemaPath in (MANAGED_KEY_ALIAS_PATHS[resourceType] ?? {})) || shouldFoldManagedServiceKey(resourceType, schemaPath, value, opts.kmsAliasTargets)) ? "generated" : "undeclared";
7172
7214
  const freeFormKey = tier === "undeclared" && underFreeFormMap(schemaPath);
7173
7215
  findings.push({
7174
7216
  tier,
@@ -12898,11 +12940,12 @@ const readAcmCertificate = async ({ physicalId, declared, region }) => {
12898
12940
  const declaredSans = Array.isArray(declared.SubjectAlternativeNames) ? declared.SubjectAlternativeNames.filter((s) => str$1(s) !== void 0) : [];
12899
12941
  const declaresSans = declaredSans.length > 0;
12900
12942
  let sans = (cert.SubjectAlternativeNames ?? []).filter((s) => str$1(s) !== void 0);
12901
- const apex = str$1(cert.DomainName);
12902
- if (declaresSans && apex !== void 0 && !declaredSans.includes(apex)) {
12943
+ const apex = str$1(cert.DomainName)?.toLowerCase();
12944
+ const declaredSansLower = declaredSans.map((s) => s.toLowerCase());
12945
+ if (declaresSans && apex !== void 0 && !declaredSansLower.includes(apex)) {
12903
12946
  let dropped = false;
12904
12947
  sans = sans.filter((s) => {
12905
- if (!dropped && s === apex) {
12948
+ if (!dropped && s.toLowerCase() === apex) {
12906
12949
  dropped = true;
12907
12950
  return false;
12908
12951
  }
@@ -15626,23 +15669,39 @@ function isRecordableGenerated(f) {
15626
15669
  }
15627
15670
  const RECORDABLE_GENERATED_SOURCE_PATHS = {
15628
15671
  "AWS::Lambda::Function": { CodeSha256: "Code" },
15629
- "AWS::Glue::Job": { ScriptSha256: "Command.ScriptLocation" }
15672
+ "AWS::Glue::Job": { ScriptSha256: "Command.ScriptLocation" },
15673
+ "AWS::ElasticLoadBalancingV2::TrustStore": { CaCertificatesBundleSha256: [
15674
+ "CaCertificatesBundleS3Bucket",
15675
+ "CaCertificatesBundleS3Key",
15676
+ "CaCertificatesBundleS3ObjectVersion"
15677
+ ] }
15630
15678
  };
15679
+ function resolveDeclaredSourcePath(declared, sourcePath) {
15680
+ let node = declared;
15681
+ for (const seg of pathSegments$1(sourcePath)) {
15682
+ node = descendDeclared(node, seg);
15683
+ if (node === void 0) return void 0;
15684
+ }
15685
+ return node;
15686
+ }
15631
15687
  /**
15632
15688
  * Fingerprint of a recordable-generated entry's DECLARED SOURCE value (deep key-sorted
15633
15689
  * content hash), or undefined when the (resourceType, path) has no source mapping, no
15634
15690
  * declared model is available, or the source path does not resolve in it — the undefined
15635
- * cases all fall back to today's behavior (never void on unknown).
15691
+ * cases all fall back to today's behavior (never void on unknown). For a TUPLE source
15692
+ * (#1615) the ordered projection of each sibling path is fingerprinted; undefined only when
15693
+ * EVERY member is unresolvable (an absent optional member is kept positionally, not dropped).
15636
15694
  */
15637
15695
  function declaredSourceFingerprint(resourceType, path, declared) {
15638
15696
  const sourcePath = RECORDABLE_GENERATED_SOURCE_PATHS[resourceType]?.[path];
15639
15697
  if (sourcePath === void 0 || declared === void 0) return void 0;
15640
- let node = declared;
15641
- for (const seg of pathSegments$1(sourcePath)) {
15642
- node = descendDeclared(node, seg);
15643
- if (node === void 0) return void 0;
15698
+ if (Array.isArray(sourcePath)) {
15699
+ const parts = sourcePath.map((sp) => resolveDeclaredSourcePath(declared, sp));
15700
+ if (parts.every((p) => p === void 0)) return void 0;
15701
+ return stableValueHash(parts);
15644
15702
  }
15645
- return stableValueHash(node);
15703
+ const node = resolveDeclaredSourcePath(declared, sourcePath);
15704
+ return node === void 0 ? void 0 : stableValueHash(node);
15646
15705
  }
15647
15706
  /**
15648
15707
  * Build the `recordedSourceFingerprints` map for the entries being written. For each entry
@@ -16075,7 +16134,9 @@ function applyBaseline(findings, baseline, opts = {}) {
16075
16134
  continue;
16076
16135
  }
16077
16136
  const matched = replacedLogical.has(f.logicalId) ? void 0 : recorded.find((a) => entryMatches(a, f));
16078
- const entry = matched !== void 0 && sourceRedeployedVoid.has(recordedKey(matched)) ? void 0 : matched;
16137
+ const sourceRedeployVoided = matched !== void 0 && sourceRedeployedVoid.has(recordedKey(matched));
16138
+ if (sourceRedeployVoided && f.tier === "undeclared") continue;
16139
+ const entry = sourceRedeployVoided ? void 0 : matched;
16079
16140
  if (entry && baselineValueMatches(entry.value, f.actual, f.resourceType, f.path)) continue;
16080
16141
  if (entry) {
16081
16142
  const delta = identityArrayDelta(canonicalizeForCompare(entry.value, f.resourceType), f.actual);
@@ -17628,6 +17689,18 @@ const writeLogGroupBearerTokenAuth = async (ctx, ops) => {
17628
17689
  }));
17629
17690
  }
17630
17691
  };
17692
+ const writeCompositeAlarmActionsEnabled = async (ctx, ops) => {
17693
+ const name = str(ctx.physicalId) ?? str(ctx.declared["AlarmName"]);
17694
+ if (!name) throw new Error("cannot resolve composite alarm name for ActionsEnabled revert");
17695
+ const c = new CloudWatchClient({
17696
+ region: ctx.region,
17697
+ ...CLIENT_TIMEOUTS
17698
+ });
17699
+ for (const op of ops) {
17700
+ const enabled = op.op === "remove" ? true : op.value === true;
17701
+ await c.send(enabled ? new EnableAlarmActionsCommand({ AlarmNames: [name] }) : new DisableAlarmActionsCommand({ AlarmNames: [name] }));
17702
+ }
17703
+ };
17631
17704
  const writeCognitoIdentityPoolEvents = async (ctx, ops) => {
17632
17705
  const id = str(ctx.physicalId) ?? str(ctx.declared["Id"]);
17633
17706
  if (!id) throw new Error("cannot resolve identity pool id for CognitoEvents revert");
@@ -18571,6 +18644,7 @@ const SDK_WRITERS = {
18571
18644
  "AWS::Config::ConfigurationRecorder": writeConfigConfigurationRecorder
18572
18645
  };
18573
18646
  const SDK_PROP_WRITERS = {
18647
+ "AWS::CloudWatch::CompositeAlarm": { ActionsEnabled: writeCompositeAlarmActionsEnabled },
18574
18648
  "AWS::Cognito::IdentityPool": { CognitoEvents: writeCognitoIdentityPoolEvents },
18575
18649
  "AWS::Config::ConfigRule": { InputParameters: writeConfigRuleInputParameters },
18576
18650
  "AWS::KinesisVideo::Stream": { DataRetentionInHours: writeKinesisVideoStreamRetention },
@@ -18914,7 +18988,11 @@ const REVERT_SET_DEFAULT_PATHS = new Set([
18914
18988
  "AWS::ApiGatewayV2::RouteResponse\0ModelSelectionExpression",
18915
18989
  "AWS::ApiGatewayV2::Api\0DisableExecuteApiEndpoint",
18916
18990
  "AWS::ApiGatewayV2::Route\0AuthorizationType",
18917
- "AWS::Kinesis::Stream\0RetentionPeriodHours"
18991
+ "AWS::Kinesis::Stream\0RetentionPeriodHours",
18992
+ "AWS::ECS::Cluster\0ClusterSettings",
18993
+ "AWS::CloudWatch::CompositeAlarm\0ActionsEnabled",
18994
+ "AWS::ApiGateway::RestApi\0ApiKeySourceType",
18995
+ "AWS::Glue::Crawler\0SchemaChangePolicy"
18918
18996
  ]);
18919
18997
  const REVERT_SET_DEFAULT_VALUES = {
18920
18998
  "AWS::EC2::Subnet\0EnableDns64": false,
@@ -19873,10 +19951,28 @@ function previewValue(resourceType, path, v, max = 40) {
19873
19951
  * old value could not be paired) so the user does not silently bless a possibly-attacker-changed
19874
19952
  * value under a bare label. Pure + exported for unit tests.
19875
19953
  */
19876
- function changedRecordLabel(entry, recordedValue) {
19954
+ function changedRecordLabel(entry, recordedValue, sourceRedeployed = false) {
19877
19955
  const id = entry.path ? `${entry.logicalId}.${entry.path}` : `${entry.logicalId} (added resource)`;
19878
19956
  if (!recordedValue.hasRecorded) return id;
19879
- return `${id} (changed since record: ${previewValue(entry.resourceType, entry.path, recordedValue.recordedValue)} → ${previewValue(entry.resourceType, entry.path, entry.value)})`;
19957
+ const recorded = previewValue(entry.resourceType, entry.path, recordedValue.recordedValue);
19958
+ const live = previewValue(entry.resourceType, entry.path, entry.value);
19959
+ if (sourceRedeployed) return `${id} (declared source redeployed via CloudFormation — refreshing watch: ${recorded} → ${live})`;
19960
+ return `${id} (changed since record: ${recorded} → ${live})`;
19961
+ }
19962
+ /**
19963
+ * #1616: true when a `changed` recorded entry is a content hash whose DECLARED SOURCE was
19964
+ * redeployed through CloudFormation since record — the SAME predicate `applyBaseline`'s
19965
+ * stale-source void (#1606) uses to fold the check-side false positive. Such an entry did NOT
19966
+ * change out of band (the IaC deploy moved the live hash with the template), so record must
19967
+ * label and summarize it as a legit refresh, not "CHANGED out of band". Fail-safe: false when
19968
+ * no source fingerprint was stored (an old baseline, or a path with no source mapping) or the
19969
+ * current declared source does not resolve — exactly the void's own gates. Pure + exported.
19970
+ */
19971
+ function isRecordedSourceRedeployed(entry, existing, declaredByLogical) {
19972
+ const storedFp = existing?.recordedSourceFingerprints?.[recordedKey(entry)];
19973
+ if (storedFp === void 0) return false;
19974
+ const currentFp = declaredSourceFingerprint(entry.resourceType, entry.path, declaredByLogical.get(entry.logicalId));
19975
+ return currentFp !== void 0 && currentFp !== storedFp;
19880
19976
  }
19881
19977
  /**
19882
19978
  * #790: the record multiselect label for a `baseline-only` drop-candidate — a recorded value
@@ -20033,9 +20129,14 @@ async function recordStack(p) {
20033
20129
  });
20034
20130
  const droppedKeys = /* @__PURE__ */ new Set();
20035
20131
  if (yes && existing) {
20132
+ const declaredModel = declaredKeysByLogical(desired.resources);
20036
20133
  const { changed } = splitRecordedByBaseline(recorded, existing);
20037
20134
  const changedExisting = changed.filter((e) => recordedValueForChanged(e, existing).hasRecorded);
20038
- if (changedExisting.length > 0) console.error(`note: ${stackName}: --yes accepted ${changedExisting.length} recorded value(s) CHANGED out of band since record (review the baseline diff): ` + changedExisting.map((e) => `${e.logicalId}.${e.path}`).join(", "));
20135
+ const redeployedViaCfn = changedExisting.filter((e) => isRecordedSourceRedeployed(e, existing, declaredModel));
20136
+ const redeployedKeys = new Set(redeployedViaCfn.map((e) => recordedKey(e)));
20137
+ const changedOob = changedExisting.filter((e) => !redeployedKeys.has(recordedKey(e)));
20138
+ if (changedOob.length > 0) console.error(`note: ${stackName}: --yes accepted ${changedOob.length} recorded value(s) CHANGED out of band since record (review the baseline diff): ` + changedOob.map((e) => `${e.logicalId}.${e.path}`).join(", "));
20139
+ if (redeployedViaCfn.length > 0) console.error(`note: ${stackName}: --yes refreshed ${redeployedViaCfn.length} recorded content hash(es) whose declared source was redeployed via CloudFormation since record (not an out-of-band change): ` + redeployedViaCfn.map((e) => `${e.logicalId}.${e.path}`).join(", "));
20039
20140
  if (dropCandidates.length > 0) console.error(`note: ${stackName}: --yes PRESERVED ${dropCandidates.length} recorded watch(es) whose value reverted-to-default / was removed since record (they still report as drift; re-run interactively to drop them)`);
20040
20141
  }
20041
20142
  let refreshedOnly = false;
@@ -20071,11 +20172,13 @@ async function recordStack(p) {
20071
20172
  }
20072
20173
  picked = changed.map((e) => recordedKey(e));
20073
20174
  } else {
20175
+ const declaredModel = declaredKeysByLogical(desired.resources);
20074
20176
  const fromPrompt = await bulkMultiselect(recordSelectMessage(stackName, region, folded.length), standout.map((e) => {
20075
20177
  const rec = recordedValueForChanged(e, existing);
20178
+ const redeployed = isRecordedSourceRedeployed(e, existing, declaredModel);
20076
20179
  return {
20077
20180
  value: recordedKey(e),
20078
- label: changedRecordLabel(e, rec),
20181
+ label: changedRecordLabel(e, rec, redeployed),
20079
20182
  selected: !rec.hasRecorded
20080
20183
  };
20081
20184
  }));