cdk-real-drift 0.22.7 → 0.23.1

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
@@ -1193,6 +1193,10 @@ place, since Cloud Control has no handler for the type),
1193
1193
  `AWS::Config::ConfigurationRecorder` — a whole-recorder upsert re-supplying the
1194
1194
  declared RecordingGroup / RecordingMode / RoleARN, since Cloud Control cannot
1195
1195
  write the type),
1196
+ `budgets:UpdateBudget` (reverts an `AWS::Budgets::Budget` — a whole-`NewBudget`
1197
+ overwrite reconstructed from the desired values plus the live projection, since
1198
+ Cloud Control cannot write the type; a computed `BudgetLimit` is dropped for an
1199
+ auto-adjusting budget so revert keeps it auto-adjusting),
1196
1200
  `ecs:UpdateService` (reverts an `AWS::ECS::Service` `ServiceConnectConfiguration` /
1197
1201
  `VolumeConfigurations` drift — the whole writeOnly prop is re-supplied, since Cloud
1198
1202
  Control cannot sub-path patch it),
package/dist/cli.js CHANGED
@@ -36,7 +36,7 @@ import { DeleteResourcePolicyCommand, GetResourcePolicyCommand, SecretsManagerCl
36
36
  import { GetTopicAttributesCommand, ListSubscriptionsByTopicCommand, SNSClient, SetTopicAttributesCommand } from "@aws-sdk/client-sns";
37
37
  import { GetQueueAttributesCommand, SQSClient, SetQueueAttributesCommand } from "@aws-sdk/client-sqs";
38
38
  import { ACMClient, DescribeCertificateCommand, ListTagsForCertificateCommand } from "@aws-sdk/client-acm";
39
- import { BudgetsClient, DescribeBudgetCommand } from "@aws-sdk/client-budgets";
39
+ import { BudgetsClient, DescribeBudgetCommand, UpdateBudgetCommand } from "@aws-sdk/client-budgets";
40
40
  import { DescribeConfigurationSettingsCommand, ElasticBeanstalkClient, UpdateApplicationCommand, UpdateApplicationResourceLifecycleCommand, UpdateEnvironmentCommand } from "@aws-sdk/client-elastic-beanstalk";
41
41
  import { CognitoSyncClient, GetCognitoEventsCommand, SetCognitoEventsCommand } from "@aws-sdk/client-cognito-sync";
42
42
  import { BatchGetProjectsCommand, BatchGetReportGroupsCommand, CodeBuildClient, UpdateProjectCommand, UpdateReportGroupCommand } from "@aws-sdk/client-codebuild";
@@ -4267,6 +4267,7 @@ function isEpochHourEqual(a, b) {
4267
4267
  const hb = sec(b);
4268
4268
  return ha !== void 0 && hb !== void 0 && ha === hb;
4269
4269
  }
4270
+ const NUMERIC_STRING_EQUAL_PATHS = { "AWS::Budgets::Budget": [/(?:^|\.)BudgetLimit\.Amount$/, /(?:^|\.)PlannedBudgetLimits\.[^.]+\.Amount$/] };
4270
4271
  const TRAILING_DOT_PATHS = {
4271
4272
  "AWS::Route53::HostedZone": new Set(["Name"]),
4272
4273
  "AWS::Route53::RecordSet": new Set(["Name"]),
@@ -7681,6 +7682,7 @@ function classifyResource(resource, liveRaw, schema, opts = {}) {
7681
7682
  if (CASE_INSENSITIVE_KEY_PATHS[resourceType]?.has(d.path.replace(/\.\d+(?=\.)/g, "[]")) && isCaseInsensitiveKeyMapEqual(d.stateValue, d.awsValue)) continue;
7682
7683
  if (RATE_EXPRESSION_PATHS[resourceType]?.has(d.path) && isEquivalentRateExpression(d.stateValue, d.awsValue)) continue;
7683
7684
  if (EPOCH_HOUR_PATHS[resourceType]?.has(d.path) && isEpochHourEqual(d.stateValue, d.awsValue)) continue;
7685
+ if (NUMERIC_STRING_EQUAL_PATHS[resourceType]?.some((re) => re.test(d.path)) && isNumericStringEqualScalar(d.stateValue, d.awsValue)) continue;
7684
7686
  if (TRAILING_DOT_PATHS[resourceType]?.has(d.path) && isTrailingDotEqual(d.stateValue, d.awsValue)) continue;
7685
7687
  if (TRAILING_SLASH_PATHS[resourceType]?.has(d.path) && isTrailingSlashEqual(d.stateValue, d.awsValue)) continue;
7686
7688
  if (VERSION_PREFIX_PATHS[resourceType]?.has(d.path) && isVersionPrefixMatch(d.stateValue, d.awsValue)) continue;
@@ -11654,7 +11656,7 @@ const readBudget = async ({ physicalId, declared, accountId, region }) => {
11654
11656
  BudgetName: b.BudgetName,
11655
11657
  BudgetType: b.BudgetType,
11656
11658
  TimeUnit: b.TimeUnit,
11657
- ...b.BudgetLimit !== void 0 && { BudgetLimit: b.BudgetLimit },
11659
+ ...b.BudgetLimit !== void 0 && !aad && b.PlannedBudgetLimits === void 0 && { BudgetLimit: b.BudgetLimit },
11658
11660
  ...b.PlannedBudgetLimits !== void 0 && { PlannedBudgetLimits: b.PlannedBudgetLimits },
11659
11661
  ...b.CostFilters !== void 0 && { CostFilters: b.CostFilters },
11660
11662
  ...b.CostTypes !== void 0 && { CostTypes: b.CostTypes },
@@ -19116,7 +19118,24 @@ const writeApiGatewayRestApiPolicy = async (ctx) => {
19116
19118
  }]
19117
19119
  }));
19118
19120
  };
19121
+ const writeBudget = async (ctx, ops) => {
19122
+ const budget = (await desiredModel("AWS::Budgets::Budget", ctx, ops)).Budget;
19123
+ if (!budget || !str(budget.BudgetName) || !str(budget.BudgetType) || !str(budget.TimeUnit)) throw new Error("cannot resolve Budget identity (BudgetName/BudgetType/TimeUnit) for revert");
19124
+ if (!str(ctx.accountId)) throw new Error("cannot resolve AccountId for Budget revert");
19125
+ const newBudget = budget.AutoAdjustData ? {
19126
+ ...budget,
19127
+ BudgetLimit: void 0
19128
+ } : budget;
19129
+ await new BudgetsClient({
19130
+ region: ctx.region,
19131
+ ...CLIENT_TIMEOUTS
19132
+ }).send(new UpdateBudgetCommand({
19133
+ AccountId: ctx.accountId,
19134
+ NewBudget: newBudget
19135
+ }));
19136
+ };
19119
19137
  const SDK_WRITERS = {
19138
+ "AWS::Budgets::Budget": writeBudget,
19120
19139
  "AWS::ApiGatewayV2::Stage": writeApiGatewayV2Stage,
19121
19140
  "AWS::ElasticBeanstalk::Application": writeElasticBeanstalkApplication,
19122
19141
  "AWS::ElasticBeanstalk::Environment": writeElasticBeanstalkEnvironment,